Exemplo n.º 1
0
  @Test
  public void run() throws Exception {
    final String repo1 = "repo1";
    final String path = "org/foo/bar/maven-metadata.xml";

    server.registerException(server.formatUrl(repo1, path), "upstream error");

    RemoteRepository remote1 = new RemoteRepository(repo1, server.formatUrl(repo1));
    remote1.setMetadata(Location.CONNECTION_TIMEOUT_SECONDS, Integer.toString(1));

    remote1 = client.stores().create(remote1, "adding remote", RemoteRepository.class);

    try {
      client.content().get(remote, repo1, path);
    } catch (final AproxClientException e) {
      assertThat(e.getStatusCode(), equalTo(HttpStatus.SC_BAD_GATEWAY));
    }
  }