@Test public void testCreateJobEncryptionEnabled() throws Exception { when(properties.isEncryption()).thenReturn(true); final String secretKey = "abcdefghijklmnopqrstuvwxyz"; when(properties.getSecretKey()).thenReturn(secretKey); GearmanJob gearmanJob = testling.creatJob(new NagiosCheckResult(queueName, "sakuli_demo22__2015_03_07_12_59_00_00", testResult)); assertEquals(Aes.decrypt(gearmanJob.getData(), secretKey), testResult); }
protected GearmanJob creatJob(NagiosCheckResult checkResult) { byte[] bytesBase64; if (properties.isEncryption()) { bytesBase64 = Aes.encrypt(checkResult.getPayload(), properties.getSecretKey()); } else { bytesBase64 = Base64.encodeBase64(checkResult.getPayload().getBytes()); } return GearmanJobImpl.createBackgroundJob(checkResult.getQueueName(), bytesBase64, checkResult.getUuid()); }
GearmanResultServiceImpl extends AbstractTeardownService implements ResultService { protected GearmanJob creatJob(NagiosCheckResult checkResult) { byte[] bytesBase64; if (properties.isEncryption()) { bytesBase64 = Aes.encrypt(checkResult.getPayload(), properties.getSecretKey()); } else { bytesBase64 = Base64.encodeBase64(checkResult.getPayload().getBytes()); } return GearmanJobImpl.createBackgroundJob(checkResult.getQueueName(), bytesBase64, checkResult.getUuid()); } }
GearmanResultServiceImpl extends AbstractTeardownService implements ResultService { protected GearmanJob creatJob(NagiosCheckResult checkResult) { byte[] bytesBase64; if (properties.isEncryption()) { bytesBase64 = Aes.encrypt(checkResult.getPayload(), properties.getSecretKey()); } else { bytesBase64 = Base64.encodeBase64(checkResult.getPayload().getBytes()); } return GearmanJobImpl.createBackgroundJob(checkResult.getQueueName(), bytesBase64, checkResult.getUuid()); }  }
GearmanResultServiceImpl extends AbstractTeardownService implements ResultService { protected GearmanJob creatJob(NagiosCheckResult checkResult) { byte[] bytesBase64; if (properties.isEncryption()) { bytesBase64 = Aes.encrypt(checkResult.getPayload(), properties.getSecretKey()); } else { bytesBase64 = Base64.encodeBase64(checkResult.getPayload().getBytes()); } return GearmanJobImpl.createBackgroundJob(checkResult.getQueueName(), bytesBase64, checkResult.getUuid()); }  @Override int getServicePriority(); @Override void tearDown(Optional<AbstractTestDataEntity> dataEntity, boolean asyncCall); }
GearmanResultServiceImpl extends AbstractTeardownService implements ResultService { protected GearmanJob creatJob(NagiosCheckResult checkResult) { byte[] bytesBase64; if (properties.isEncryption()) { bytesBase64 = Aes.encrypt(checkResult.getPayload(), properties.getSecretKey()); } else { bytesBase64 = Base64.encodeBase64(checkResult.getPayload().getBytes()); } return GearmanJobImpl.createBackgroundJob(checkResult.getQueueName(), bytesBase64, checkResult.getUuid()); }  @Override int getServicePriority(); @Override void tearDown(Optional<AbstractTestDataEntity> dataEntity, boolean asyncCall);  }