Package org.restlet.data

Examples of org.restlet.data.Status


        serviceURI = "service/local/data_incremental_index/repositories/" + repo + "/content";
      }
      else {
        serviceURI = "service/local/data_index/repositories/" + repo + "/content";
      }
      Status status = nexusRestClient.doDeleteForStatus(serviceURI, null);
      assertThat("Fail to update " + repo + " repository index " + status, status, isSuccess());
    }

    // let s w8 a few time for indexes
    taskNRC.waitForAllTasksToStop();
View Full Code Here


        + RoleMessageUtil.update(role).getDescription(), RoleMessageUtil.update(role), isSuccess());

    // try to login again
    testContext.setUsername(NEXUS504_USER);
    testContext.setPassword(TEST_USER_PASSWORD);
    Status status2 = UserCreationUtil.login();
    assertThat(status2, hasStatusCode(200));
  }
View Full Code Here

    RepositoryRouteMemberRepository memberRepo1 = new RepositoryRouteMemberRepository();
    memberRepo1.setId("nexus-test-harness-repo");
    resource.addRepository(memberRepo1);

    RoutesMessageUtil routesUtil = new RoutesMessageUtil(this.getXMLXStream(), MediaType.APPLICATION_XML);
    Status status = routesUtil.sendMessage(Method.POST, resource).getStatus();
    Assert.assertTrue("Unable to create a route " + status, status.isSuccess());

    List<RepositoryRouteListResource> routes = RoutesMessageUtil.getList();
    Assert.assertFalse("No itens to be tested", routes.isEmpty());

    for (RepositoryRouteListResource route : routes) {
View Full Code Here

    ScheduledServicePropertyResource prop = new ScheduledServicePropertyResource();
    prop.setKey("repositoryId");
    prop.setValue("all_repo");
    scheduledTask.addProperty(prop);

    Status status = TaskScheduleUtil.create(scheduledTask);
    Assert.assertTrue("Unable to create a task " + status, status.isSuccess());

    List<ScheduledServiceListResource> tasks = TaskScheduleUtil.getTasks();
    Assert.assertFalse("No itens to be tested", tasks.isEmpty());

    for (ScheduledServiceListResource task : tasks) {
View Full Code Here

  @Test
  public void changePassword()
      throws Exception
  {

    Status status = ChangePasswordUtils.changePassword("test-user", "newPassword");
    Assert.assertEquals("Status", status.getCode(), 204);

    // we need to change the password around for this
    status = ChangePasswordUtils.changePassword("test-user", TEST_USER_PASSWORD);
    Assert.assertEquals("Status", status.getCode(), 204);
  }
View Full Code Here

    TestContainer.getInstance().getTestContext().setUsername(TEST_USER_NAME);
    TestContainer.getInstance().getTestContext().setPassword(TEST_USER_PASSWORD);

    // Should be able to change my own password
    Status status = ChangePasswordUtils.changePassword("test-user", "newPassword");
    Assert.assertEquals("Status", status.getCode(), 204);

    // we need to change the password around for this
    TestContainer.getInstance().getTestContext().setPassword("newPassword");
    status = ChangePasswordUtils.changePassword("test-user", "newPassword");
    Assert.assertEquals("Status", status.getCode(), 204);

    status = ChangePasswordUtils.changePassword("test-user", TEST_USER_PASSWORD);
    Assert.assertEquals("Status", status.getCode(), 204);
    TestContainer.getInstance().getTestContext().setPassword(TEST_USER_PASSWORD);
  }
View Full Code Here

    TestContainer.getInstance().getTestContext().setUsername(TEST_USER_NAME);
    TestContainer.getInstance().getTestContext().setPassword(TEST_USER_PASSWORD);

    // NOT Should be able to forgot my own username
    Status status = ChangePasswordUtils.changePassword("test-user", "123admin");
    Assert.assertEquals(403, status.getCode());

    // NOT Should be able to forgot anyone username
    status = ChangePasswordUtils.changePassword("admin", "123admin");
    Assert.assertEquals(403, status.getCode());
  }
