use of de.strullerbaumann.visualee.source.entity.JavaSource in project visualee by Thomas-S-B.
the class JavaSourceContainerTest method testAddJavaSourceDoublette.
@Test
public void testAddJavaSourceDoublette() {
JavaSourceContainer.getInstance().clear();
String name = "DataPoint";
JavaSource javaSource1 = JavaSourceFactory.getInstance().newJavaSource(name);
String sourceCode1 = "Test source code for JavaSource1 (listen to Brian Blade - Season of change";
javaSource1.setSourceCode(sourceCode1);
JavaSourceContainer.getInstance().add(javaSource1);
JavaSource javaSource2 = JavaSourceFactory.getInstance().newJavaSource(name);
javaSource2.setSourceCode("");
JavaSourceContainer.getInstance().add(javaSource2);
assertNotNull(JavaSourceContainer.getInstance().getJavaSourceByName(name));
assertEquals(1, JavaSourceContainer.getInstance().getJavaSources().size());
assertEquals(name, JavaSourceContainer.getInstance().getJavaSourceByName(name).getName());
assertEquals(sourceCode1, JavaSourceContainer.getInstance().getJavaSourceByName(name).getSourceCode());
}
use of de.strullerbaumann.visualee.source.entity.JavaSource in project visualee by Thomas-S-B.
the class GraphCreatorTest method testBuildJSONNodes.
@Test
public void testBuildJSONNodes() {
JavaSourceContainer.getInstance().clear();
int count = 10;
String namePrefix = "Testclass ";
for (int i = 0; i < count; i++) {
String name = namePrefix + i;
JavaSource javaSource = JavaSourceFactory.getInstance().newJavaSource(name);
JavaSourceContainer.getInstance().add(javaSource);
}
JsonArray nodes = GraphCreator.buildJSONNodes(null).build();
assertEquals(count, nodes.size());
}
use of de.strullerbaumann.visualee.source.entity.JavaSource in project visualee by Thomas-S-B.
the class GraphCreatorTest method testBuildJSONNode.
@Test
public void testBuildJSONNode() {
JavaSourceContainer.getInstance().clear();
DependencyContainer.getInstance().clear();
String name = "MyTestClass";
String sourcecode = "test source code - Matt Pavolka Group - Something People Can Use";
JavaSource javaSource = JavaSourceFactory.getInstance().newJavaSource("MyTestClass");
javaSource.setGroup(2);
javaSource.setPackagePath("de.test.test2");
javaSource.setSourceCode(sourcecode);
JsonObjectBuilder job = GraphCreator.buildJSONNode(javaSource);
JsonObject node = job.build();
assertEquals(name, node.getString("name"));
assertEquals(2, node.getInt("group"));
assertNotNull(node.getString("description"));
assertEquals(sourcecode, node.getString("sourcecode"));
}
use of de.strullerbaumann.visualee.source.entity.JavaSource in project visualee by Thomas-S-B.
the class DescriptionTest method testGenerateDescription.
/**
* Test of generateDescription method, of class Description.
*/
@Test
public void testGenerateDescription() {
JavaSource javaSource1 = JavaSourceFactory.getInstance().newJavaSource("TestJavaSource1");
JavaSource javaSource2 = JavaSourceFactory.getInstance().newJavaSource("TestJavaSource2");
JavaSource javaSource3 = JavaSourceFactory.getInstance().newJavaSource("TestJavaSource3");
String testPackage = "//my/test/package/path";
javaSource1.setPackagePath(testPackage);
Dependency dependency12 = new Dependency(DependencyType.INJECT, javaSource1, javaSource2);
Dependency dependency13 = new Dependency(DependencyType.OBSERVES, javaSource1, javaSource3);
List<Dependency> dependencies = new ArrayList<>();
dependencies.add(dependency12);
dependencies.add(dependency13);
DependencyContainer.getInstance().addAll(dependencies);
String actual = Description.generateDescription(javaSource1);
assertTrue(actual.indexOf(testPackage) > 0);
assertTrue(actual.indexOf(javaSource2.getName()) > 0);
assertTrue(actual.indexOf(javaSource3.getName()) > 0);
}
use of de.strullerbaumann.visualee.source.entity.JavaSource in project visualee by Thomas-S-B.
the class JavaSourceInspectorTest method testFindAndSetAttributesIgnoreCommentBlocks.
@Test
public void testFindAndSetAttributesIgnoreCommentBlocks() {
JavaSource javaSource;
String sourceCode;
javaSource = JavaSourceFactory.getInstance().newJavaSource("CocktailModel");
sourceCode = "@Model\n" + "public class CocktailModel implements Serializable\n" + "{\n" + " private List<Cocktail> nonAlcoholicCocktails;\n" + " private List<Cocktail> alcoholicCocktails;\n" + " /*\n" + " @Inject\n" + " private CocktailRepository cocktailRepository;\n" + " */\n" + " public List<Cocktail> getNonAlcoholicCocktails()\n" + "{\n" + "return this.nonAlcoholicCocktails;\n" + "}\n";
javaSource.setSourceCode(sourceCode);
JavaSourceContainer.getInstance().add(javaSource);
JavaSourceInspector.getInstance().examine();
assertEquals(0, DependencyContainer.getInstance().getDependencies(javaSource).size());
}
Aggregations