You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by pr...@apache.org on 2014/04/24 08:04:48 UTC
[4/5] git commit: adding schema files to stratos mock app and doing
full round of testing
adding schema files to stratos mock app and doing full round of testing
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/b0f7e046
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/b0f7e046
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/b0f7e046
Branch: refs/heads/master
Commit: b0f7e0461ed581e70bfe713052b72f2ae02ecf8e
Parents: e292423
Author: Pradeep Fernando <pr...@gmail.com>
Authored: Thu Apr 24 11:32:36 2014 +0530
Committer: Pradeep Fernando <pr...@gmail.com>
Committed: Thu Apr 24 11:32:36 2014 +0530
----------------------------------------------------------------------
.../webapp/stratos-test/WEB-INF/cxf-servlet.xml | 41 +++++-
.../stratos-test/WEB-INF/schemas/schema.xsd | 144 +++++++++++++++++++
.../main/webapp/stratos/WEB-INF/cxf-servlet.xml | 2 +
.../webapp/stratos/WEB-INF/schemas/schema.xsd | 121 +++++++++++++---
4 files changed, 288 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b0f7e046/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/cxf-servlet.xml
index 552cad7..2eae5ed 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/cxf-servlet.xml
+++ b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/cxf-servlet.xml
@@ -21,8 +21,10 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<jaxrs:server id="stratosAdmin" address="/">
@@ -31,14 +33,45 @@
</jaxrs:serviceBeans>
<jaxrs:providers>
- <bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
- <property name="dropRootElement" value="true"/>
- <property name="supportUnwrapped" value="true"/>
- </bean>>
+ <ref bean="throwableExceptionHandler"/>
+ <ref bean="genericExceptionHandler"/>
+ <ref bean="badRequestExceptionHandler"/>
+ <ref bean="jsonProvider"/>
<ref bean="exceptionHandler"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="stratosRestEndpointTestBean" class="org.apache.stratos.rest.endpoint.mock.StratosTestAdmin"/>
<bean id="exceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper"/>
+ <bean id="badRequestExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.BadRequestExceptionMapper"/>
+ <bean id="genericExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.GenericExceptionMapper"/>
+ <bean id="throwableExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomThrowableExceptionMapper"/>
+ <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
+ <property name="schemaHandler" ref="schemaHolder"/>
+ <property name="supportUnwrapped" value="true"/>
+ <property name="serializeAsArray" value="true"/>
+ <property name="arrayKeys">
+ <list>
+ <value>partitions</value>
+ <value>property</value>
+ <value>hostNames</value>
+ <value>memberMap</value>
+ <value>portMap</value>
+ <value>partitionGroup</value>
+ <value>partition</value>
+ <value>member</value>
+ <value>hostNames</value>
+ <value>portMappings</value>
+ <value>volumes</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="schemaHolder" class="org.apache.cxf.jaxrs.utils.schemas.SchemaHandler">
+ <property name="schemas" ref="theSchemas"/>
+ </bean>
+
+ <util:list id="theSchemas">
+ <value>classpath:/WEB-INF/schemas/schema.xsd</value>
+ </util:list>
</beans>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b0f7e046/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
new file mode 100644
index 0000000..23efb1d
--- /dev/null
+++ b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos-test/WEB-INF/schemas/schema.xsd
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="partition">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="provider" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="property" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </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>
+
+ <xs:element name="autoscalePolicy">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="loadThresholds" minOccurs="1" maxOccurs="1" nillable="false">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="requestsInFlight" type="thresholdValues" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="memoryConsumption" type="thresholdValues" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="loadAverage" type="thresholdValues" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="deploymentPolicy">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false"/>
+ <xs:element name="partitionGroup">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false"/>
+ <xs:element name="partitionAlgo" minOccurs="1" maxOccurs="1" nillable="false">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="round-robin"/>
+ <xs:enumeration value="one-after-another"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="partition" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="id" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false"/>
+ <xs:element name="partitionMax" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="partitionMin" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="cartridgeDefinitionBean">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="type" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="provider" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="host" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="displayName" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="description" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="version" type="xs:float" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="defaultAutoscalingPolicy" type="xs:string" minOccurs="0" maxOccurs="1" nillable="false"/>
+ <xs:element name="multiTenant" type="xs:boolean" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="portMapping" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="protocol" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false"/>
+ <xs:element name="port" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="proxyPort" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="iaasProvider" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <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:complexType>
+ <xs:all>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="loadBalancer" minOccurs="0" maxOccurs="1" nillable="true">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="type" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="property" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="value" type="xs:string" 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>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </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:all>
+ </xs:complexType>
+</xs:schema>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b0f7e046/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
index 624cb24..2695ccf 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
+++ b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
@@ -33,6 +33,7 @@
</jaxrs:serviceBeans>
<jaxrs:providers>
+ <ref bean="throwableExceptionHandler"/>
<ref bean="genericExceptionHandler"/>
<ref bean="badRequestExceptionHandler"/>
<ref bean="jsonProvider"/>
@@ -52,6 +53,7 @@
<bean id="exceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper"/>
<bean id="badRequestExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.BadRequestExceptionMapper"/>
<bean id="genericExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.GenericExceptionMapper"/>
+ <bean id="throwableExceptionHandler" class="org.apache.stratos.rest.endpoint.handlers.CustomThrowableExceptionMapper"/>
<!--The below config enables OAuth based authentication/authorization for REST API-->
<bean id="OAuthFilter" class="org.apache.stratos.rest.endpoint.handlers.OAuthHandler">
<property name="password" value="admin"/>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b0f7e046/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 cfd814a..23efb1d 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
@@ -7,10 +7,10 @@
<xs:element name="provider" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element name="property" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
- <xs:sequence>
+ <xs:all>
<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
- </xs:sequence>
+ </xs:all>
</xs:complexType>
</xs:element>
<xs:element name="partitionMin" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
@@ -18,12 +18,20 @@
</xs:sequence>
</xs:complexType>
</xs:element>
-
+
<xs:element name="autoscalePolicy">
<xs:complexType>
<xs:sequence>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
+ <xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="loadThresholds" minOccurs="1" maxOccurs="1" nillable="false">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="requestsInFlight" type="thresholdValues" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="memoryConsumption" type="thresholdValues" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="loadAverage" type="thresholdValues" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -31,8 +39,31 @@
<xs:element name="deploymentPolicy">
<xs:complexType>
<xs:sequence>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
+ <xs:element name="id" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false"/>
+ <xs:element name="partitionGroup">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false"/>
+ <xs:element name="partitionAlgo" minOccurs="1" maxOccurs="1" nillable="false">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="round-robin"/>
+ <xs:enumeration value="one-after-another"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="partition" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="id" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false"/>
+ <xs:element name="partitionMax" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="partitionMin" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -40,16 +71,74 @@
<xs:element name="cartridgeDefinitionBean">
<xs:complexType>
<xs:sequence>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
- <xs:any processContents="lax"/>
+ <xs:element name="type" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="provider" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="host" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="displayName" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="description" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="version" type="xs:float" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="defaultAutoscalingPolicy" type="xs:string" minOccurs="0" maxOccurs="1" nillable="false"/>
+ <xs:element name="multiTenant" type="xs:boolean" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="portMapping" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="protocol" type="xs:string" maxOccurs="1" minOccurs="1" nillable="false"/>
+ <xs:element name="port" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="proxyPort" type="xs:int" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="iaasProvider" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <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:complexType>
+ <xs:all>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="loadBalancer" minOccurs="0" maxOccurs="1" nillable="true">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="type" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="property" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="value" type="xs:string" 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>
+ <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
</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:all>
+ </xs:complexType>
</xs:schema>
\ No newline at end of file