View Full Code Here

    context.setUsername(TEST_USER_NAME);
    context.setPassword(TEST_USER_PASSWORD);


    String newPassword = "123password";
    Status status = ChangePasswordUtils.changePassword(TEST_USER_NAME, TEST_USER_PASSWORD, newPassword);
    Assert.assertTrue("Status: ", status.isSuccess());

    // now change the password
    context.setPassword(newPassword);

    // reboot
View Full Code Here

    Assert.assertNotNull(password, "Didn't recieve a password.  Got the following messages:\n" + emailsContent);

    // login with generated password
    testContext.setUsername(USER_ID);
    testContext.setPassword(password);
    Status status = UserCreationUtil.login();
    Assert.assertTrue(status.isSuccess());

    // set new password
    String newPassword = "velo123";
    status = ChangePasswordUtils.changePassword(USER_ID, password, newPassword);
    Assert.assertTrue(status.isSuccess());

    // check if the user is 'active'
    testContext.useAdminForRequests();
    UserResource user = userUtil.getUser(USER_ID);
    Assert.assertEquals(user.getStatus(), "active");

    // login with new password
    testContext.setUsername(USER_ID);
    testContext.setPassword(newPassword);
    status = UserCreationUtil.login();
    Assert.assertTrue(status.isSuccess());
  }
View Full Code Here

    // disable anonymous access
    GlobalConfigurationResource settings = SettingsMessageUtil.getCurrentSettings();
    settings.setSecurityAnonymousAccessEnabled(false);
    SettingsMessageUtil.save(settings);

    Status responseStatus;

    // verify assumptions, we have the stuff deployed and present
    // try and verify authenticate /content GET access gives 200
    responseStatus =
        sendMessage(
            true,
            RequestFacade.toNexusURL("content/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.GET);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(200));
    // try and verify authenticated /service/local GET access gives 200
    responseStatus =
        sendMessage(
            true,
            RequestFacade.toNexusURL("service/local/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/content/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.GET);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(200));
    // try and verify anon /content GET access gives 401
    responseStatus =
        sendMessage(
            false,
            RequestFacade.toNexusURL("content/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.GET);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(401));
    // try and verify anon /service/local GET access gives 401
    responseStatus =
        sendMessage(
            false,
            RequestFacade.toNexusURL("service/local/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/content/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.GET);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(401));

    // now put repository into exposed=false mode
    setExposed(false);

    // READ access
    // try and verify authenticated /content GET access gives 404
    responseStatus =
        sendMessage(
            true,
            RequestFacade.toNexusURL("content/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.GET);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(404));
    // try and verify authenticated /service/local GET access gives 200
    responseStatus =
        sendMessage(
            true,
            RequestFacade.toNexusURL("service/local/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/content/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.GET);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(200));
    // try and verify anon /content GET access gives 401
    responseStatus =
        sendMessage(
            false,
            RequestFacade.toNexusURL("content/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.GET);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(401));
    // try and verify anon /service/local GET access gives 401
    responseStatus =
        sendMessage(
            false,
            RequestFacade.toNexusURL("service/local/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/content/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.GET);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(401));

    // DELETE access
    // try and verify authenticated /content DELETE access gives 404
    responseStatus =
        sendMessage(
            true,
            RequestFacade.toNexusURL("content/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.DELETE);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(404));
    // try and verify anon /content DELETE access gives 401
    responseStatus =
        sendMessage(
            false,
            RequestFacade.toNexusURL("content/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.DELETE);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(401));
    // try and verify anon /service/local DELETE access gives 401
    responseStatus =
        sendMessage(
            false,
            RequestFacade.toNexusURL("service/local/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/content/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.DELETE);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(401));
    // try and verify authenticated /service/local DELETE access gives 204
    responseStatus =
        sendMessage(
            true,
            RequestFacade.toNexusURL("service/local/repositories/" + REPO_TEST_HARNESS_RELEASE_REPO
                + "/content/nxcm3600/artifact/1.0.0/artifact-1.0.0.jar"), Method.DELETE);
    MatcherAssert.assertThat(responseStatus.getCode(), equalTo(204));
  }
View Full Code Here

TOP

Related Classes of org.restlet.data.Status

Copyright © 2018 www.massapicom. 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.