Search in sources :

Example 6 with SecureKeyCreateRequest

use of co.cask.cdap.proto.security.SecureKeyCreateRequest in project cdap by caskdata.

the class SecureStoreTest method testGet.

@Test
public void testGet() throws Exception {
    SecureKeyCreateRequest secureKeyCreateRequest = new SecureKeyCreateRequest(DESCRIPTION, DATA, PROPERTIES);
    HttpResponse response = doPut("/v3/namespaces/default/securekeys/" + KEY, GSON.toJson(secureKeyCreateRequest));
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());
    response = doGet("/v3/namespaces/default/securekeys/" + KEY);
    Assert.assertEquals(DATA, readResponse(response));
    // Get again
    response = doGet("/v3/namespaces/default/securekeys/" + KEY);
    Assert.assertEquals(DATA, readResponse(response));
    response = delete(KEY);
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());
}
Also used : SecureKeyCreateRequest(co.cask.cdap.proto.security.SecureKeyCreateRequest) HttpResponse(org.apache.http.HttpResponse) Test(org.junit.Test)

Aggregations

SecureKeyCreateRequest (co.cask.cdap.proto.security.SecureKeyCreateRequest)6 Test (org.junit.Test)5 SecureKeyId (co.cask.cdap.proto.id.SecureKeyId)3 HttpResponse (org.apache.http.HttpResponse)3 SecureStoreMetadata (co.cask.cdap.api.security.store.SecureStoreMetadata)1 BadRequestException (co.cask.cdap.common.BadRequestException)1 NamespaceNotFoundException (co.cask.cdap.common.NamespaceNotFoundException)1 SecureKeyAlreadyExistsException (co.cask.cdap.common.SecureKeyAlreadyExistsException)1 SecureKeyNotFoundException (co.cask.cdap.common.SecureKeyNotFoundException)1 AuditPolicy (co.cask.cdap.common.security.AuditPolicy)1 NamespaceId (co.cask.cdap.proto.id.NamespaceId)1 HashMap (java.util.HashMap)1 PUT (javax.ws.rs.PUT)1 Path (javax.ws.rs.Path)1