Skip to content

Commit

Permalink
fix compiling error and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmeiliao committed Mar 1, 2019
1 parent bcf2594 commit 5bd8c1d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Expand Up @@ -48,7 +48,7 @@ public void disabledClusterConfig() throws Exception {
.hasStatusCode(500)
.getClusterManagementResult();
assertThat(result.isSuccessful()).isFalse();
assertThat(result.getPersistenceStatus().getMessage())
assertThat(result.getStatusMessage())
.isEqualTo("Cluster configuration service needs to be enabled");
}
}
Expand Up @@ -71,8 +71,8 @@ public void sanityCheck() throws Exception {
.with(POST_PROCESSOR)
.content(json))
.andExpect(status().isInternalServerError())
.andExpect(jsonPath("$.persistenceStatus.success", is(false)))
.andExpect(jsonPath("$.persistenceStatus.message",
.andExpect(jsonPath("$.statusCode", is("ERROR")))
.andExpect(jsonPath("$.statusMessage",
is("no members found to create cache element")));
}

Expand Down
Expand Up @@ -73,8 +73,8 @@ public void sanityCheck_not_authorized() throws Exception {
.with(POST_PROCESSOR)
.content(json))
.andExpect(status().isForbidden())
.andExpect(jsonPath("$.persistenceStatus.success", is(false)))
.andExpect(jsonPath("$.persistenceStatus.message",
.andExpect(jsonPath("$.statusCode", is("UNAUTHORIZED")))
.andExpect(jsonPath("$.statusMessage",
is("user not authorized for DATA:MANAGE")));
}

Expand All @@ -84,8 +84,8 @@ public void sanityCheckWithNoCredentials() throws Exception {
.with(POST_PROCESSOR)
.content(json))
.andExpect(status().isUnauthorized())
.andExpect(jsonPath("$.persistenceStatus.success", is(false)))
.andExpect(jsonPath("$.persistenceStatus.message",
.andExpect(jsonPath("$.statusCode", is("UNAUTHENTICATED")))
.andExpect(jsonPath("$.statusMessage",
is("Full authentication is required to access this resource")));
}

Expand All @@ -96,8 +96,8 @@ public void sanityCheckWithWrongCredentials() throws Exception {
.with(POST_PROCESSOR)
.content(json))
.andExpect(status().isUnauthorized())
.andExpect(jsonPath("$.persistenceStatus.success", is(false)))
.andExpect(jsonPath("$.persistenceStatus.message",
.andExpect(jsonPath("$.statusCode", is("UNAUTHENTICATED")))
.andExpect(jsonPath("$.statusMessage",
is("Authentication error. Please check your credentials.")));
}

Expand All @@ -108,8 +108,8 @@ public void sanityCheck_success() throws Exception {
.with(POST_PROCESSOR)
.content(json))
.andExpect(status().isInternalServerError())
.andExpect(jsonPath("$.persistenceStatus.success", is(false)))
.andExpect(jsonPath("$.persistenceStatus.message",
.andExpect(jsonPath("$.statusCode", is("ERROR")))
.andExpect(jsonPath("$.statusMessage",
is("no members found to create cache element")));
}

Expand Down
Expand Up @@ -82,7 +82,8 @@ public void commence(HttpServletRequest request, HttpServletResponse response,
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setContentType(MediaType.APPLICATION_JSON_UTF8.getType());
ClusterManagementResult result =
new ClusterManagementResult(false, authException.getMessage());
new ClusterManagementResult(ClusterManagementResult.StatusCode.UNAUTHENTICATED,
authException.getMessage());
objectMapper.writeValue(response.getWriter(), result);
}
});
Expand Down

0 comments on commit 5bd8c1d

Please sign in to comment.