@Test
  public void getRepositoryNoAccessTest() throws Exception {
    // use test user
    TestContainer.getInstance().getTestContext().setUsername(TEST_USER_NAME);
    TestContainer.getInstance().getTestContext().setPassword(TEST_USER_PASSWORD);

    RequestFacade.doGet(
        "service/local/repositories/" + getTestRepositoryId(), respondsWithStatusCode(403));
  }
  @Test
  public void getGroupNoAccessTest() throws Exception {
    // use test user
    TestContainer.getInstance().getTestContext().setUsername(TEST_USER_NAME);
    TestContainer.getInstance().getTestContext().setPassword(TEST_USER_PASSWORD);

    String repoId = "public";
    RequestFacade.doGet(GroupMessageUtil.SERVICE_PART + "/" + repoId, respondsWithStatusCode(403));
  }
  @Test
  public void overloadResultsin503Code() throws Exception {
    final Thread stalledRequest =
        new Thread() {
          @Override
          public void run() {
            try {
              // this will wait as long timeout occurs, and will get 404 eventually
              doGet(
                  "content/repositories/"
                      + getTestRepositoryId()
                      + "/nexus5291/artifact/1.0/artifact-1.0.jar",
                  NexusRequestMatchers.respondsWithStatus(Status.CLIENT_ERROR_NOT_FOUND));
            } catch (Exception e) {
              // barf, this will fail but we do not care
              // it will either timeout on client side (IT), or on nexus side (connection timeout)
              // and will result in 404.
            }
          }
        };
    stalledRequest.start();
    try {
      Thread.sleep(200);

      // expect 503 (as pool is depleted) when going directly to proxy repository
      // watch for different path, to avoid UID locking that would serialize the above "stalled"
      // request and this
      doGet(
          "content/repositories/"
              + getTestRepositoryId()
              + "/nexus5291/artifact/1.1/artifact-1.1.jar",
          NexusRequestMatchers.respondsWithStatus(Status.SERVER_ERROR_SERVICE_UNAVAILABLE));

      // expect 404 (as pool is depleted) when going over a group, as group aggregates (hosted +
      // proxies)
      // watch for different path, to avoid UID locking that would serialize the above "stalled"
      // request and this
      doGet(
          "content/groups/public/nexus5291/artifact/1.1/artifact-1.1.jar",
          NexusRequestMatchers.respondsWithStatus(Status.CLIENT_ERROR_NOT_FOUND));
    } finally {
      stalledRequest.join();
    }
  }