Author: alessio.soldano(a)jboss.com
Date: 2009-01-21 13:53:57 -0500 (Wed, 21 Jan 2009)
New Revision: 9086
Added:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBeanMetro.java
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomAdapter.java
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomBean.java
Modified:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBean.java
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java
Log:
[JBWS-2451] Adding testcase for @XmlJavaTypeAdapter
[JBWS-2479] skipping @XmlJavaTypeAdapter whit Metro
Modified:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBean.java
===================================================================
---
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBean.java 2009-01-21
18:52:15 UTC (rev 9085)
+++
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBean.java 2009-01-21
18:53:57 UTC (rev 9086)
@@ -28,6 +28,7 @@
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@WebService(targetNamespace = "http://foo.bar.com/calculator")
public class CalculatorBean
@@ -59,4 +60,11 @@
{
return list;
}
+
+ @WebMethod
+ @XmlJavaTypeAdapter(CustomAdapter.class)
+ public CustomBean processCustom((a)XmlJavaTypeAdapter(CustomAdapter.class) CustomBean
bean)
+ {
+ return bean;
+ }
}
Added:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBeanMetro.java
===================================================================
---
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBeanMetro.java
(rev 0)
+++
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBeanMetro.java 2009-01-21
18:53:57 UTC (rev 9086)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.smoke.tools;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlList;
+
+@WebService(targetNamespace = "http://foo.bar.com/calculator",
serviceName="CalculatorBeanService")
+public class CalculatorBeanMetro
+{
+ @WebMethod
+ public int add(int a, int b)
+ {
+ return a+b;
+ }
+
+ @WebMethod
+ public int subtract(int a, int b)
+ {
+ return a-b;
+ }
+
+ @WebMethod
+ public Set<Integer> getKeys(HashMap<Integer, String> map)
+ {
+ if (map != null)
+ return map.keySet();
+ else
+ return null;
+ }
+
+ @WebMethod
+ @XmlList
+ public List<String> processList(@XmlList List<String> list)
+ {
+ return list;
+ }
+}
Property changes on:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CalculatorBeanMetro.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomAdapter.java
===================================================================
---
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomAdapter.java
(rev 0)
+++
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomAdapter.java 2009-01-21
18:53:57 UTC (rev 9086)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.smoke.tools;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+public class CustomAdapter extends XmlAdapter<String, CustomBean>
+{
+
+ @Override
+ public String marshal(CustomBean v) throws Exception
+ {
+ return v.getFistAttribute() + "-" + v.getSecondAttribute();
+ }
+
+ @Override
+ public CustomBean unmarshal(String v) throws Exception
+ {
+ CustomBean b = new CustomBean();
+ b.setFistAttribute(v.substring(0, v.indexOf('-')));
+ b.setSecondAttribute(Long.valueOf(v.substring(v.indexOf('-') + 1)));
+ return b;
+ }
+
+}
Property changes on:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomBean.java
===================================================================
---
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomBean.java
(rev 0)
+++
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomBean.java 2009-01-21
18:53:57 UTC (rev 9086)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.smoke.tools;
+
+public class CustomBean
+{
+ private String fistAttribute;
+ private Long secondAttribute;
+
+ public String getFistAttribute()
+ {
+ return fistAttribute;
+ }
+
+ public void setFistAttribute(String fistAttribute)
+ {
+ this.fistAttribute = fistAttribute;
+ }
+
+ public Long getSecondAttribute()
+ {
+ return secondAttribute;
+ }
+
+ public void setSecondAttribute(Long secondAttribute)
+ {
+ this.secondAttribute = secondAttribute;
+ }
+}
Property changes on:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/CustomBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java
===================================================================
---
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java 2009-01-21
18:52:15 UTC (rev 9085)
+++
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java 2009-01-21
18:53:57 UTC (rev 9086)
@@ -28,6 +28,7 @@
import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
@@ -156,6 +157,17 @@
responseWrapper =
loader.loadClass("org.jboss.test.ws.jaxws.smoke.tools.jaxws.ProcessListResponse");
XmlList xmlList = (XmlList)
responseWrapper.getDeclaredField("_return").getAnnotation(XmlList.class);
assertNotNull("@XmlList missing from response wrapper's _return
field", xmlList);
+ if (!isIntegrationMetro())
+ {
+ responseWrapper =
loader.loadClass("org.jboss.test.ws.jaxws.smoke.tools.jaxws.ProcessCustomResponse");
+ XmlJavaTypeAdapter xmlJavaTypeAdapter = (XmlJavaTypeAdapter)
responseWrapper.getDeclaredField("_return").getAnnotation(XmlJavaTypeAdapter.class);
+ assertNotNull("@XmlJavaTypeAdapter missing from response wrapper's
_return field", xmlJavaTypeAdapter);
+ assertEquals("org.jboss.test.ws.jaxws.smoke.tools.CustomAdapter",
xmlJavaTypeAdapter.value().getName());
+ }
+ else
+ {
+ System.out.println("FIXME [JBWS-2479] @XmlJavaTypeAdapter on SEI causes
exception");
+ }
}
/**
@@ -271,6 +283,8 @@
{
//provider.setGenerateSource(true);
provider.setOutputDirectory(outputDirectory);
- provider.provide(CalculatorBean.class);
+ //JBWS-2479: using different beans because the whole smoke tools test is supposed
to be run for every stack
+ //and we can't afford excluding it for Metro just because of JBWS-2479
+ provider.provide(isIntegrationMetro() ? CalculatorBeanMetro.class :
CalculatorBean.class);
}
}