Package org.sonatype.nexus.proxy.maven

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


  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

  @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

  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

          && 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

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

    IndexingContext repoCtx = indexerManager.getRepositoryIndexContext(repo);

    Assert.assertNotNull(repoCtx);
View Full Code Here

  }

  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

    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

        Server.withPort(remoteServerPort).serve("/.meta/prefixes.txt").withBehaviours(
            Behaviours.content(prefixFile1(true))).start();
    try {
      // setting the policy to STRICT, and note that server set up above publishes
      // the prefix file only, no checksums!
      final MavenProxyRepository mavenProxyRepository =
          getRepositoryRegistry().getRepositoryWithFacet(PROXY_REPO_ID, MavenProxyRepository.class);
      mavenProxyRepository.setChecksumPolicy(ChecksumPolicy.STRICT);
      getApplicationConfiguration().saveConfiguration();

      final RemoteStrategy subject = lookup(RemoteStrategy.class, RemotePrefixFileStrategy.ID);
      final StrategyResult result = subject.discover(mavenProxyRepository);
      assertThat(result.getMessage(),
View Full Code Here

  @Test
  public void smoke()
      throws Exception
  {
    final MavenProxyRepository mavenProxyRepository =
        getRepositoryRegistry().getRepositoryWithFacet(REPO_ID, MavenProxyRepository.class);

    PropfileDiscoveryStatusSource propsSource = new PropfileDiscoveryStatusSource(mavenProxyRepository);

    final DiscoveryStatus older =
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.maven.MavenProxyRepository

Copyright © 2018 www.massapicom. 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.