@Before
 public void prepare() {
   Mockito.when(systemStatus.isNexusStarted()).thenReturn(true);
   Mockito.when(applicationStatusSource.getSystemStatus()).thenReturn(systemStatus);
   Mockito.when(mavenProxyRepository.getId()).thenReturn("central");
   Mockito.when(mavenProxyRepository.getName()).thenReturn("Central Repository");
 }
 protected void upgradeNexusVersion() throws IOException {
   final String currentVersion =
       checkNotNull(applicationStatusSource.getSystemStatus().getVersion());
   final String previousVersion = getConfiguration().getNexusVersion();
   if (currentVersion.equals(previousVersion)) {
     setInstanceUpgraded(false);
   } else {
     setInstanceUpgraded(true);
     getConfiguration().setNexusVersion(currentVersion);
     storeConfiguration();
   }
 }
  @Before
  public void setup() {
    this.underTest = new DefaultUserAgentBuilder(statusSource, contributors);

    when(statusSource.getSystemStatus()).thenReturn(status);
    when(status.getVersion()).thenReturn("2.1-FAKE");
    when(status.getEditionShort()).thenReturn("FAKENEXUS");

    when(ctx.getRemoteConnectionSettings()).thenReturn(settings);
    when(settings.getUserAgentCustomizationString()).thenReturn("SETTINGS_CUSTOMIZATION");

    when(repository.getRemoteStorage()).thenReturn(storage);
    when(storage.getProviderId()).thenReturn("RRS_PROVIDER");
    when(storage.getVersion()).thenReturn("RRS_VERSION");

    when(contributor.getUserAgent(ctx, repository)).thenReturn("PLUGIN_CONTRIBUTED");
  }
 protected boolean isRepositoryHandled(final Repository repository) {
   return applicationStatusSource.getSystemStatus().isNexusStarted()
       && repository != null
       && repository.getRepositoryKind().isFacetAvailable(MavenProxyRepository.class);
 }