@Test public void testCreateArchitectureNestedComponentsLimitedDepth() { DependencyGraph dependencyGraph = DependencyGraphFactory.createGraph(); dependencyGraph.getOrCreateNodeByName("com.example.api.A"); dependencyGraph.getOrCreateNodeByName("com.example.api.B"); dependencyGraph.getOrCreateNodeByName("com.example.impl.AImpl"); dependencyGraph.getOrCreateNodeByName("com.example.impl.a.X"); dependencyGraph.getOrCreateNodeByName("com.example.impl.b.Y"); dependencyGraph.getOrCreateNodeByName("org.abc.api.d.z"); Architecture architecture = new DefaultPackageArchitectureFactory(dependencyGraph).createArchitecture(3); assertThat(architecture.getName(), is("Package-3")); assertThat(architecture.getAllComponents(), hasSize(7)); assertThat(getComponentNameList(architecture), is(Lists.newArrayList("com.example.impl", "com.example.api", "com.example", "org.abc.api", "org.abc", "com", "org"))); assertThat(architecture.getParentComponentName("com.example.api.A"), is("com.example.api")); assertThat(architecture.getParentComponentName("com.example.impl.AImpl"), is("com.example.impl")); assertThat(architecture.getParentComponentName("com.example.impl.AnotherImpl"), is("com.example.impl")); assertThat(architecture.getParentComponentName("com.example.impl.a.Something"), is("com.example.impl")); assertThat(architecture.getParentComponentName("com.example.impl.b.Something"), is("com.example.impl")); assertThat(architecture.getParentComponentName("com.example.impl.c.Something"), is("com.example.impl")); assertThat(architecture.getParentComponentName("com.example.SomethingElse"), is("com.example")); Component component = architecture.getApiNameToComponent().get("com.example.api"); assertThat(component.getName(), is("com.example.api")); ClassSet apiDef = component.getApi().get("com.example.api"); assertThat(apiDef.getPatterns(), hasSize(1)); assertThat(apiDef.getPatterns().get(0), is("com.example.api.**")); Component impl = architecture.getApiNameToComponent().get("com.example.impl"); assertThat(impl.getName(), is("com.example.impl")); ClassSet implDef = impl.getApi().get("com.example.impl"); assertThat(implDef.getPatterns(), hasSize(1)); assertThat(implDef.getPatterns().get(0), is("com.example.impl.**")); }
public Architecture createArchitecture() { return createArchitecture(0); }
DefaultPackageArchitectureFactory { public Architecture createArchitecture() { return createArchitecture(0); } }
DefaultPackageArchitectureFactory { public Architecture createArchitecture() { return createArchitecture(0); } DefaultPackageArchitectureFactory(DependencyGraph dependencyGraph); }
DefaultPackageArchitectureFactory { public Architecture createArchitecture() { return createArchitecture(0); } DefaultPackageArchitectureFactory(DependencyGraph dependencyGraph); void setArchitectureName(String architectureName); void setPathSeparator(String separator); Architecture createArchitecture(); Architecture createArchitecture(int maxLength); }
DefaultPackageArchitectureFactory { public Architecture createArchitecture() { return createArchitecture(0); } DefaultPackageArchitectureFactory(DependencyGraph dependencyGraph); void setArchitectureName(String architectureName); void setPathSeparator(String separator); Architecture createArchitecture(); Architecture createArchitecture(int maxLength);  }