StackModule extends BaseModule<StackModule, StackInfo> implements Validable { @Override public StackInfo getModuleInfo() { return stackInfo; } StackModule(StackDirectory stackDirectory, StackContext stackContext); Map<String, ServiceModule> getServiceModules(); Map<String, ExtensionModule> getExtensionModules(); @Override void resolve(
      StackModule parentModule, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions); @Override StackInfo getModuleInfo(); @Override boolean isDeleted(); @Override String getId(); @Override void finalizeModule(); StackDirectory getStackDirectory(); @Override boolean isValid(); @Override void setValid(boolean valid); @Override void addError(String error); @Override Collection<String> getErrors(); @Override void addErrors(Collection<String> errors);  }
@Test public void stackServiceReposAreRead() throws Exception { StackModule sm = createStackModule("FooBar", "2.4", Optional.of(Lists.newArrayList(repoInfo("foo", "1.0.1", "http: Lists.newArrayList(repoInfo("bar", "2.0.1", "http: Set<String> repoIds = getIds(sm.getModuleInfo().getRepositories()); assertEquals(ImmutableSet.of("foo:1.0.1", "bar:2.0.1"), repoIds); }
@Test public void duplicateStackServiceReposAreDiscarded() throws Exception { StackModule sm = createStackModule("FooBar", "2.4", Optional.of(Lists.newArrayList(repoInfo("StackRepoA", "1.1.1", "http: repoInfo("StackRepoB", "2.2.2", "http: Lists.newArrayList(repoInfo("serviceRepoA", "1.0.0", "http: Lists.newArrayList(repoInfo("serviceRepoA", "1.0.0", "http: Lists.newArrayList(repoInfo("serviceRepoB", "1.2.1", "http: Lists.newArrayList(repoInfo("serviceRepoB", "1.2.3", "http: Lists.newArrayList(repoInfo("StackRepoA", "2.0.0", "http: repoInfo("ShouldBeJustAWarning1", "3.1.1", "http: repoInfo("ShouldBeJustAWarning2", "1.0.0", "http: List<RepositoryInfo> repos = sm.getModuleInfo().getRepositories(); Set<String> repoIds = getIds(repos); assertEquals("Unexpected number of repos. Each repo should be added only once", repoIds.size(), repos.size()); assertEquals("Unexpected repositories", ImmutableSet.of("StackRepoA:1.1.1", "StackRepoB:2.2.2", "serviceRepoA:1.0.0", "ShouldBeJustAWarning1:3.1.1", "ShouldBeJustAWarning2:1.0.0"), repoIds); }
@Test public void serviceReposAreProcessedEvenIfNoStackRepo() throws Exception { StackModule sm = createStackModule("FooBar", "2.4", Optional.<List<RepositoryInfo>>absent(), Lists.newArrayList(repoInfo("bar", "2.0.1", "http: Set<String> repoIds = getIds(sm.getModuleInfo().getRepositories()); assertEquals(ImmutableSet.of("bar:2.0.1"), repoIds); }
@Test public void duplicateStackServiceReposAreCheckedPerOs() throws Exception { StackModule sm = createStackModule("FooBar", "2.4", Optional.<List<RepositoryInfo>>absent(), Lists.newArrayList(repoInfo("bar", "2.0.1", "http: Lists.newArrayList(repoInfo("bar", "2.0.1", "http: Multiset<String> repoIds = getIdsMultiple(sm.getModuleInfo().getRepositories()); assertEquals("Repo should be occur exactly twice, once for each os type.", ImmutableMultiset.of("bar:2.0.1", "bar:2.0.1"), repoIds); }
@Test public void removedServicesInitialValue () throws Exception { StackModule sm = createStackModule("FooBar", "2.4", Optional.<List<RepositoryInfo>>absent(), Lists.newArrayList(repoInfo("bar", "2.0.1", "http: Lists.newArrayList(repoInfo("bar", "2.0.1", "http: List<String> removedServices = sm.getModuleInfo().getRemovedServices(); assertEquals(removedServices.size(), 0); }