コード例 #1
0
 @Test
 public void testParse() {
   NotificationResponse nr = new NotificationResponse(responseString);
   assertEquals(IResponse.OK, nr.getStatus());
   assertEquals("1234", nr.getNotificationID());
   assertTrue(nr.isNotification());
 }
コード例 #2
0
  @Test
  public void objectPersistedRegistration()
      throws IOException, SignatureException, URISyntaxException, XmlProcessingException {
    final String bucketName = "test_bucket";

    try {
      client.putBucket(new PutBucketRequest(bucketName));
      final Ds3ClientHelpers.Job job = Util.getLoadJob(client, bucketName, Util.RESOURCE_BASE_NAME);

      final NotificationResponse response =
          client.createObjectPersistedNotification(
              new CreateObjectPersistedNotificationRequest("192.168.56.101/other", job.getJobId()));
      assertThat(response, is(notNullValue()));
      assertThat(response.getRegistration(), is(notNullValue()));

      job.transfer(new ResourceObjectPutter(Util.RESOURCE_BASE_NAME));

      final UUID registrationId = response.getRegistration().getId();

      final NotificationResponse getResponse =
          client.getObjectPersistedNotification(
              new GetObjectPersistedNotificationRequest(registrationId));
      assertThat(getResponse, is(notNullValue()));
      assertThat(getResponse.getRegistration(), is(notNullValue()));
      assertThat(getResponse.getRegistration().getId(), is(notNullValue()));

      assertThat(
          client.deleteObjectPersistedNotification(
              new DeleteObjectPersistedNotificationRequest(registrationId)),
          is(notNullValue()));
    } finally {
      Util.deleteAllContents(client, bucketName);
    }
  }
コード例 #3
0
  @Test
  public void jobCreateRegistration() throws IOException, SignatureException {
    final NotificationResponse response =
        client.createJobCreatedNotification(
            new CreateJobCreatedNotificationRequest("192.168.56.101/other"));
    assertThat(response, is(notNullValue()));
    assertThat(response.getRegistration(), is(notNullValue()));

    final UUID registrationId = response.getRegistration().getId();

    final NotificationResponse getResponse =
        client.getJobCreatedNotification(new GetJobCreatedNotificationRequest(registrationId));
    assertThat(getResponse, is(notNullValue()));
    assertThat(getResponse.getRegistration(), is(notNullValue()));
    assertThat(getResponse.getRegistration().getId(), is(notNullValue()));

    assertThat(
        client.deleteJobCreatedNotification(
            new DeleteJobCreatedNotificationRequest(registrationId)),
        is(notNullValue()));
  }