authSettings.setNtlmDomain("ntlmDomain-new");
authSettings.setNtlmHost("ntlmHost-new");
authSettings.setPassword("password-new");
authSettings.setUsername("username-new");
RemoteConnectionSettings connectionSettings = originalResource.getRemoteStorage().getConnectionSettings();
connectionSettings.setConnectionTimeout(1232);
connectionSettings.setQueryString("queryString-new");
connectionSettings.setRetrievalRetryCount(3212);
connectionSettings.setUserAgentString("userAgentString-new");
RepositoryPlexusResource plexusResource =
(RepositoryPlexusResource) this.lookup(PlexusResource.class, RepositoryPlexusResource.class.getName());
Request request = buildRequest();
Response response = new Response(request);
request.getAttributes().put(AbstractRepositoryPlexusResource.REPOSITORY_ID_KEY, originalResource.getId());
RepositoryResourceResponse repoRequest = new RepositoryResourceResponse();
repoRequest.setData(originalResource);
RepositoryResourceResponse repoResponse =
(RepositoryResourceResponse) plexusResource.put(null, request, response, repoRequest);
RepositoryProxyResource result = (RepositoryProxyResource) repoResponse.getData();
//
// now check
//
Assert.assertEquals("test-id", result.getId());
// Assert.assertEquals( true, result.isAllowWrite() );
Assert.assertEquals(2, result.getArtifactMaxAge());
Assert.assertEquals(true, result.isBrowseable());
Assert.assertEquals(ChecksumPolicy.STRICT.name(), result.getChecksumPolicy());
Assert.assertEquals(true, result.isDownloadRemoteIndexes());
Assert.assertEquals(true, result.isExposed());
Assert.assertEquals("maven2", result.getFormat());
Assert.assertEquals(false, result.isIndexable());
Assert.assertEquals(23, result.getMetadataMaxAge());
Assert.assertEquals(Integer.valueOf(234), result.getItemMaxAge());
Assert.assertEquals("test-name", result.getName());
Assert.assertEquals(11, result.getNotFoundCacheTTL());
Assert.assertEquals("maven2", result.getProvider());
Assert.assertEquals(RepositoryPolicy.RELEASE.name(), result.getRepoPolicy());
Assert.assertEquals("proxy", result.getRepoType());
Assert.assertEquals("http://foo-new.com/", result.getRemoteStorage().getRemoteStorageUrl());
AuthenticationSettings resultAuth = result.getRemoteStorage().getAuthentication();
Assert.assertEquals("ntlmDomain-new", resultAuth.getNtlmDomain());
Assert.assertEquals("ntlmHost-new", resultAuth.getNtlmHost());
// Assert.assertEquals( "passphrase-new", resultAuth.getPassphrase() );
Assert.assertEquals(AbstractNexusPlexusResource.PASSWORD_PLACE_HOLDER, resultAuth.getPassword());
// Assert.assertEquals( "privateKey-new", resultAuth.getPrivateKey() );
Assert.assertEquals("username-new", resultAuth.getUsername());
RemoteConnectionSettings resultCon = result.getRemoteStorage().getConnectionSettings();
Assert.assertEquals(1232, resultCon.getConnectionTimeout());
Assert.assertEquals("queryString-new", resultCon.getQueryString());
Assert.assertEquals(3212, resultCon.getRetrievalRetryCount());
Assert.assertEquals("userAgentString-new", resultCon.getUserAgentString());
// NEXUS-1994 override local storage should be null
Assert.assertNull(result.getOverrideLocalStorageUrl());
Assert.assertTrue(StringUtils.isNotEmpty(result.getDefaultLocalStorageUrl()));