[47/50] [abbrv] ambari git commit: AMBARI-21307 renamed package, minor corrections. Changed endpoint name
AMBARI-21307 renamed package, minor corrections. Changed endpoint name Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/30b64152 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/30b64152 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/30b64152 Branch: refs/heads/feature-branch-AMBARI-21307 Commit: 30b64152ff3215a5595a56541c7e5c3fa57d9968 Parents: 97ec65e Author: lpuskasAuthored: Mon Aug 14 13:21:07 2017 +0200 Committer: lpuskas Committed: Tue Sep 5 11:39:23 2017 +0200 -- .../services/AmbariConfigurationService.java| 2 +- .../api/services/ldap/LdapRestService.java | 15 +- .../server/ldap/AmbariLdapConfiguration.java| 5 +- .../apache/ambari/server/ldap/LdapModule.java | 4 +- ...efaultLdapConfigurationValidatorService.java | 243 --- .../ad/DefaultLdapConnectionService.java| 63 - ...efaultLdapConfigurationValidatorService.java | 243 +++ .../ads/DefaultLdapConnectionService.java | 63 + ...ltLdapConfigurationValidatorServiceTest.java | 113 - ...ltLdapConfigurationValidatorServiceTest.java | 113 + 10 files changed, 435 insertions(+), 429 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/30b64152/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java index 927e518..492509f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java @@ -63,7 +63,7 @@ import io.swagger.annotations.ApiResponses; * } * */ -@Path("/configurations/") +@Path("/ambariconfigs/") @Api(value = "Ambari Configurations", description = "Endpoint for Ambari configuration related operations") public class AmbariConfigurationService extends BaseService { http://git-wip-us.apache.org/repos/asf/ambari/blob/30b64152/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java index 8578204..4e654dc 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java @@ -34,6 +34,7 @@ import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -70,8 +71,9 @@ public class LdapRestService extends BaseService { @POST @ApiIgnore // until documented - @Path("/action") // todo this needs to be moved under the resource + @Path("/validate") // todo this needs to be moved under the resource @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) public Response validateConfiguration(LdapCheckConfigurationRequest ldapCheckConfigurationRequest) { Set groups = Sets.newHashSet(); @@ -95,10 +97,7 @@ public class LdapRestService extends BaseService { LOGGER.info("Testing LDAP attributes "); groups = ldapFacade.checkLdapAttibutes(ldapCheckConfigurationRequest.getRequestInfo().getParameters(), ambariLdapConfiguration); - // todo factor out the resource creation, design better the structure in the response - Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration); - resource.setProperty("groups", groups); - result.getResultTree().addChild(resource, "payload"); + setResult(groups, result); break; case "detect-attributes": @@ -119,6 +118,12 @@ public class LdapRestService extends BaseService { return Response.status(result.getStatus().getStatusCode()).entity(getResultSerializer().serialize(result)).build(); } + private void setResult(Set groups, Result result) { +Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration); +resource.setProperty("groups", groups); +result.getResultTree().addChild(resource, "payload"); + } + private void validateRequest(LdapCheckConfigurationRequest
[47/50] [abbrv] ambari git commit: AMBARI-21307 renamed package, minor corrections. Changed endpoint name
AMBARI-21307 renamed package, minor corrections. Changed endpoint name Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bdafb592 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bdafb592 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bdafb592 Branch: refs/heads/feature-branch-AMBARI-21307 Commit: bdafb592ecc2e4ebe032a03e99e3c1e6ac7acea5 Parents: 0a44f3b Author: lpuskasAuthored: Mon Aug 14 13:21:07 2017 +0200 Committer: lpuskas Committed: Tue Aug 29 15:05:29 2017 +0200 -- .../services/AmbariConfigurationService.java| 2 +- .../api/services/ldap/LdapRestService.java | 15 +- .../server/ldap/AmbariLdapConfiguration.java| 5 +- .../apache/ambari/server/ldap/LdapModule.java | 4 +- ...efaultLdapConfigurationValidatorService.java | 243 --- .../ad/DefaultLdapConnectionService.java| 63 - ...efaultLdapConfigurationValidatorService.java | 243 +++ .../ads/DefaultLdapConnectionService.java | 63 + ...ltLdapConfigurationValidatorServiceTest.java | 113 - ...ltLdapConfigurationValidatorServiceTest.java | 113 + 10 files changed, 435 insertions(+), 429 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/bdafb592/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java index 927e518..492509f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java @@ -63,7 +63,7 @@ import io.swagger.annotations.ApiResponses; * } * */ -@Path("/configurations/") +@Path("/ambariconfigs/") @Api(value = "Ambari Configurations", description = "Endpoint for Ambari configuration related operations") public class AmbariConfigurationService extends BaseService { http://git-wip-us.apache.org/repos/asf/ambari/blob/bdafb592/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java index 8578204..4e654dc 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java @@ -34,6 +34,7 @@ import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -70,8 +71,9 @@ public class LdapRestService extends BaseService { @POST @ApiIgnore // until documented - @Path("/action") // todo this needs to be moved under the resource + @Path("/validate") // todo this needs to be moved under the resource @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) public Response validateConfiguration(LdapCheckConfigurationRequest ldapCheckConfigurationRequest) { Set groups = Sets.newHashSet(); @@ -95,10 +97,7 @@ public class LdapRestService extends BaseService { LOGGER.info("Testing LDAP attributes "); groups = ldapFacade.checkLdapAttibutes(ldapCheckConfigurationRequest.getRequestInfo().getParameters(), ambariLdapConfiguration); - // todo factor out the resource creation, design better the structure in the response - Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration); - resource.setProperty("groups", groups); - result.getResultTree().addChild(resource, "payload"); + setResult(groups, result); break; case "detect-attributes": @@ -119,6 +118,12 @@ public class LdapRestService extends BaseService { return Response.status(result.getStatus().getStatusCode()).entity(getResultSerializer().serialize(result)).build(); } + private void setResult(Set groups, Result result) { +Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration); +resource.setProperty("groups", groups); +result.getResultTree().addChild(resource, "payload"); + } + private void validateRequest(LdapCheckConfigurationRequest