@Test
public void updateValidatioinTest()
throws IOException
{
RepositoryResource resource = new RepositoryResource();
resource.setId("updateValidatioinTest");
resource.setRepoType("proxy"); // [hosted, proxy, virtual]
resource.setName("Update Test Repo");
// resource.setRepoType( ? )
resource.setProvider("maven2");
// format is neglected by server from now on, provider is the new guy in the town
resource.setFormat("maven2"); // Repository Format, maven1, maven2, maven-site, eclipse-update-site
// resource.setAllowWrite( true );
// resource.setBrowseable( true );
// resource.setIndexable( true );
// resource.setNotFoundCacheTTL( 1440 );
resource.setRepoPolicy(RepositoryPolicy.RELEASE.name()); // [snapshot, release] Note: needs param name change
// resource.setRealmnId(?)
// resource.setOverrideLocalStorageUrl( "" ); //file://repos/internal
// resource.setDefaultLocalStorageUrl( "" ); //file://repos/internal
// resource.setDownloadRemoteIndexes( true );
resource.setChecksumPolicy("IGNORE"); // [ignore, warn, strictIfExists, strict]
RepositoryResourceRemoteStorage remote = new RepositoryResourceRemoteStorage();
remote.setRemoteStorageUrl("http://localhost:123/remote_resource_repo/");
resource.setRemoteStorage(remote);
// this also validates
resource = (RepositoryResource) this.messageUtil.createRepository(resource);
// invalid policy
resource.setRepoPolicy("junk");
this.sendAndExpectError(Method.PUT, resource);
resource.setRepoPolicy(RepositoryPolicy.RELEASE.name());
// invalid policy
resource.setRepoPolicy("junk");
Response response = this.messageUtil.sendMessage(Method.PUT, resource);
this.sendAndExpectError(Method.PUT, resource);
resource.setRepoPolicy(RepositoryPolicy.RELEASE.name());
// no policy
resource.setRepoPolicy(null);
this.sendAndExpectError(Method.PUT, resource);
resource.setRepoPolicy(RepositoryPolicy.RELEASE.name());
// invalid override local storage
resource.setOverrideLocalStorageUrl("foo.bar");
this.sendAndExpectError(Method.PUT, resource);
resource.setOverrideLocalStorageUrl(null);
// invalid checksum
resource.setChecksumPolicy("JUNK");
this.sendAndExpectError(Method.PUT, resource);
resource.setChecksumPolicy("IGNORE");
// no checksum
resource.setChecksumPolicy(null);
this.sendAndExpectError(Method.PUT, resource);
resource.setChecksumPolicy("IGNORE");
}