Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ private PeaberryData populatePeaberryData(final Element componentClazz) {
}
catch( MirroredTypesException mte ) {
List<? extends TypeMirror> typeMirrors = mte.getTypeMirrors();
Element element = ((DeclaredType)typeMirrors.get(0)).asElement();
peaberryData.serviceInterface = element.toString();
peaberryData.serviceInterfaceSimpleName = element.getSimpleName().toString();
// todo - Figure out what the Peaberry code to export a service under multiple interfaces looks like and update the velocity templates
for (TypeMirror typeMirror : typeMirrors) {
Element serviceInterface = ((DeclaredType)typeMirror).asElement();
peaberryData.serviceInterface = serviceInterface.toString();
peaberryData.serviceInterfaceSimpleName = serviceInterface.getSimpleName().toString();
}
}

TypeElement classElement = (TypeElement) componentClazz;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.google.common.truth.Truth.assert_;
import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource;

import org.junit.Ignore;
import org.junit.Test;

import com.google.testing.compile.JavaFileObjects;
Expand Down Expand Up @@ -104,4 +105,23 @@ private void testPeaberryImportClassGeneratesCorrectlyForServiceLists() {
);
}

@Test
@Ignore
public void testPeaberryExportClassGeneratesCorrectlyForMultipleServiceInterfaces() {
assert_().about(javaSource())
.that(JavaFileObjects.forResource("ServiceOneAndTwoImpl.java"))
.processedWith(
new ServiceExportAnnotationProcessor(),
new ServiceImportAnnotationProcessor()
)
.compilesWithoutError()
/* todo - Figure out what the Peaberry code to export a service under multiple interfaces looks like
.and()

.generatesSources(
JavaFileObjects.forResource("ServiceOnePeaberryExportModule.java"),
JavaFileObjects.forResource("ServiceOnePeaberryServiceExport.java")
)*/;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.eclipse.sisu.contrib.peaberry.testdata;

import org.eclipse.sisu.contrib.peaberry.annotations.ServiceExport;

/**
* Example Service to be exported under multiple interfaces.
*/
@ServiceExport( interfaces = {ServiceOne.class, ServiceTwo.class})
public class ServiceOneAndTwoImpl implements ServiceOne, ServiceTwo {
}