Search in sources :

Example 1 with MockZMSFileChangeLogStore

use of com.yahoo.athenz.zts.store.MockZMSFileChangeLogStore in project athenz by yahoo.

the class ZTSImplTest method setup.

@BeforeMethod
public void setup() {
    // we want to make sure we start we clean dir structure
    ZTSTestUtils.deleteDirectory(new File(ZTS_DATA_STORE_PATH));
    String privKeyName = System.getProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY);
    File privKeyFile = new File(privKeyName);
    String privKey = Crypto.encodedFile(privKeyFile);
    privateKey = Crypto.loadPrivateKey(Crypto.ybase64DecodeString(privKey));
    System.setProperty(ZTSConsts.ZTS_PROP_CERTSIGN_BASE_URI, "https://localhost:443/certsign/v2");
    /* create our data store */
    roleTokenDefaultTimeout = 2400;
    System.setProperty(ZTSConsts.ZTS_PROP_ROLE_TOKEN_DEFAULT_TIMEOUT, Integer.toString(roleTokenDefaultTimeout));
    roleTokenMaxTimeout = 96000;
    System.setProperty(ZTSConsts.ZTS_PROP_ROLE_TOKEN_MAX_TIMEOUT, Integer.toString(roleTokenMaxTimeout));
    System.setProperty(ZTSConsts.ZTS_PROP_AUTHORIZED_PROXY_USERS, "user_domain.proxy-user1,user_domain.proxy-user2");
    ChangeLogStore structStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", privateKey, "0");
    cloudStore = new CloudStore();
    cloudStore.setHttpClient(null);
    System.setProperty(ZTSConsts.ZTS_PROP_CERT_ALLOWED_O_VALUES, "Athenz, Inc.|My Test Company|Athenz|Yahoo");
    System.setProperty(ZTSConsts.ZTS_PROP_NOAUTH_URI_LIST, "/zts/v1/schema,/zts/v1/status");
    System.setProperty(ZTSConsts.ZTS_PROP_SELF_SIGNER_PRIVATE_KEY_FNAME, "src/test/resources/unit_test_private_encrypted.key");
    System.setProperty(ZTSConsts.ZTS_PROP_SELF_SIGNER_PRIVATE_KEY_PASSWORD, "athenz");
    ZTSTestUtils.deleteDirectory(new File("/tmp/zts_server_cert_store"));
    System.setProperty(ZTSConsts.ZTS_PROP_CERT_FILE_STORE_PATH, "/tmp/zts_server_cert_store");
    System.setProperty(ZTSConsts.ZTS_PROP_VALIDATE_SERVICE_IDENTITY, "false");
    // enable ip validation for cert requests
    System.setProperty(ZTSConsts.ZTS_PROP_CERT_REQUEST_VERIFY_IP, "true");
    store = new DataStore(structStore, cloudStore, ztsMetric);
    zts = new ZTSImpl(cloudStore, store);
    ZTSImpl.serverHostName = "localhost";
    authorizer = new ZTSAuthorizer(store);
    // enable openid scope
    AccessTokenRequest.setSupportOpenIdScope(true);
}
Also used : ZMSFileChangeLogStore(com.yahoo.athenz.common.server.store.impl.ZMSFileChangeLogStore) ChangeLogStore(com.yahoo.athenz.common.server.store.ChangeLogStore) MockZMSFileChangeLogStore(com.yahoo.athenz.zts.store.MockZMSFileChangeLogStore) MockCloudStore(com.yahoo.athenz.zts.store.MockCloudStore) CloudStore(com.yahoo.athenz.zts.store.CloudStore) DataStore(com.yahoo.athenz.zts.store.DataStore) File(java.io.File) MockZMSFileChangeLogStore(com.yahoo.athenz.zts.store.MockZMSFileChangeLogStore) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with MockZMSFileChangeLogStore

use of com.yahoo.athenz.zts.store.MockZMSFileChangeLogStore in project athenz by yahoo.

the class InstanceProviderManagerTest method setup.

@BeforeMethod
public void setup() {
    // we want to make sure we start we clean dir structure
    ZTSTestUtils.deleteDirectory(new File(ZTS_DATA_STORE_PATH));
    File privKeyFile = new File(ZTS_PRIVATE_KEY);
    String privKey = Crypto.encodedFile(privKeyFile);
    privateKey = Crypto.loadPrivateKey(Crypto.ybase64DecodeString(privKey));
    ChangeLogStore structStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", privateKey, "0");
    System.setProperty(ZTSConsts.ZTS_PROP_PROVIDER_ENDPOINTS, ".athenz2.com,.athenz.com");
    store = new DataStore(structStore, null, ztsMetric);
}
Also used : ChangeLogStore(com.yahoo.athenz.common.server.store.ChangeLogStore) MockZMSFileChangeLogStore(com.yahoo.athenz.zts.store.MockZMSFileChangeLogStore) DataStore(com.yahoo.athenz.zts.store.DataStore) File(java.io.File) MockZMSFileChangeLogStore(com.yahoo.athenz.zts.store.MockZMSFileChangeLogStore) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

ChangeLogStore (com.yahoo.athenz.common.server.store.ChangeLogStore)2 DataStore (com.yahoo.athenz.zts.store.DataStore)2 MockZMSFileChangeLogStore (com.yahoo.athenz.zts.store.MockZMSFileChangeLogStore)2 File (java.io.File)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 ZMSFileChangeLogStore (com.yahoo.athenz.common.server.store.impl.ZMSFileChangeLogStore)1 CloudStore (com.yahoo.athenz.zts.store.CloudStore)1 MockCloudStore (com.yahoo.athenz.zts.store.MockCloudStore)1