"8uhr00296d2o3sfhqilj387krjmgjv3v-a.example.com:8080", wantsLocked, "other"));
}
@Test
public void testConfigurationChanged() throws Exception {
ContainerConfig config = new BasicContainerConfig();
config
.newTransaction()
.addContainer(makeContainer(ContainerConfig.DEFAULT_CONTAINER))
.addContainer(
makeContainer("container", LOCKED_DOMAIN_REQUIRED_KEY, true, LOCKED_DOMAIN_SUFFIX_KEY,
"-a.example.com:8080"))
.commit();
lockedDomainService = new HashLockedDomainService(config, true, ldgen);
assertTrue(lockedDomainService.isGadgetValidForHost(
"8uhr00296d2o3sfhqilj387krjmgjv3v-a.example.com:8080", wantsLocked, "container"));
assertFalse(lockedDomainService.isGadgetValidForHost(
"8uhr00296d2o3sfhqilj387krjmgjv3v-a.example.com:8080", wantsLocked, "other"));
config.newTransaction().addContainer(makeContainer(
"other", LOCKED_DOMAIN_REQUIRED_KEY, true, LOCKED_DOMAIN_SUFFIX_KEY, "-a.example.com:8080"))
.commit();
lockedDomainService.getConfigObserver().containersChanged(
config, ImmutableSet.of("other"), ImmutableSet.<String>of());
assertTrue(lockedDomainService.isGadgetValidForHost(
"8uhr00296d2o3sfhqilj387krjmgjv3v-a.example.com:8080", wantsLocked, "container"));
assertTrue(lockedDomainService.isGadgetValidForHost(
"8uhr00296d2o3sfhqilj387krjmgjv3v-a.example.com:8080", wantsLocked, "other"));
config.newTransaction().removeContainer("container").commit();
assertFalse(lockedDomainService.isGadgetValidForHost(
"8uhr00296d2o3sfhqilj387krjmgjv3v-a.example.com:8080", wantsLocked, "container"));
assertTrue(lockedDomainService.isGadgetValidForHost(
"8uhr00296d2o3sfhqilj387krjmgjv3v-a.example.com:8080", wantsLocked, "other"));
}