You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by en...@apache.org on 2009/05/18 14:35:35 UTC

svn commit: r775920 - in /servicemix/smx3/branches/servicemix-3.2: common/servicemix-common/src/test/java/org/apache/servicemix/common/wsdl1/ common/servicemix-common/src/test/resources/org/ common/servicemix-common/src/test/resources/org/apache/ commo...

Author: enolan
Date: Mon May 18 12:35:34 2009
New Revision: 775920

URL: http://svn.apache.org/viewvc?rev=775920&view=rev
Log:
SMXCOMP-519 - Add new tests for the scheduler and wsdl1 package 

Added:
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/wsdl1/
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/wsdl1/JbiEndpointMarshallingTest.java   (with props)
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/different-role.wsdl   (with props)
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/helloworld.wsdl   (with props)
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/no-role.wsdl   (with props)
    servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/test/java/org/apache/servicemix/components/varscheduler/
    servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/test/java/org/apache/servicemix/components/varscheduler/SchedulerTest.java   (with props)

Added: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/wsdl1/JbiEndpointMarshallingTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/wsdl1/JbiEndpointMarshallingTest.java?rev=775920&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/wsdl1/JbiEndpointMarshallingTest.java (added)
+++ servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/wsdl1/JbiEndpointMarshallingTest.java Mon May 18 12:35:34 2009
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.common.wsdl1;
+
+import java.net.URI;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.xml.namespace.QName;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLWriter;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+//import org.apache.servicemix.common.scheduler.Scheduler;
+
+public class JbiEndpointMarshallingTest extends TestCase {
+
+    private static transient Log logger =  LogFactory.getLog(JbiEndpointMarshallingTest.class);
+    
+    public static final String NS_URI_JBI = "http://servicemix.org/wsdl/jbi/";
+
+    public static final String ELEM_ENDPOINT = "endpoint";
+    
+    public static final QName Q_ELEM_JBI_ENDPOINT = new QName(NS_URI_JBI, ELEM_ENDPOINT);
+           
+    private QName SvcName = new QName("http://apache.org/hello_world_soap_http_provider",
+    		"SOAPService", "");
+    
+    private QName defaultOp = new QName("http://schemas.xmlsoap.org/wsdl/", "sayHi", "");
+    
+    
+    // Test to DeSerialize JBI endpoints 
+    public void testDeSerialize() throws Exception {
+    	ExtensionRegistry extReg = new ExtensionRegistry();    	
+    	JbiExtension.register(extReg);
+    	    	    	
+    	WSDLFactory factory = WSDLFactory.newInstance();
+    	WSDLReader reader = factory.newWSDLReader();    	   		
+    	reader.setFeature("javax.wsdl.verbose", true);
+    	reader.setFeature("javax.wsdl.importDocuments", true);    	
+    	reader.setExtensionRegistry(extReg);
+    	
+    	java.net.URL tmp = null;
+        try {
+            tmp = JbiEndpointMarshallingTest.class.getClassLoader().getResource(
+                "org/apache/servicemix/common/wsdl1/helloworld.wsdl"                 
+            );
+        } catch (final Exception e) {
+            e.printStackTrace();
+        }
+    	
+    	Definition wsdlDefinition = reader.readWSDL(tmp.toString());
+    	Service svc = wsdlDefinition.getService(SvcName);
+    	Port port = svc.getPort("SoapPort");
+    	List extElements  = port.getExtensibilityElements();    
+    	
+    	//Tests for role=provider, MEP=Default
+    	JbiEndpoint jbiEndpoint = (JbiEndpoint)extElements.get(0);    	
+    	assertEquals(javax.jbi.messaging.MessageExchange.Role.PROVIDER, jbiEndpoint.getRole().PROVIDER);
+    	assertEquals(defaultOp, jbiEndpoint.getDefaultOperation());
+    	assertNotNull(jbiEndpoint.toString());
+    	
+    	//Tests for role=consumer,MEP=in-only
+    	jbiEndpoint = (JbiEndpoint)extElements.get(1);
+    	assertEquals(javax.jbi.messaging.MessageExchange.Role.CONSUMER, jbiEndpoint.getRole().CONSUMER);
+    	assertEquals(new URI("http://www.w3.org/2004/08/wsdl/in-only"), jbiEndpoint.getDefaultMep());    	
+    	
+    	//Tests for role=provider, MEP=robust-in-only
+    	jbiEndpoint = (JbiEndpoint)extElements.get(2);
+    	assertEquals(javax.jbi.messaging.MessageExchange.Role.PROVIDER, jbiEndpoint.getRole().PROVIDER); 
+    	assertEquals(new URI("http://www.w3.org/2004/08/wsdl/robust-in-only"), jbiEndpoint.getDefaultMep());
+    	
+    	//Tests for role=provider, MEP=in-out
+    	jbiEndpoint = (JbiEndpoint)extElements.get(3);
+    	assertEquals(javax.jbi.messaging.MessageExchange.Role.PROVIDER, jbiEndpoint.getRole().PROVIDER);
+    	assertEquals(new URI("http://www.w3.org/2004/08/wsdl/in-out"), jbiEndpoint.getDefaultMep());
+    	
+    }    
+        
+    public void testNoRoleDeserialize() throws Exception {
+    	ExtensionRegistry extReg = new ExtensionRegistry();    	
+    	JbiExtension.register(extReg);
+    	    	    	
+    	WSDLFactory factory = WSDLFactory.newInstance();
+    	WSDLReader reader = factory.newWSDLReader();    	   		
+    	reader.setFeature("javax.wsdl.verbose", true);
+    	reader.setFeature("javax.wsdl.importDocuments", true);    	
+    	reader.setExtensionRegistry(extReg);
+    	
+    	java.net.URL tmp = null;
+        try {
+            tmp = JbiEndpointMarshallingTest.class.getClassLoader().getResource(
+                "org/apache/servicemix/common/wsdl1/no-role.wsdl"                 
+            );
+        } catch (final Exception e) {
+            e.printStackTrace();
+        }
+    	
+        try {
+    	    reader.readWSDL(tmp.toString());
+    	    fail();
+        } catch (WSDLException ex) {
+    		// Should catch this exception - Role must be specified");
+        }
+        
+        tmp = null;
+        try {
+            tmp = JbiEndpointMarshallingTest.class.getClassLoader().getResource(
+                "org/apache/servicemix/common/wsdl1/different-role.wsdl"                 
+            );
+        } catch (final Exception e) {
+            e.printStackTrace();
+        }
+        
+        try {
+    	    reader.readWSDL(tmp.toString());
+    	    fail();
+        } catch (WSDLException ex) {
+    		// Should catch this exception - Unrecognised role: producer");
+        }            	  
+    }
+    
+    // Test to Serialize JBI endpoints
+    public void testSerialize() throws Exception {    	
+    	ExtensionRegistry extReg = new ExtensionRegistry();
+    	JbiExtension.register(extReg);
+    	
+    	WSDLFactory factory = WSDLFactory.newInstance();
+    	WSDLReader reader = factory.newWSDLReader();    	   		
+    	reader.setFeature("javax.wsdl.verbose", true);
+    	reader.setFeature("javax.wsdl.importDocuments", true);    	
+    	reader.setExtensionRegistry(extReg);
+    	
+    	java.net.URL tmp = null;
+        try {
+            tmp = JbiEndpointMarshallingTest.class.getClassLoader().getResource(
+                "org/apache/servicemix/common/wsdl1/helloworld.wsdl"                 
+            );
+        } catch (final Exception e) {
+            e.printStackTrace();
+        }
+    	
+    	Definition wsdlDefinition = reader.readWSDL(tmp.toString());
+    	Service svc = wsdlDefinition.getService(SvcName);
+    	Port port = svc.getPort("SoapPort");
+
+    	JbiEndpoint jbiExt = (JbiEndpoint)extReg.createExtension(javax.wsdl.Port.class, 
+                                                                 Q_ELEM_JBI_ENDPOINT);
+    	
+    	jbiExt.setRequired(true);
+    	jbiExt.setRole(javax.jbi.messaging.MessageExchange.Role.PROVIDER);
+    	jbiExt.setDefaultMep(new URI("http://www.w3.org/2004/08/wsdl/in-out"));
+    	assertTrue(jbiExt.getRequired());
+
+        port.addExtensibilityElement(jbiExt);
+
+    	
+    	WSDLWriter writer = factory.newWSDLWriter();
+    	wsdlDefinition.setExtensionRegistry(extReg);
+    	writer.writeWSDL(wsdlDefinition, System.out);
+    	System.out.println("Test finished");    	    	 
+    	
+    }        
+
+    
+}

