Search in sources :

Example 1 with Struct

use of com.yahoo.rdl.Struct in project athenz by yahoo.

the class ZMSClientTest method setupRespHdrsStruct.

Struct setupRespHdrsStruct() {
    Struct respHdrs = new Struct();
    Array values = new Array();
    values.add("Value1A");
    values.add("Value1B");
    respHdrs.put("tag1", values);
    values = new Array();
    values.add("Value2A");
    values.add("Value2B");
    respHdrs.put("tag2", values);
    return respHdrs;
}
Also used : Array(com.yahoo.rdl.Array) Struct(com.yahoo.rdl.Struct)

Example 2 with Struct

use of com.yahoo.rdl.Struct in project athenz by yahoo.

the class ZMSFileChangeLogStoreTest method deleteExistent.

@Test
public void deleteExistent() {
    ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
    Struct data = new Struct();
    data.put("key", "val1");
    fstore.put("test1", JSON.bytes(data));
    fstore.delete("test1");
    Struct st = fstore.get("test1", Struct.class);
    assertNull(st);
}
Also used : ZMSFileChangeLogStore(com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore) Struct(com.yahoo.rdl.Struct) Test(org.testng.annotations.Test)

Example 3 with Struct

use of com.yahoo.rdl.Struct in project athenz by yahoo.

the class ZMSFileChangeLogStoreTest method scanSingle.

@Test
public void scanSingle() {
    ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
    Struct data = new Struct();
    data.put("key", "val1");
    fstore.put("test1", JSON.bytes(data));
    List<String> ls = fstore.scan();
    assertEquals(ls.size(), 1);
    assertTrue(ls.contains("test1"));
}
Also used : ZMSFileChangeLogStore(com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore) Struct(com.yahoo.rdl.Struct) Test(org.testng.annotations.Test)

Example 4 with Struct

use of com.yahoo.rdl.Struct in project athenz by yahoo.

the class ZMSFileChangeLogStoreTest method getExistent.

@Test
public void getExistent() {
    ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
    Struct data = new Struct();
    data.put("key", "val1");
    fstore.put("test1", JSON.bytes(data));
    Struct st = fstore.get("test1", Struct.class);
    assertNotNull(st);
    assertEquals(st.get("key"), "val1");
}
Also used : ZMSFileChangeLogStore(com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore) Struct(com.yahoo.rdl.Struct) Test(org.testng.annotations.Test)

Example 5 with Struct

use of com.yahoo.rdl.Struct in project athenz by yahoo.

the class ZMSFileChangeLogStoreTest method scanDelete.

@Test
public void scanDelete() {
    ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
    Struct data = new Struct();
    data.put("key", "val1");
    fstore.put("test1", JSON.bytes(data));
    data = new Struct();
    data.put("key", "val1");
    fstore.put("test2", JSON.bytes(data));
    data = new Struct();
    data.put("key", "val1");
    fstore.put("test3", JSON.bytes(data));
    fstore.delete("test2");
    List<String> ls = fstore.scan();
    assertEquals(ls.size(), 2);
    assertTrue(ls.contains("test1"));
    assertTrue(ls.contains("test3"));
}
Also used : ZMSFileChangeLogStore(com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore) Struct(com.yahoo.rdl.Struct) Test(org.testng.annotations.Test)

Aggregations

Struct (com.yahoo.rdl.Struct)61 Test (org.testng.annotations.Test)30 Array (com.yahoo.rdl.Array)10 ZMSFileChangeLogStore (com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore)7 AuthzDetailsEntity (com.yahoo.athenz.common.config.AuthzDetailsEntity)5 Path (java.nio.file.Path)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Assertion (com.yahoo.athenz.zms.Assertion)3 Policy (com.yahoo.athenz.zms.Policy)3 ZpeMatch (com.yahoo.athenz.zpe.match.ZpeMatch)3 File (java.io.File)3 AuthzDetailsField (com.yahoo.athenz.common.config.AuthzDetailsField)2 FilesHelper (com.yahoo.athenz.common.server.util.FilesHelper)2 PublicKeyEntry (com.yahoo.athenz.zms.PublicKeyEntry)2 ServiceIdentity (com.yahoo.athenz.zms.ServiceIdentity)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 BasicSessionCredentials (com.amazonaws.auth.BasicSessionCredentials)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 AthenzConfig (com.yahoo.athenz.common.config.AthenzConfig)1