Exemplo n.º 1
0
  @Test
  public void testGetObjectId() throws Exception {
    final String id = "12345678901234567890123456789012345678900000";

    when(mockHttpResponse.getStatusLine()).thenReturn(mock200);
    when(mockHttpResponse.getFirstHeader("location"))
        .thenReturn(new BasicHeader("location", "/rest/objects/" + id));

    AtmosResponse response = new AtmosResponse(mockHttpResponse);
    assertEquals(id, response.getObjectId().toString());
    verify(mockHttpResponse, times(1)).getFirstHeader("location");
  }
Exemplo n.º 2
0
  @Test
  public void testGetMetaDataListableOnly() throws Exception {

    when(mockHttpResponse.getStatusLine()).thenReturn(mock200);
    when(mockHttpResponse.getFirstHeader("x-emc-listable-meta"))
        .thenReturn(new BasicHeader("x-emc-listable-meta", "name1=value1,name2=value2"));

    AtmosResponse response = new AtmosResponse(mockHttpResponse);
    Collection<Metadata> metadata = response.getMetadata();

    assertEquals(2, metadata.size());
    String[] names = {"name1", "name2"};
    String[] values = {"value1", "value2"};

    int i = 0;
    for (Metadata meta : metadata) {
      assertEquals(names[i], meta.getName());
      assertEquals(values[i], meta.getValue());
      assertTrue(meta.isListable());
      i++;
    }
  }