Propchange: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/wsdl1/JbiEndpointMarshallingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/different-role.wsdl
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/different-role.wsdl?rev=775920&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/different-role.wsdl (added)
+++ servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/different-role.wsdl Mon May 18 12:35:34 2009
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions name="HelloWorld" targetNamespace="http://apache.org/hello_world_soap_http_provider" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://apache.org/hello_world_soap_http_provider"
+    xmlns:jbi="http://servicemix.org/wsdl/jbi/"
+    xmlns:x1="http://apache.org/hello_world_soap_http_provider/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema targetNamespace="http://apache.org/hello_world_soap_http_provider/types" 
+            xmlns="http://www.w3.org/2001/XMLSchema"
+	    xmlns:tns="http://apache.org/hello_world_soap_http_provider/types"
+            elementFormDefault="qualified">
+	    <simpleType name="MyStringType">
+		<restriction base="string">
+		    <maxLength value="30" />
+		</restriction>
+	    </simpleType>
+
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="tns:MyStringType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">               
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+       
+    </wsdl:portType>
+    
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>                
+        
+    </wsdl:binding>
+
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <jbi:endpoint required="true" role="producer" defaultOperation="sayHi"/>                       
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Propchange: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/different-role.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/helloworld.wsdl
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/helloworld.wsdl?rev=775920&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/helloworld.wsdl (added)
+++ servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/helloworld.wsdl Mon May 18 12:35:34 2009
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions name="HelloWorld" targetNamespace="http://apache.org/hello_world_soap_http_provider" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://apache.org/hello_world_soap_http_provider"
+    xmlns:jbi="http://servicemix.org/wsdl/jbi/"
+    xmlns:x1="http://apache.org/hello_world_soap_http_provider/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema targetNamespace="http://apache.org/hello_world_soap_http_provider/types" 
+            xmlns="http://www.w3.org/2001/XMLSchema"
+	    xmlns:tns="http://apache.org/hello_world_soap_http_provider/types"
+            elementFormDefault="qualified">
+	    <simpleType name="MyStringType">
+		<restriction base="string">
+		    <maxLength value="30" />
+		</restriction>
+	    </simpleType>
+
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="tns:MyStringType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">               
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+       
+    </wsdl:portType>
+    
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>                
+        
+    </wsdl:binding>
+
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <jbi:endpoint required="TRUE" role="provider" defaultOperation="sayHi"/>
+            <jbi:endpoint required="1" role="consumer" defaultMep="in-only"/>            
+            <jbi:endpoint required="edell" role="provider" defaultMep="robust-in-only"/>
+            <jbi:endpoint required="edell" role="provider" defaultMep="in-out"/>            
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Propchange: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/helloworld.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/no-role.wsdl
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/no-role.wsdl?rev=775920&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/no-role.wsdl (added)
+++ servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/no-role.wsdl Mon May 18 12:35:34 2009
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions name="HelloWorld" targetNamespace="http://apache.org/hello_world_soap_http_provider" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://apache.org/hello_world_soap_http_provider"
+    xmlns:jbi="http://servicemix.org/wsdl/jbi/"
+    xmlns:x1="http://apache.org/hello_world_soap_http_provider/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema targetNamespace="http://apache.org/hello_world_soap_http_provider/types" 
+            xmlns="http://www.w3.org/2001/XMLSchema"
+	    xmlns:tns="http://apache.org/hello_world_soap_http_provider/types"
+            elementFormDefault="qualified">
+	    <simpleType name="MyStringType">
+		<restriction base="string">
+		    <maxLength value="30" />
+		</restriction>
+	    </simpleType>
+
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="tns:MyStringType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">               
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+       
+    </wsdl:portType>
+    
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>                
+        
+    </wsdl:binding>
+
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <jbi:endpoint required="true" defaultOperation="sayHi"/>                        
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Propchange: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/resources/org/apache/servicemix/common/wsdl1/no-role.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/test/java/org/apache/servicemix/components/varscheduler/SchedulerTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/test/java/org/apache/servicemix/components/varscheduler/SchedulerTest.java?rev=775920&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/test/java/org/apache/servicemix/components/varscheduler/SchedulerTest.java (added)
+++ servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/test/java/org/apache/servicemix/components/varscheduler/SchedulerTest.java Mon May 18 12:35:34 2009
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.components.varscheduler;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SchedulerTest extends TestCase {
+
+    private static transient Log logger =  LogFactory.getLog(SchedulerTest.class);
+
+    // Tests Scheduling a task
+    public void testSchedule() throws Exception {
+        Scheduler scheduler = new Scheduler();        
+        MySchedulerTask task = new MySchedulerTask(1);
+        MyScheduleIterator iter = new MyScheduleIterator();
+        MySchedulerTask task2 = new MySchedulerTask(0);
+        MyScheduleIterator2 iter2 = new MyScheduleIterator2();
+        scheduler.schedule(task, iter);
+            
+        try {
+            scheduler.schedule(task, iter);
+            fail();
+        } catch (java.lang.IllegalStateException e) {
+            //should catch this Fault
+        }
+                        
+        scheduler.schedule(task2, iter2);            
+        scheduler.cancel();           
+    }
+    
+    // Tests cancel a task
+    public void testCancel() throws Exception {
+            
+        MySchedulerTask task = new MySchedulerTask(1);     
+        MyScheduleIterator iter = new MyScheduleIterator();
+        Scheduler scheduler = new Scheduler(false);            
+        scheduler.schedule(task, iter);           
+    }
+    
+    // Tests running a task 
+    public void testRun() throws Exception {
+        MySchedulerTask task = new MySchedulerTask(2);     
+        MyScheduleIterator iter = new MyScheduleIterator();
+        Scheduler scheduler = new Scheduler(false);            
+        scheduler.schedule(task, iter);        
+    }
+
+        
+    public class MyScheduleIterator implements ScheduleIterator {
+
+        public Date nextExecution() {                
+            return new java.util.Date();
+        }
+    }
+   
+    public class MyScheduleIterator2 implements ScheduleIterator {
+
+        public Date nextExecution() {
+            return null;           
+        }
+    }
+
+    // Need to extend abstract SchedulerTask class
+    public class MySchedulerTask extends SchedulerTask {
+
+        long scheduleExecTime;
+        private int counter;
+
+        public MySchedulerTask(int counter) {
+            this.counter = counter;
+        }
+
+        @Override
+        public void run() {
+            switch(counter) {
+            case 0:
+                logger.info("Hello");
+                scheduleExecTime = this.scheduledExecutionTime();
+                break;
+            case 1:
+                logger.info("Hellow");
+                scheduleExecTime = this.scheduledExecutionTime();
+                logger.info("schedulExecTime 1 = " + scheduleExecTime);
+                this.cancel();
+                break;
+            case 2:
+                logger.info("HelloT");
+                this.timerTask = null;
+                scheduleExecTime = this.scheduledExecutionTime();
+                logger.info("schedulExecTime 2 = " + scheduleExecTime);
+                this.cancel();
+                break;
+            default:
+                logger.info("default");
+            }
+        }
+    }
+}

Propchange: servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/test/java/org/apache/servicemix/components/varscheduler/SchedulerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native