[savara-commits] savara SVN: r37 - in trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests: .settings and 10 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sat Oct 3 16:58:25 EDT 2009
Author: objectiser
Date: 2009-10-03 16:58:25 -0400 (Sat, 03 Oct 2009)
New Revision: 37
Added:
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.classpath
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.project
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/org.eclipse.jdt.core.prefs
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/org.eclipse.pde.core.prefs
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/META-INF/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/META-INF/MANIFEST.MF
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/build.properties
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/osgi/
trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/osgi/Activator.java
Log:
Creation of initial tests for WSDL generator plugin.
Added: trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.classpath
===================================================================
--- trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.classpath (rev 0)
+++ trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.classpath 2009-10-03 20:58:25 UTC (rev 37)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="output" path="classes"/>
+</classpath>
Added: trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.project
===================================================================
--- trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.project (rev 0)
+++ trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.project 2009-10-03 20:58:25 UTC (rev 37)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.savara.tools.wsdl.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/org.eclipse.jdt.core.prefs 2009-10-03 20:58:25 UTC (rev 37)
@@ -0,0 +1,8 @@
+#Sat Oct 03 18:45:24 BST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/org.eclipse.pde.core.prefs
===================================================================
--- trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/org.eclipse.pde.core.prefs (rev 0)
+++ trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/.settings/org.eclipse.pde.core.prefs 2009-10-03 20:58:25 UTC (rev 37)
@@ -0,0 +1,5 @@
+#Sat Oct 03 18:45:24 BST 2009
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
Added: trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/META-INF/MANIFEST.MF 2009-10-03 20:58:25 UTC (rev 37)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Boss SAVARA Tools WSDL Tests Plug-in
+Bundle-SymbolicName: org.jboss.savara.tools.wsdl.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.savara.tools.wsdl.tests.osgi.Activator
+Bundle-Vendor: www.jboss.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.osgi.framework;version="1.3.0"
+Require-Bundle: org.scribble.contract.model;bundle-version="0.1.0",
+ org.jboss.savara.tools.wsdl;bundle-version="1.0.0",
+ org.junit,
+ org.scribble.core;bundle-version="0.1.0"
Added: trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/build.properties
===================================================================
--- trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/build.properties (rev 0)
+++ trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/build.properties 2009-10-03 20:58:25 UTC (rev 37)
@@ -0,0 +1,4 @@
+source.. = src/java/
+output.. = classes/
+bin.includes = META-INF/,\
+ .
Added: trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java
===================================================================
--- trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java (rev 0)
+++ trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java 2009-10-03 20:58:25 UTC (rev 37)
@@ -0,0 +1,312 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.wsdl.tests;
+
+import org.jboss.savara.tools.wsdl.WSDLGenerator;
+import org.scribble.contract.model.*;
+import org.scribble.model.TypeReference;
+
+import junit.framework.TestCase;
+
+public class WSDLGeneratorTest extends TestCase {
+
+ private static final String TEST_TYPE_NS = "testTypeNS";
+ private static final String TEST_TYPE_LP = "testTypeLP";
+ private static final String TEST_NAME_SPACE = "testNameSpace";
+ private static final String TEST_NAME = "testName";
+
+ public void testDefnNameAndNamespace() {
+
+ Contract c=new Contract();
+
+ c.setName(TEST_NAME);
+ c.setNamespace(TEST_NAME_SPACE);
+
+ WSDLGenerator gen=new WSDLGenerator();
+
+ javax.wsdl.Definition defn=gen.generateDefinition(c);
+
+ if (defn == null) {
+ fail("Definition is null");
+ }
+
+ if (defn.getTargetNamespace() == null) {
+ fail("Target namespace not set");
+ }
+
+ if (TEST_NAME_SPACE.equals(defn.getTargetNamespace()) == false) {
+ fail("Target namespace not correct: "+defn.getTargetNamespace());
+ }
+
+ if (defn.getQName() == null) {
+ fail("QName not set");
+ }
+
+ if (defn.getQName().getLocalPart() == null) {
+ fail("QName localpart not set");
+ }
+
+ if (TEST_NAME.equals(defn.getQName().getLocalPart()) == false) {
+ fail("QName localpart not correct: "+defn.getQName().getLocalPart());
+ }
+ }
+
+ public void testPortTypeNameAndNamespace() {
+ javax.wsdl.Definition defn=null;
+ try {
+ javax.wsdl.factory.WSDLFactory fact=
+ javax.wsdl.factory.WSDLFactory.newInstance();
+
+ defn = fact.newDefinition();
+
+ } catch(Exception e) {
+ fail("Failed to get definition");
+ }
+
+ Interface src=new Interface();
+
+ src.setName(TEST_NAME);
+ src.setNamespace(TEST_NAME_SPACE);
+
+ WSDLGenerator gen=new WSDLGenerator();
+
+ javax.wsdl.PortType result=gen.generatePortType(defn, src);
+
+ if (result == null) {
+ fail("PortType is null");
+ }
+
+ if (result.getQName() == null) {
+ fail("QName not set");
+ }
+
+ if (result.getQName().getNamespaceURI() == null) {
+ fail("QName namespace not set");
+ }
+
+ if (TEST_NAME_SPACE.equals(result.getQName().getNamespaceURI()) == false) {
+ fail("Namespace not correct: "+result.getQName().getNamespaceURI());
+ }
+
+ if (result.getQName().getLocalPart() == null) {
+ fail("QName localpart not set");
+ }
+
+ if (TEST_NAME.equals(result.getQName().getLocalPart()) == false) {
+ fail("QName localpart not correct: "+result.getQName().getLocalPart());
+ }
+ }
+
+ public void testDefnWithPortTypes() {
+
+ Contract c=new Contract();
+
+ Interface i1=new Interface();
+ i1.setName("I1");
+
+ Interface i2=new Interface();
+ i2.setName("I2");
+
+ Interface i3=new Interface();
+ i3.setName("I3");
+
+ c.getInterfaces().add(i1);
+ c.getInterfaces().add(i2);
+ c.getInterfaces().add(i3);
+
+ WSDLGenerator gen=new WSDLGenerator();
+
+ javax.wsdl.Definition defn=gen.generateDefinition(c);
+
+ if (defn == null) {
+ fail("Definition is null");
+ }
+
+ if (defn.getPortTypes().size() != c.getInterfaces().size()) {
+ fail("Number of port types ("+defn.getPortTypes().size()+
+ ") does not match number of interfaces ("+
+ c.getInterfaces().size()+")");
+ }
+ }
+
+ public void testOperationOneWay() {
+ javax.wsdl.Definition defn=null;
+ try {
+ javax.wsdl.factory.WSDLFactory fact=
+ javax.wsdl.factory.WSDLFactory.newInstance();
+
+ defn = fact.newDefinition();
+
+ } catch(Exception e) {
+ fail("Failed to get definition");
+ }
+
+ OneWayRequestMEP src=new OneWayRequestMEP();
+
+ src.setOperation(TEST_NAME);
+
+ TypeReference ref=new TypeReference();
+ ref.setLocalpart(TEST_TYPE_LP);
+ ref.setNamespace(TEST_TYPE_NS);
+ src.getTypes().add(ref);
+
+ WSDLGenerator gen=new WSDLGenerator();
+
+ javax.wsdl.Operation result=gen.generateOperation(defn, src);
+
+ if (result == null) {
+ fail("Operation is null");
+ }
+
+ if (TEST_NAME.equals(result.getName()) == false) {
+ fail("Operation name mismatch: "+result.getName());
+ }
+
+ if (result.getInput() == null) {
+ fail("Input not set");
+ }
+
+ if (result.getOutput() != null) {
+ fail("Output should NOT be set");
+ }
+
+ if (result.getFaults().size() != 0) {
+ fail("Faults should NOT be defined");
+ }
+ }
+
+ public void testOperationReqRespFaults() {
+ javax.wsdl.Definition defn=null;
+ try {
+ javax.wsdl.factory.WSDLFactory fact=
+ javax.wsdl.factory.WSDLFactory.newInstance();
+
+ defn = fact.newDefinition();
+
+ } catch(Exception e) {
+ fail("Failed to get definition");
+ }
+
+ RequestResponseMEP src=new RequestResponseMEP();
+
+ src.setOperation(TEST_NAME);
+
+ TypeReference ref1=new TypeReference();
+ ref1.setLocalpart(TEST_TYPE_LP);
+ ref1.setNamespace(TEST_TYPE_NS);
+ src.getTypes().add(ref1);
+
+ TypeReference ref2=new TypeReference();
+ ref2.setLocalpart(TEST_TYPE_LP);
+ ref2.setNamespace(TEST_TYPE_NS);
+ src.getResponseTypes().add(ref2);
+
+ FaultDetails fd1=new FaultDetails();
+ fd1.setName("faultName1");
+
+ TypeReference ref3=new TypeReference();
+ ref3.setLocalpart(TEST_TYPE_LP);
+ ref3.setNamespace(TEST_TYPE_NS);
+ fd1.getTypes().add(ref3);
+
+ src.getFaultDetails().add(fd1);
+
+ FaultDetails fd2=new FaultDetails();
+ fd2.setName("faultName2");
+
+ TypeReference ref4=new TypeReference();
+ ref4.setLocalpart(TEST_TYPE_LP);
+ ref4.setNamespace(TEST_TYPE_NS);
+ fd2.getTypes().add(ref4);
+
+ src.getFaultDetails().add(fd2);
+
+ WSDLGenerator gen=new WSDLGenerator();
+
+ javax.wsdl.Operation result=gen.generateOperation(defn, src);
+
+ if (result == null) {
+ fail("Operation is null");
+ }
+
+ if (TEST_NAME.equals(result.getName()) == false) {
+ fail("Operation name mismatch: "+result.getName());
+ }
+
+ if (result.getInput() == null) {
+ fail("Input not set");
+ }
+
+ if (result.getOutput() == null) {
+ fail("Output not set");
+ }
+
+ if (result.getFaults().size() != src.getFaultDetails().size()) {
+ fail("Faults number ("+result.getFaults().size()+
+ ") does not match contract ("+src.getFaultDetails().size()+")");
+ }
+ }
+
+ public void testMessage() {
+ javax.wsdl.Definition defn=null;
+ try {
+ javax.wsdl.factory.WSDLFactory fact=
+ javax.wsdl.factory.WSDLFactory.newInstance();
+
+ defn = fact.newDefinition();
+
+ } catch(Exception e) {
+ fail("Failed to get definition");
+ }
+
+ TypeReference src=new TypeReference();
+ src.setLocalpart(TEST_TYPE_LP);
+ src.setNamespace(TEST_TYPE_NS);
+
+ java.util.List<TypeReference> refs=new java.util.Vector<TypeReference>();
+ refs.add(src);
+
+ WSDLGenerator gen=new WSDLGenerator();
+
+ javax.wsdl.Message result=gen.generateMessage(defn, refs);
+
+ if (result == null) {
+ fail("Message is null");
+ }
+
+ if (result.getQName() == null) {
+ fail("QName not set");
+ }
+
+ if (result.getQName().getLocalPart() == null) {
+ fail("QName localpart not set");
+ }
+
+ if (TEST_TYPE_LP.equals(result.getQName().getLocalPart()) == false) {
+ fail("QName localpart not correct: "+result.getQName().getLocalPart());
+ }
+
+ if (result.getQName().getNamespaceURI() == null) {
+ fail("QName namespace not set");
+ }
+
+ if (TEST_TYPE_NS.equals(result.getQName().getNamespaceURI()) == false) {
+ fail("QName namespace not correct: "+result.getQName().getNamespaceURI());
+ }
+ }
+}
Added: trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/osgi/Activator.java
===================================================================
--- trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/osgi/Activator.java (rev 0)
+++ trunk/tools/eclipse/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/osgi/Activator.java 2009-10-03 20:58:25 UTC (rev 37)
@@ -0,0 +1,22 @@
+package org.jboss.savara.tools.wsdl.tests.osgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
More information about the savara-commits
mailing list