protected void createRepository(final String repoId) throws IOException {
   RepositoryResource repo = new RepositoryResource();
   repo.setId(repoId);
   repo.setRepoType("hosted");
   repo.setName(repoId);
   repo.setProvider("maven2");
   repo.setFormat("maven2");
   repo.setRepoPolicy(RepositoryPolicy.RELEASE.name());
   repoUtil.createRepository(repo, false);
 }
  @Test
  public void hostedTestRelRepoAndDeployFile() throws IOException, Exception {
    // create a release repository
    String repoId = "tmp-releases";
    RepositoryResource repo = new RepositoryResource();
    repo.setProvider("ivy");
    repo.setFormat("maven2");
    repo.setRepoPolicy("release");
    repo.setChecksumPolicy("ignore");
    repo.setBrowseable(false);

    repo.setId(repoId);
    repo.setName(repoId);
    repo.setRepoType("hosted");
    repo.setWritePolicy(RepositoryWritePolicy.ALLOW_WRITE.name());
    repo.setDownloadRemoteIndexes(true);
    repo.setBrowseable(true);
    repo.setRepoPolicy(RepositoryPolicy.RELEASE.name());
    repo.setChecksumPolicy(ChecksumPolicy.IGNORE.name());

    repo.setIndexable(true); // being sure!!!
    repoUtil.createRepository(repo);

    // firstly assert that repository is there
    repo = (RepositoryResource) repoUtil.getRepository(repoId);
    Assert.assertTrue(repo.isIndexable());

    TaskScheduleUtil.waitForAllTasksToStop();

    // then deploy a release artifact
    Gav gav = GavUtil.newGav("ivyRemover", "auth-mod", "1.0");
    getDeployUtils().deployUsingGavWithRest(repoId, gav, getTestFile("simple-artifact.jar"));

    TaskScheduleUtil.waitForAllTasksToStop();
    getEventInspectorsUtil().waitForCalmPeriod();

    // secondly assert that the artifact is in the release repository
    List<NexusArtifact> result = getSearchMessageUtil().searchForGav(gav, repoId);
    Assert.assertEquals(
        result.size(), 1, "Results: \n" + XStreamFactory.getXmlXStream().toXML(result));

    // thirdly assert that there is at least alltogether one release artifact in the release
    // repository
    result = getSearchMessageUtil().searchFor(Collections.singletonMap("q", "ivyRemover"), repoId);
    Assert.assertEquals(
        result.size(), 1, "Results: \n" + XStreamFactory.getXmlXStream().toXML(result));
  }
  protected void createProxyRepository() throws Exception {
    RepositoryResource resource = new RepositoryResource();

    resource.setProvider("maven2");
    resource.setFormat("maven2");
    resource.setRepoPolicy("release");
    resource.setChecksumPolicy("ignore");
    resource.setBrowseable(false);
    resource.setIndexable(false);

    resource.setId(PROXY_REPO_ID);
    resource.setName(PROXY_REPO_ID);
    resource.setRepoType("proxy");
    resource.setWritePolicy(RepositoryWritePolicy.READ_ONLY.name());
    resource.setDownloadRemoteIndexes(true);
    RepositoryResourceRemoteStorage remoteStorage = new RepositoryResourceRemoteStorage();
    remoteStorage.setRemoteStorageUrl(
        getBaseNexusUrl() + "content/repositories/nexus-test-harness-repo/");
    resource.setRemoteStorage(remoteStorage);
    resource.setRepoPolicy(RepositoryPolicy.RELEASE.name());
    resource.setChecksumPolicy(ChecksumPolicy.IGNORE.name());
    new RepositoryMessageUtil(this, this.getJsonXStream(), MediaType.APPLICATION_JSON)
        .createRepository(resource);
  }