public void flippingLocalStatusUpdatesWL()
throws Exception
{
// at this point, NexusStartedEvent was fired, and hence, WL's should be inited
final Manager wm = lookup(Manager.class);
final MavenProxyRepository proxy1 =
getRepositoryRegistry().getRepositoryWithFacet(PROXY1_REPO_ID, MavenProxyRepository.class);
assertThat(proxy1.getLocalStatus(), equalTo(LocalStatus.OUT_OF_SERVICE));
waitForRoutingBackgroundUpdates();
// let's check states
{
// proxy1
final RoutingStatus proxy1status = wm.getStatusFor(proxy1);
// this repo is Out of Service
assertThat(proxy1status.getPublishingStatus().getStatus(), equalTo(PStatus.NOT_PUBLISHED));
assertThat(proxy1status.getDiscoveryStatus().getStatus(), equalTo(DStatus.ENABLED_NOT_POSSIBLE));
assertThat(proxy1status.getDiscoveryStatus().getLastDiscoveryStrategy(), is("none"));
// Remark: the combination of those three above simply means "discovery never tried against it"
// yet.
}
{
// group
final RoutingStatus groupStatus =
wm.getStatusFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP_REPO_ID,
MavenGroupRepository.class));
// not all members have WL, unpublished
assertThat(groupStatus.getPublishingStatus().getStatus(), equalTo(PStatus.PUBLISHED));
assertThat(groupStatus.getDiscoveryStatus().getStatus(), equalTo(DStatus.NOT_A_PROXY));
}
{
// let's flip proxy1 now
proxy1.setLocalStatus(LocalStatus.IN_SERVICE);
getApplicationConfiguration().saveConfiguration();
wairForAsyncEventsToCalmDown();
waitForRoutingBackgroundUpdates();
}
// let's check states again, now with enabled proxy1
{
// proxy1
final RoutingStatus proxy1status =
wm.getStatusFor(getRepositoryRegistry().getRepositoryWithFacet(PROXY1_REPO_ID,
MavenProxyRepository.class));
// this repo is Out of Service
assertThat(proxy1status.getPublishingStatus().getStatus(), equalTo(PStatus.PUBLISHED));
assertThat(proxy1status.getDiscoveryStatus().getStatus(), equalTo(DStatus.SUCCESSFUL));
assertThat(proxy1status.getDiscoveryStatus().getLastDiscoveryStrategy(), is(RemotePrefixFileStrategy.ID));
}
{
// group
final RoutingStatus groupStatus =
wm.getStatusFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP_REPO_ID,
MavenGroupRepository.class));
// not all members have WL, unpublisged
assertThat(groupStatus.getPublishingStatus().getStatus(), equalTo(PStatus.PUBLISHED));
assertThat(groupStatus.getDiscoveryStatus().getStatus(), equalTo(DStatus.NOT_A_PROXY));
}
{
// let's flip proxy1 now back
proxy1.setLocalStatus(LocalStatus.OUT_OF_SERVICE);
getApplicationConfiguration().saveConfiguration();
wairForAsyncEventsToCalmDown();
waitForRoutingBackgroundUpdates();
}