use of de.strullerbaumann.visualee.dependency.entity.Dependency in project visualee by Thomas-S-B.
the class ExaminerObservesTest method testObservesDuring.
@Test
public void testObservesDuring() {
JavaSource javaSource;
Dependency dependency;
String sourceCode;
javaSource = JavaSourceFactory.getInstance().newJavaSource("SnapshotEscalator");
sourceCode = TestDataProvider.getTestSourceCodeBeforeBody() + "public void escalate(@Observes(during=BEFORE_COMPLETION) @Severity(Severity.Level.HEARTBEAT) Snapshot current) {\n" + "}\n";
javaSource.setSourceCode(sourceCode);
examiner.examine(javaSource);
dependency = DependencyContainer.getInstance().getDependencies(javaSource).get(0);
assertEquals(1, DependencyContainer.getInstance().getDependencies(javaSource).size());
assertEquals(DependencyType.OBSERVES, dependency.getDependencyType());
assertEquals("SnapshotEscalator", dependency.getJavaSourceFrom().getName());
assertEquals("Snapshot", dependency.getJavaSourceTo().getName());
}
use of de.strullerbaumann.visualee.dependency.entity.Dependency in project visualee by Thomas-S-B.
the class ExaminerObservesTest method testObservesAnnotated.
@Test
public void testObservesAnnotated() {
JavaSource javaSource;
Dependency dependency1;
Dependency dependency2;
String sourceCode;
javaSource = JavaSourceFactory.getInstance().newJavaSource("SnapshotEscalator");
sourceCode = TestDataProvider.getTestCompleteSourceCodeExample();
javaSource.setSourceCode(sourceCode);
examiner.examine(javaSource);
assertEquals(2, DependencyContainer.getInstance().getDependencies(javaSource).size());
dependency1 = DependencyContainer.getInstance().getDependencies(javaSource).get(0);
assertEquals(DependencyType.OBSERVES, dependency1.getDependencyType());
assertEquals("SnapshotEscalator", dependency1.getJavaSourceFrom().getName());
assertEquals("BrowserWindow", dependency1.getJavaSourceTo().getName());
dependency2 = DependencyContainer.getInstance().getDependencies(javaSource).get(1);
assertEquals(DependencyType.OBSERVES, dependency2.getDependencyType());
assertEquals("SnapshotEscalator", dependency2.getJavaSourceFrom().getName());
assertEquals("Snapshot", dependency2.getJavaSourceTo().getName());
}
use of de.strullerbaumann.visualee.dependency.entity.Dependency in project visualee by Thomas-S-B.
the class ExaminerObservesTest method testObservesWithPhases.
@Test
public void testObservesWithPhases() {
JavaSource javaSource;
Dependency dependency;
String sourceCode;
javaSource = JavaSourceFactory.getInstance().newJavaSource("SnapshotEscalator");
sourceCode = TestDataProvider.getTestSourceCodeBeforeBody() + "public void onToDoChange(@Observes(during = TransactionPhase.AFTER_SUCCESS) @ChangeEvent(ChangeEvent.Type.CREATION) ToDo todo) throws EncodeException {\n" + "List<Script> scripts = this.scripting.activeScripts();\n" + "try {\n" + "Bindings binding = this.scriptEngine.createBindings();\n" + "} catch (Exception e) {\n" + "throw new IllegalStateException(\"Exception during script evaluation: \" + e, e);\n" + "}\n" + "}\n";
javaSource.setSourceCode(sourceCode);
examiner.examine(javaSource);
dependency = DependencyContainer.getInstance().getDependencies(javaSource).get(0);
assertEquals(1, DependencyContainer.getInstance().getDependencies(javaSource).size());
assertEquals(DependencyType.OBSERVES, dependency.getDependencyType());
assertEquals("SnapshotEscalator", dependency.getJavaSourceFrom().getName());
assertEquals("ToDo", dependency.getJavaSourceTo().getName());
}
use of de.strullerbaumann.visualee.dependency.entity.Dependency in project visualee by Thomas-S-B.
the class ExaminerResourceTest method testFindAndSetAttributesResourceInstance.
@Test
public void testFindAndSetAttributesResourceInstance() {
JavaSource javaSource;
Dependency dependency;
String sourceCode;
javaSource = JavaSourceFactory.getInstance().newJavaSource("ResourceCollector");
sourceCode = "@SnapshotDataCollector\n" + "public class ResourceCollector extends AbstractRestDataCollector<List<ConnectionPool>> {\n" + " private static final String RESOURCES = \"resources\";\n" + " @Inject\n" + " @ResourceDataCollector\n" + " Instance<SpecificResourceCollector> specificCollector;\n" + " @Inject\n" + " Instance<Boolean> parallelDataCollection;\n" + " @Resource\n" + " TimerService timerService;\n" + " @Inject\n" + " ParallelDataCollectionExecutor parallelExecutor;\n" + "}\n";
javaSource.setSourceCode(sourceCode);
examiner.examine(javaSource);
assertEquals(1, DependencyContainer.getInstance().getDependencies(javaSource).size());
dependency = DependencyContainer.getInstance().getDependencies(javaSource).get(0);
assertEquals(DependencyType.RESOURCE, dependency.getDependencyType());
assertEquals("ResourceCollector", dependency.getJavaSourceFrom().getName());
assertEquals("TimerService", dependency.getJavaSourceTo().getName());
}
use of de.strullerbaumann.visualee.dependency.entity.Dependency in project visualee by Thomas-S-B.
the class ExaminerInstanceTest method testFindAndSetAttributesSetInstance.
@Test
public void testFindAndSetAttributesSetInstance() {
JavaSource javaSource;
String sourceCode;
javaSource = JavaSourceFactory.getInstance().newJavaSource("EscalationNotificationBroker");
sourceCode = "@Singleton\n" + "@ConcurrencyManagement(ConcurrencyManagementType.BEAN)\n" + "public class EscalationNotificationBroker {\n" + "private static final Logger LOG = Logger.getLogger(EscalationNotificationBroker.class.getName());\n" + "@Inject NotifierStore notifierStore;\n" + "@Inject @Any Instance<Transmitter> transmitters;\n" + "@Inject AsyncTransmitterService asyncService;\n" + "}";
javaSource.setSourceCode(sourceCode);
examiner.examine(javaSource);
assertEquals(1, DependencyContainer.getInstance().getDependencies(javaSource).size());
Dependency dependency;
dependency = DependencyContainer.getInstance().getDependencies(javaSource).get(0);
assertEquals(DependencyType.INSTANCE, dependency.getDependencyType());
assertEquals("EscalationNotificationBroker", dependency.getJavaSourceFrom().getName());
assertEquals("Transmitter", dependency.getJavaSourceTo().getName());
}
Aggregations