@Test public void groupAutoCreatedWithDeployPointAndTwoRepos() throws Exception { simpleCatalog(); final String testUrl = http.formatUrl("target", "test"); http.get(testUrl, 404); http.expect(testUrl, 200); http.expect(http.formatUrl("target", "first"), 200); http.expect(http.formatUrl("target", "second"), 200); // targetResponder.approveTargets( "test" ); http.get(testUrl, 200); catalog.setEnabled(false); assertThat(proxyManager.getGroup("test"), nullValue()); catalog.setEnabled(true); final Group group = proxyManager.getGroup("test"); assertThat(group, notNullValue()); assertThat(group.getName(), equalTo("test")); final List<StoreKey> constituents = group.getConstituents(); logger.info("Group constituents: {}", constituents); assertThat(constituents, notNullValue()); assertThat(constituents.size(), equalTo(4)); int idx = 0; StoreKey key = constituents.get(idx); assertThat(key.getType(), equalTo(StoreType.hosted)); assertThat(key.getName(), equalTo("test")); idx++; key = constituents.get(idx); assertThat(key.getType(), equalTo(StoreType.remote)); assertThat(key.getName(), equalTo("test")); idx++; key = constituents.get(idx); assertThat(key.getType(), equalTo(StoreType.remote)); assertThat(key.getName(), equalTo("first")); idx++; key = constituents.get(idx); assertThat(key.getType(), equalTo(StoreType.remote)); assertThat(key.getName(), equalTo("second")); }
@Test public void groupNotAutoCreatedWhenTargetIsInvalid() throws Exception { simpleCatalog(); final String testUrl = http.formatUrl("target", "test"); http.get(testUrl, 404); catalog.setEnabled(false); assertThat(proxyManager.getGroup("test"), nullValue()); catalog.setEnabled(true); final Group group = proxyManager.getGroup("test"); assertThat(group, nullValue()); }