private void updateStatus(String applicationId, String credentialsId, CredentialsStatus status) throws CredentialsServiceException { Validate.notBlank(applicationId, "Invalid application ID provided!"); Validate.notBlank(credentialsId, "Invalid credentials ID provided!"); try { this.credentialsDao.updateStatus(applicationId, credentialsId, status); } catch (Exception cause) { String message = MessageFormat.format("[{0}] An unexpected exception occured while updating" + " credentials [{1}]", applicationId, credentialsId); LOG.error(message, cause); throw new CredentialsServiceException(cause); } } }
@Test public void testUpdateStatus() { CredentialsDto credentials = this.generateCredentials(CREDENTIALS_APPLICATION_ID, CREDENTIALS_ID, CREDENTIALS_BODY, AVAILABLE); Assert.assertNotNull(credentials); Assert.assertNotNull(credentials.getId()); Optional<CassandraCredentials> updated = this.credentialsDao.updateStatus(CREDENTIALS_APPLICATION_ID, CREDENTIALS_ID, REVOKED); Assert.assertTrue(updated.isPresent()); Assert.assertEquals(REVOKED, updated.get().getStatus()); }
@Test public void testUpdateStatus() throws Exception { CredentialsDto credentials = this.generateCredentials(APPLICATION_ID, CREDENTIALS_BODY, AVAILABLE); Assert.assertNotNull(credentials); Assert.assertNotNull(credentials.getId()); Optional<Credentials> updated = this.credentialsDao.updateStatus(APPLICATION_ID, credentials.getId(), REVOKED); Assert.assertTrue(updated.isPresent()); Assert.assertEquals(REVOKED, updated.get().getStatus()); }