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();
}
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();
}
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();
}
Aggregations