Search in sources :

Example 6 with SSHRecordStore

use of com.yahoo.athenz.common.server.ssh.SSHRecordStore in project athenz by yahoo.

the class InstanceCertManagerTest method testExpiredSSHCertRecordCleanerException.

@Test
public void testExpiredSSHCertRecordCleanerException() {
    SSHRecordStore store = Mockito.mock(SSHRecordStore.class);
    when(store.getConnection()).thenThrow(new RuntimeException("invalid connection"));
    InstanceCertManager instanceManager = new InstanceCertManager(null, null, null, true, null);
    InstanceCertManager.ExpiredSSHCertRecordCleaner cleaner = instanceManager.new ExpiredSSHCertRecordCleaner(store, 100);
    // make sure no exceptions are thrown
    cleaner.run();
}
Also used : SSHRecordStore(com.yahoo.athenz.common.server.ssh.SSHRecordStore) Test(org.testng.annotations.Test)

Example 7 with SSHRecordStore

use of com.yahoo.athenz.common.server.ssh.SSHRecordStore in project athenz by yahoo.

the class InstanceCertManagerTest method testInsertSSHCertRecord.

@Test
public void testInsertSSHCertRecord() {
    InstanceCertManager instance = new InstanceCertManager(null, null, null, true, null);
    instance.setSSHSigner(null);
    SSHRecordStore certStore = Mockito.mock(SSHRecordStore.class);
    SSHRecordStoreConnection certConnection = Mockito.mock(SSHRecordStoreConnection.class);
    when(certStore.getConnection()).thenReturn(certConnection);
    when(certConnection.insertSSHCertRecord(ArgumentMatchers.isA(SSHCertRecord.class))).thenReturn(true);
    instance.setSSHStore(certStore);
    SSHCertRecord sshCertRecord = new SSHCertRecord();
    assertTrue(instance.updateSSHCertRecord(sshCertRecord, false));
    instance.shutdown();
}
Also used : SSHRecordStoreConnection(com.yahoo.athenz.common.server.ssh.SSHRecordStoreConnection) SSHRecordStore(com.yahoo.athenz.common.server.ssh.SSHRecordStore) SSHCertRecord(com.yahoo.athenz.common.server.ssh.SSHCertRecord) Test(org.testng.annotations.Test)

Example 8 with SSHRecordStore

use of com.yahoo.athenz.common.server.ssh.SSHRecordStore in project athenz by yahoo.

the class InstanceCertManagerTest method testExpiredSSHCertRecordCleaner.

@Test
public void testExpiredSSHCertRecordCleaner() {
    InstanceCertManager instanceManager = new InstanceCertManager(null, null, null, true, null);
    FileSSHRecordStoreFactory factory = new FileSSHRecordStoreFactory();
    SSHRecordStore store = factory.create(null);
    assertNotNull(store);
    InstanceCertManager.ExpiredSSHCertRecordCleaner cleaner = instanceManager.new ExpiredSSHCertRecordCleaner(store, 100);
    // make sure no exceptions are thrown
    cleaner.run();
}
Also used : FileSSHRecordStoreFactory(com.yahoo.athenz.zts.cert.impl.FileSSHRecordStoreFactory) SSHRecordStore(com.yahoo.athenz.common.server.ssh.SSHRecordStore) Test(org.testng.annotations.Test)

Aggregations

SSHRecordStore (com.yahoo.athenz.common.server.ssh.SSHRecordStore)8 Test (org.testng.annotations.Test)8 SSHCertRecord (com.yahoo.athenz.common.server.ssh.SSHCertRecord)3 SSHRecordStoreConnection (com.yahoo.athenz.common.server.ssh.SSHRecordStoreConnection)3 PrivateKeyStore (com.yahoo.athenz.auth.PrivateKeyStore)2 FileSSHRecordStoreFactory (com.yahoo.athenz.zts.cert.impl.FileSSHRecordStoreFactory)1