[jbossws-commits] JBossWS SVN: r1879 - in branches/dlofthouse/JBWS-1260: jbossws-tests/src/main/java/org/jboss/test/ws/tools/validation and 1 other directory.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Tue Jan 9 14:26:44 EST 2007
Author: darran.lofthouse at jboss.com
Date: 2007-01-09 14:26:38 -0500 (Tue, 09 Jan 2007)
New Revision: 1879
Modified:
branches/dlofthouse/JBWS-1260/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
branches/dlofthouse/JBWS-1260/jbossws-tests/src/main/java/org/jboss/test/ws/tools/validation/JaxrpcMappingValidator.java
Log:
JBWS-1260 - Completed updates for mappings.
Modified: branches/dlofthouse/JBWS-1260/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
===================================================================
--- branches/dlofthouse/JBWS-1260/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2007-01-09 18:43:56 UTC (rev 1878)
+++ branches/dlofthouse/JBWS-1260/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2007-01-09 19:26:38 UTC (rev 1879)
@@ -378,12 +378,12 @@
if (isDocStyle())
{
XSTypeDefinition xt = getXSType(input);
- addJavaXMLTypeMap(xt, input.getElement().getLocalPart(), "", jwm, false);
+ addJavaXMLTypeMap(xt, input.getElement().getLocalPart(), "", "", jwm, !isDocStyle());
}
else
{
for (WSDLRPCPart part : input.getChildParts())
- addJavaXMLTypeMap(getXSType(part.getType()), "", "", jwm, true);
+ addJavaXMLTypeMap(getXSType(part.getType()), input.getElement().getLocalPart(), "", "", jwm, true);
}
}
@@ -392,12 +392,12 @@
if (isDocStyle())
{
XSTypeDefinition xt = getXSType(output);
- addJavaXMLTypeMap(xt, output.getElement().getLocalPart(), "", jwm, false);
+ addJavaXMLTypeMap(xt, output.getElement().getLocalPart(), "", "", jwm, false);
}
else
{
for (WSDLRPCPart part : output.getChildParts())
- addJavaXMLTypeMap(getXSType(part.getType()), "", "", jwm, true);
+ addJavaXMLTypeMap(getXSType(part.getType()), output.getElement().getLocalPart(), "", "", jwm, true);
}
}
@@ -409,7 +409,7 @@
WSDLTypes types = wsdlDefinitions.getWsdlTypes();
JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
- addJavaXMLTypeMap(xt, xmlName.getLocalPart(), "", jwm, true);
+ addJavaXMLTypeMap(xt, xmlName.getLocalPart(), "", "", jwm, true);
ExceptionMapping exceptionMapping = new ExceptionMapping(jwm);
exceptionMapping.setExceptionType(getJavaTypeAsString(null, xmlType, false, true));
@@ -596,7 +596,7 @@
return xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
}
- private void addJavaXMLTypeMap(XSTypeDefinition xt, String name, String containingElement, JavaWsdlMapping jwm, boolean skipWrapperArray)
+ private void addJavaXMLTypeMap(XSTypeDefinition xt, String name, String containingElement, String containingType, JavaWsdlMapping jwm, boolean skipWrapperArray)
{
JavaXmlTypeMapping jxtm = null;
@@ -626,7 +626,11 @@
if (localName == null)
{
javaType = getJavaTypeAsString(null, new QName(containingElement + name), false, true);
- localName = ">" + name;
+ StringBuilder temp = new StringBuilder();
+ if (containingType != null && containingType.length() > 0)
+ temp.append(">").append(containingType);
+ temp.append(">").append(name);
+ localName = temp.toString();
jxtm.setAnonymousTypeQName(new QName(xt.getNamespace(), localName, "typeNS"));
}
else
@@ -639,7 +643,7 @@
{
typeNamespace = xt.getNamespace();
}
-
+
if (registeredTypes.contains(javaType))
return;
@@ -659,7 +663,7 @@
XSSimpleTypeDefinition simple = xc.getSimpleType();
if (simple != null)
{
- addJavaXMLTypeMap(simple, xc.getName(), "", jwm, skipWrapperArray);
+ addJavaXMLTypeMap(simple, xc.getName(), "", "", jwm, skipWrapperArray);
}
// Add attributes
@@ -669,7 +673,7 @@
}
if (xm != null)
- addGroup(xm, jwm);
+ addGroup(xm, name, xc.getName(), jwm);
}
// Add enum simpleType support
@@ -704,7 +708,7 @@
XSAttributeUse obj = (XSAttributeUse)attributes.item(i);
XSAttributeDeclaration att = obj.getAttrDeclaration();
XSSimpleTypeDefinition simple = att.getTypeDefinition();
- addJavaXMLTypeMap(simple, "none", "", jxtm.getJavaWsdlMapping(), true);
+ addJavaXMLTypeMap(simple, "none", "", "", jxtm.getJavaWsdlMapping(), true);
VariableMapping vm = new VariableMapping(jxtm);
String name = att.getName();
vm.setXmlAttributeName(name);
@@ -714,7 +718,7 @@
}
}
- private void addGroup(XSModelGroup xm, JavaWsdlMapping jwm)
+ private void addGroup(XSModelGroup xm, String containingElement, String containingType, JavaWsdlMapping jwm)
{
XSObjectList xo = xm.getParticles();
int len = xo != null ? xo.getLength() : 0;
@@ -723,13 +727,14 @@
XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm();
if (xsterm instanceof XSModelGroup)
{
- addGroup((XSModelGroup)xsterm, jwm);
+ addGroup((XSModelGroup)xsterm, containingElement, containingType, jwm);
}
else if (xsterm instanceof XSElementDeclaration)
{
XSElementDeclaration xe = (XSElementDeclaration)xsterm;
XSTypeDefinition typeDefinition = xe.getTypeDefinition();
- addJavaXMLTypeMap(typeDefinition, xe.getName(), xe.getEnclosingCTDefinition().getName(), jwm, true);
+ //XSTypeDefinition xt, String name, String containingElement, JavaWsdlMapping jwm, boolean skipWrapperArray
+ addJavaXMLTypeMap(typeDefinition, xe.getName(), containingElement, containingType, jwm, !isDocStyle());
}
}
}
Modified: branches/dlofthouse/JBWS-1260/jbossws-tests/src/main/java/org/jboss/test/ws/tools/validation/JaxrpcMappingValidator.java
===================================================================
--- branches/dlofthouse/JBWS-1260/jbossws-tests/src/main/java/org/jboss/test/ws/tools/validation/JaxrpcMappingValidator.java 2007-01-09 18:43:56 UTC (rev 1878)
+++ branches/dlofthouse/JBWS-1260/jbossws-tests/src/main/java/org/jboss/test/ws/tools/validation/JaxrpcMappingValidator.java 2007-01-09 19:26:38 UTC (rev 1879)
@@ -201,11 +201,27 @@
throw new IllegalStateException("Length of VariableMapping[] do not match");
}
+ HashMap<String, VariableMapping> actualMappings = new HashMap<String, VariableMapping>(vm2.length);
for (int i = 0; i < len1; i++)
{
- bool = validateVariableMapping(vm1[i], vm2[i]);
+ VariableMapping current = vm2[i];
+ if (actualMappings.containsKey(current.getJavaVariableName()))
+ throw new IllegalStateException("Variable '" + current.getJavaVariableName() + "' mapped more than once!");
+
+ actualMappings.put(current.getJavaVariableName(), current);
+ }
+
+ for (int i = 0; i < len1; i++)
+ {
+ VariableMapping expected = vm1[i];
+ VariableMapping actual = actualMappings.get(expected.getJavaVariableName());
+
+ if (actual == null)
+ throw new IllegalStateException("Variable '" + expected.getJavaVariableName() + "' not found.");
+
+ bool = validateVariableMapping(expected, actual);
if (bool == false)
- throw new IllegalStateException("VariableMapping " + variableMappingToString(vm1[i]) + " does not match with " + variableMappingToString(vm2[i]));
+ throw new IllegalStateException("VariableMapping " + variableMappingToString(expected) + " does not match with " + variableMappingToString(actual));
}
return bool;
More information about the jbossws-commits
mailing list