Examples of MavenProxyRepository


Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

  public void outOfServiceRepositoryDoesNotAffectWLInitialization()
      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

    {
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

  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();
    }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

        discoveryPayload.setDiscoveryEnabled(false);
        discoveryPayload.setDiscoveryLastStrategy("");
        discoveryPayload.setDiscoveryLastMessage("");
      }
      else {
        final MavenProxyRepository mavenProxyRepository =
            getMavenRepository(request, MavenProxyRepository.class);
        final DiscoveryConfig config = getManager().getRemoteDiscoveryConfig(mavenProxyRepository);
        discoveryPayload.setDiscoveryEnabled(true);
        discoveryPayload.setDiscoveryIntervalHours(
            Ints.saturatedCast(TimeUnit.MILLISECONDS.toHours(config.getDiscoveryInterval())));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

  public void delete(final Context context, final Request request, final Response response)
      throws ResourceException
  {
    try {
      // try with proxy
      final MavenProxyRepository mavenRepository = getMavenRepository(request, MavenProxyRepository.class);
      getManager().updatePrefixFile(mavenRepository);
      // we spawned a background job, so say "okay, we accepted this, but come back later for results"
      response.setStatus(Status.SUCCESS_ACCEPTED);
    }
    catch (IllegalStateException e) {
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

  @GET
  public RoutingConfigMessageWrapper get(final Context context, final Request request, final Response response,
                                         final Variant variant)
      throws ResourceException
  {
    final MavenProxyRepository mavenProxyRepository = getMavenRepository(request, MavenProxyRepository.class);
    final DiscoveryConfig config = getManager().getRemoteDiscoveryConfig(mavenProxyRepository);
    final RoutingConfigMessage payload = new RoutingConfigMessage();
    payload.setDiscoveryEnabled(config.isEnabled());
    payload.setDiscoveryIntervalHours(Ints.saturatedCast(TimeUnit.MILLISECONDS.toHours(config.getDiscoveryInterval())));
    final RoutingConfigMessageWrapper responseNessage = new RoutingConfigMessageWrapper();
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

  public RoutingConfigMessageWrapper put(final Context context, final Request request, final Response response,
                                         final Object payload)
      throws ResourceException
  {
    try {
      final MavenProxyRepository mavenProxyRepository = getMavenRepository(request, MavenProxyRepository.class);
      final DiscoveryConfig oldConfig = getManager().getRemoteDiscoveryConfig(mavenProxyRepository);
      final RoutingConfigMessageWrapper wrapper = RoutingConfigMessageWrapper.class.cast(payload);
      // NEXUS-5567 related and some other cases (like scripting and sending partial message to enable/disable only).
      // The error range of the interval value is (>0) since it's defined in hours, and 0 or negative value would be
      // undefined. But still, due to unmarshalling, the field in the bean would be 0 (or is -1 like in NEXUS-5567).
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

          && repository.getRepositoryKind().isFacetAvailable(MavenRepository.class) && repository.isIndexable()) {
        indexedRepositories++;
      }
      // leave only one to download remote indexes explicitly
      if (repository.getRepositoryKind().isFacetAvailable(MavenProxyRepository.class)) {
        final MavenProxyRepository mavenProxyRepository = repository.adaptToFacet(MavenProxyRepository.class);
        if (repository.getId().equals(central.getId())) {
          mavenProxyRepository.setDownloadRemoteIndexes(true);
          failingRepository = mavenProxyRepository;
          indexedProxyRepositories++;
        }
        else {
          mavenProxyRepository.setDownloadRemoteIndexes(false);
        }
        ((M2Repository)mavenProxyRepository).commitChanges();
      }
    }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

  @Test
  public void testDuplicateAddRepositoryRequest()
      throws Exception
  {
    MavenProxyRepository repo = central;

    IndexingContext repoCtx = indexerManager.getRepositoryIndexContext(repo);

    Assert.assertNotNull(repoCtx);
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

  }

  protected void makeCentralPointTo(String repoId)
      throws Exception
  {
    MavenProxyRepository central =
        repositoryRegistry.getRepositoryWithFacet("central", MavenProxyRepository.class);

    // redirect it to our "sppof" jetty (see ReindexTest.xml in src/test/resources....
    central.setRemoteUrl(serverResource.getServerProvider().getUrl() + "/" + repoId + "/");

    // make the central download the remote indexes is found
    central.setDownloadRemoteIndexes(true);

    nexusConfiguration().saveConfiguration();

    waitForTasksToStop();
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.MavenProxyRepository

    templateConf.setId("test");
    templateConf.setName("Test");
    final CRemoteStorage remoteStorageConf = new CRemoteStorage();
    remoteStorageConf.setUrl("http://localhost:" + server.getPort());
    template.getCoreConfiguration().getConfiguration(true).setRemoteStorage(remoteStorageConf);
    final MavenProxyRepository mavenProxyRepository = (MavenProxyRepository) template.create();

    return mavenProxyRepository;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.