コード例 #1
0
  @Test
  public void changeProxyStatusTest() throws Exception {
    // change the name of the test repo
    RepositoryMessageUtil repoUtil =
        new RepositoryMessageUtil(
            this.getXMLXStream(), MediaType.APPLICATION_XML, getRepositoryTypeRegistry());

    RepositoryStatusResource repo = repoUtil.getStatus("release-proxy-repo-1");
    repo.setProxyMode(ProxyMode.BLOCKED_AUTO.name());
    repoUtil.updateStatus(repo);

    TaskScheduleUtil.waitForAllTasksToStop();

    SyndFeed systemFeed = FeedUtil.getFeed("systemChanges");
    this.validateLinksInFeeds(systemFeed);

    SyndFeed systemStatusFeed = FeedUtil.getFeed("systemRepositoryStatusChanges");
    this.validateLinksInFeeds(systemStatusFeed);

    Assert.assertTrue(
        findFeedEntry(
            systemFeed, "Repository proxy mode change", new String[] {"release-proxy-repo-1"}));

    Assert.assertTrue(
        findFeedEntry(
            systemStatusFeed,
            "Repository proxy mode change",
            new String[] {"release-proxy-repo-1"}));
  }
コード例 #2
0
  /**
   * Verify that a remote answering with '401' will still be auto-blocked.
   *
   * <p>This test will change repo status to auto blocked.
   */
  @Test(dependsOnMethods = "testNoAutoblockOn403")
  public void testAutoblockOn401() throws Exception {
    startErrorServer(401);

    try {
      downloadArtifact(GavUtil.newGav("g", "a", "401"), "target");
    } catch (IOException e) {
      // expected, remote will answer with 401
    }

    RepositoryStatusResource status = getStatus();

    assertThat(ProxyMode.valueOf(status.getProxyMode()), is(ProxyMode.BLOCKED_AUTO));
  }