Examples of RepositoryResource


Examples of org.sonatype.nexus.rest.model.RepositoryResource

  @Test
  public void updateTest()
      throws IOException
  {

    RepositoryResource resource = new RepositoryResource();

    resource.setId("updateTestRepo");
    resource.setRepoType("hosted");
    resource.setName("Update Test Repo");
    resource.setProvider("p2");
    resource.setFormat("p2");
    resource.setRepoPolicy(RepositoryPolicy.MIXED.name());

    resource = (RepositoryResource) messageUtil.createRepository(resource);

    resource.setName("updated repo");

    messageUtil.updateRepo(resource);

  }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  @Test
  public void deleteTest()
      throws IOException
  {
    RepositoryResource resource = new RepositoryResource();

    resource.setId("deleteTestRepo");
    resource.setRepoType("hosted");
    resource.setName("Delete Test Repo");
    resource.setProvider("p2");
    resource.setFormat("p2");
    resource.setRepoPolicy(RepositoryPolicy.MIXED.name());

    resource = (RepositoryResource) messageUtil.createRepository(resource);

    final Response response = messageUtil.sendMessage(Method.DELETE, resource);

    assertThat(response.getStatus().isSuccess(), is(true));
    assertThat(getNexusConfigUtil().getRepo(resource.getId()), is(nullValue()));
  }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  public void testVirtualRepoWithSameId()
      throws IOException
  {

    // create a repository
    RepositoryResource repo = new RepositoryResource();

    repo.setId("testVirtualRepoWithSameId");
    repo.setRepoType("hosted"); // [hosted, proxy, virtual]
    repo.setName("testVirtualRepoWithSameId");
    repo.setProvider("maven2");
    // format is neglected by server from now on, provider is the new guy in the town
    repo.setFormat("maven2");
    repo.setRepoPolicy(RepositoryPolicy.RELEASE.name());
    repo = (RepositoryResource) this.messageUtil.createRepository(repo);

    // now create a virtual one, this should fail

    // create a repository
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  @Test
  public void createNoCheckSumTest()
      throws IOException
  {
    RepositoryResource resource = new RepositoryResource();

    resource.setId("createNoCheckSumTest");
    resource.setRepoType("proxy"); // [hosted, proxy, virtual]
    resource.setName("Create Test Repo");
    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]
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  @Test
  public void createNoRepoPolicyTest()
      throws IOException
  {
    RepositoryResource resource = new RepositoryResource();

    resource.setId("createNoRepoPolicyTest");
    resource.setRepoType("hosted"); // [hosted, proxy, virtual]
    resource.setName("Create Test Repo");
    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( "release" ); // [snapshot, release] Note: needs param name change
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  @Test
  public void createNoRepoTypeTest()
      throws IOException
  {

    RepositoryResource resource = new RepositoryResource();

    resource.setId("createNoRepoTypeTest");
    resource.setRepoType("hosted"); // [hosted, proxy, virtual]
    resource.setName("Create Test Repo");
    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]

    Response response = this.messageUtil.sendMessage(Method.POST, resource);
    String responseText = response.getEntity().getText();

    Assert.assertTrue("Expected RepoType to default: " + response.getStatus()
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  @Test
  public void noRepoTypeSerializationError()
      throws IOException
  {

    RepositoryResource resource = new RepositoryResource();

    resource.setId("createNoRepoTypeTest");
    // resource.setRepoType( "hosted" ); // [hosted, proxy, virtual]
    resource.setName("Create Test Repo");
    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]

    try {
      this.messageUtil.sendMessage(Method.POST, resource);
      Assert.fail("Expected to throw ConversionException");
    }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  @Test
  public void createNoIdTest()
      throws IOException
  {

    RepositoryResource resource = new RepositoryResource();

    resource.setId("");
    resource.setRepoType("hosted"); // [hosted, proxy, virtual]
    resource.setName("Create Test Repo");
    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]

    Response response = this.messageUtil.sendMessage(Method.POST, resource);
    String responseText = response.getEntity().getText();

    Assert.assertFalse("Repo should not have been created: " + response.getStatus() + "\n" + responseText,
        response.getStatus().isSuccess());
    Assert.assertTrue("Response text did not contain an error message. \nResponse Text:\n " + responseText,
        responseText.contains("<errors>"));

    // with null

    resource.setId(null);

    response = this.messageUtil.sendMessage(Method.POST, resource);
    responseText = response.getEntity().getText();

    Assert.assertFalse("Repo should not have been created: " + response.getStatus() + "\n" + responseText,
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  @Test
  public void createNoNameTest()
      throws IOException
  {

    RepositoryResource resource = new RepositoryResource();

    resource.setId("createNoNameTest");
    resource.setRepoType("hosted"); // [hosted, proxy, virtual]
    resource.setName("");
    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]

    Response response = this.messageUtil.sendMessage(Method.POST, resource);
    String responseText = response.getEntity().getText();

    Assert.assertTrue("Expected name to default." + responseText, response.getStatus().isSuccess());
    Assert.assertTrue("Expected name to default to id",
        this.messageUtil.getRepository("createNoNameTest").getName().equals("createNoNameTest"));

    // with null
    resource.setId("createNoNameTestnull");
    resource.setName(null);

    response = this.messageUtil.sendMessage(Method.POST, resource);
    responseText = response.getEntity().getText();

    Assert.assertTrue("Expected name to default." + responseText, response.getStatus().isSuccess());
View Full Code Here

Examples of org.sonatype.nexus.rest.model.RepositoryResource

  }

  @Test
  public void testRepositoryResource() {
    RepositoryResource repo = new RepositoryResource();

    repo.setId("createTestRepo");
    repo.setRepoType("hosted");
    repo.setName("Create Test Repo");
    repo.setFormat("maven2");
    repo.setWritePolicy(RepositoryWritePolicy.ALLOW_WRITE.name());
    repo.setBrowseable(true);
    repo.setIndexable(true);
    repo.setNotFoundCacheTTL(1440);
    repo.setRepoPolicy(RepositoryPolicy.RELEASE.name());
    repo.setDownloadRemoteIndexes(true);
    repo.setChecksumPolicy("IGNORE");
    repo.setContentResourceURI("contentResourceURI");
    repo.setDefaultLocalStorageUrl("defaultlocalstorage");
    repo.setExposed(true);
    repo.setOverrideLocalStorageUrl("overridelocalstorage");
    repo.setProvider("provider");
    repo.setProviderRole("providerRole");

    RepositoryResourceRemoteStorage remoteStorage = new RepositoryResourceRemoteStorage();
    remoteStorage.setRemoteStorageUrl("remoteStorageUrl");

    AuthenticationSettings auth = new AuthenticationSettings();
    auth.setNtlmDomain("ntlmdomain");
    auth.setNtlmHost("ntmlhost");
    auth.setPassword("password");
    auth.setUsername("username");

    remoteStorage.setAuthentication(auth);

    RemoteConnectionSettings connection = new RemoteConnectionSettings();
    connection.setConnectionTimeout(50);
    connection.setQueryString("querystring");
    connection.setRetrievalRetryCount(5);
    connection.setUserAgentString("useragent");

    remoteStorage.setConnectionSettings(connection);

    repo.setRemoteStorage(remoteStorage);

    RepositoryResourceResponse resourceResponse = new RepositoryResourceResponse();
    resourceResponse.setData(repo);

    this.marshalUnmarchalThenCompare(resourceResponse);
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.