/** * Test that omitting the CRYPTOTOKENS property results in a configuration error. * * @throws Exception */ public void test01missingCryptoTokens() throws Exception { final HSMKeepAliveTimedService instance = new HSMKeepAliveTimedService() { @Override IWorkerSession getWorkerSession() { return null; } }; instance.init(DUMMY_WORKERID, new WorkerConfig(), null, null); final List<String> fatalErrors = instance.getStatus(Collections.<String>emptyList(), new ServicesImpl()).getFatalErrors(); assertTrue("Should contain error", fatalErrors.contains("Must specify CRYPTOTOKENS")); }
/** * Test that setting an empty value for CRYPTOTOKEN is not producing a config error. * * @throws Exception */ public void test02emptyCryptoTokens() throws Exception { final HSMKeepAliveTimedService instance = new HSMKeepAliveTimedService() { @Override IWorkerSession getWorkerSession() { return null; } }; final WorkerConfig config = new WorkerConfig(); config.setProperty(HSMKeepAliveTimedService.CRYPTOTOKENS, ""); instance.init(DUMMY_WORKERID, config, null, null); final List<String> fatalErrors = instance.getStatus(Collections.<String>emptyList(), new ServicesImpl()).getFatalErrors(); assertTrue("Should not contain errors", fatalErrors.isEmpty()); }