merging, schema tested with test webapp to the main webapp
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/0b861337 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/0b861337 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/0b861337 Branch: refs/heads/master Commit: 0b8613377b65974fb8b36d5b4c59bb8fdc99f2c4 Parents: f94b8d1 Author: Pradeep Fernando <[email protected]> Authored: Wed Apr 30 13:51:54 2014 +0530 Committer: Pradeep Fernando <[email protected]> Committed: Wed Apr 30 13:51:54 2014 +0530 ---------------------------------------------------------------------- .../stratos/rest/endpoint/mock/MockContext.java | 4 + .../rest/endpoint/mock/StratosTestAdmin.java | 9 +++ .../stratos-test/WEB-INF/schemas/schema.xsd | 2 +- .../webapp/stratos/WEB-INF/schemas/schema.xsd | 81 ++++++++++++++++++-- 4 files changed, 88 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0b861337/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java index abd0a59..ec58da7 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/MockContext.java @@ -360,6 +360,10 @@ public class MockContext { return serviceDefinitionMap.values().toArray(new ServiceDefinitionBean[0]); } + public ServiceDefinitionBean getServiceType(String serviceType) throws RestAPIException{ + return serviceDefinitionMap.get(serviceType); + } + public Partition[] getPartitions(String deploymentPolicyId, String partitionGroupId) throws RestAPIException{ if(!deploymentPolicyMap.containsKey(deploymentPolicyId)){ throw new RestAPIException("There is no deployment policy with id: " + deploymentPolicyId); http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0b861337/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosTestAdmin.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosTestAdmin.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosTestAdmin.java index 6880bab..c31e3e3 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosTestAdmin.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/mock/StratosTestAdmin.java @@ -241,6 +241,15 @@ public class StratosTestAdmin { } + @GET + @Path("/service/{serviceType}") + @Produces("application/json") + @Consumes("application/json") + @AuthorizationAction("/permission/protected/manage/monitor/tenants") + public ServiceDefinitionBean getService(@PathParam("serviceType") String serviceType)throws RestAPIException { + + return MockContext.getInstance().getServiceType(serviceType); + } @POST @Path("/cartridge/definition/") http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0b861337/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/schemas/schema.xsd ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/schemas/schema.xsd b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/schemas/schema.xsd index 4c3b355..769659e 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/schemas/schema.xsd +++ b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/schemas/schema.xsd @@ -9,7 +9,7 @@ <xs:element name="adminPassword" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> <xs:element name="tenantDomain" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> <xs:element name="email" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> - <xs:element name="active" type="xs:boolean" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="active" type="xs:boolean" minOccurs="0" maxOccurs="1" nillable="false"/> </xs:all> </xs:complexType> </xs:element> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0b861337/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/schemas/schema.xsd ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/schemas/schema.xsd b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/schemas/schema.xsd index 23efb1d..5a5ea6a 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/schemas/schema.xsd +++ b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/schemas/schema.xsd @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:element name="tenantInfoBean"> + <xs:complexType> + <xs:all> + <xs:element name="admin" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="firstname" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="lastname" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="adminPassword" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="tenantDomain" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="email" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="active" type="xs:boolean" minOccurs="0" maxOccurs="1" nillable="false"/> + </xs:all> + </xs:complexType> + </xs:element> + <xs:element name="partition"> <xs:complexType> <xs:sequence> @@ -13,8 +27,6 @@ </xs:all> </xs:complexType> </xs:element> - <xs:element name="partitionMin" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/> - <xs:element name="partitionMax" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/> </xs:sequence> </xs:complexType> </xs:element> @@ -94,7 +106,7 @@ <xs:element name="type" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> <xs:element name="imageId" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> <xs:element name="maxInstanceLimit" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/> - <xs:element name="property" minOccurs="1" maxOccurs="unbounded"> + <xs:element name="property" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:all> <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> @@ -102,6 +114,13 @@ </xs:all> </xs:complexType> </xs:element> + <xs:element name="networkInterfaces" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:all> + <xs:element name="networkUuid" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + </xs:all> + </xs:complexType> + </xs:element> </xs:sequence> </xs:complexType> </xs:element> @@ -120,6 +139,23 @@ </xs:sequence> </xs:complexType> </xs:element> + <xs:element name="persistence" minOccurs="0" maxOccurs="1" nillable="true"> + <xs:complexType> + <xs:sequence> + <xs:element name="isRequired" type="xs:boolean" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="volume" minOccurs="1" maxOccurs="unbounded"> + <xs:complexType> + <xs:all> + <xs:element name="device" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="mappingPath" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="size" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="removeOnTermination" type="xs:boolean" minOccurs="1" maxOccurs="1" nillable="false"/> + </xs:all> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> <xs:element name="property" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:all> @@ -132,13 +168,44 @@ </xs:complexType> </xs:element> + <xs:element name="cartridgeInfoBean"> + <xs:complexType> + <xs:all> + <xs:element name="cartridgeType" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="alias" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="repoURL" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="privateRepo" type="xs:boolean" minOccurs="0" maxOccurs="1" nillable="false"/> + <xs:element name="repoUsername" type="xs:string" minOccurs="0" maxOccurs="1" nillable="false"/> + <xs:element name="repoPassword" type="xs:string" minOccurs="0" maxOccurs="1" nillable="false"/> + <xs:element name="commitsEnabled" type="xs:boolean" minOccurs="0" maxOccurs="1" nillable="false"/> + <xs:element name="autoscalePolicy" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="deploymentPolicy" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + </xs:all> + </xs:complexType> + </xs:element> + + + <xs:element name="serviceDefinitionBean"> + <xs:complexType> + <xs:all> + <xs:element name="serviceName" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="cartridgeType" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="deploymentPolicyName" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="autoscalingPolicyName" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="clusterDomain" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="clusterSubDomain" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + <xs:element name="tenantRange" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/> + </xs:all> + </xs:complexType> + </xs:element> + <xs:complexType name="thresholdValues"> <xs:all> <xs:element name="average" type="xs:int" minOccurs="1" maxOccurs="1"/> - <xs:element name="gradient" type="xs:float" minOccurs="1" maxOccurs="1"/> - <xs:element name="secondDerivative" type="xs:float" minOccurs="1" maxOccurs="1"/> - <xs:element name="scaleDownMarginOfGradient" type="xs:float" minOccurs="1" maxOccurs="1"/> - <xs:element name="scaleDownMarginOfSecondDerivative" type="xs:float" minOccurs="1" maxOccurs="1"/> + <xs:element name="gradient" type="xs:float" minOccurs="0" maxOccurs="1"/> + <xs:element name="secondDerivative" type="xs:float" minOccurs="0" maxOccurs="1"/> + <xs:element name="scaleDownMarginOfGradient" type="xs:float" minOccurs="0" maxOccurs="1"/> + <xs:element name="scaleDownMarginOfSecondDerivative" type="xs:float" minOccurs="0" maxOccurs="1"/> </xs:all> </xs:complexType> </xs:schema> \ No newline at end of file
