Author: ips
Date: Tue Apr 5 16:06:35 2005
New Revision: 160237
URL: http://svn.apache.org/viewcvs?view=rev&rev=160237
Log:
new assertion added for failure condition in XmlBeanUtils#addChildElement() -
currently fails; fix added to XmlBeanUtils#copyXmlBean()
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractSetResourcePropertiesPortType.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/XmlBeansResourcePropertyValueChangeEvent.java
incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
incubator/apollo/trunk/src/test/org/apache/ws/util/XmlBeanUtilsTestCase.java
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractSetResourcePropertiesPortType.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractSetResourcePropertiesPortType.java?view=diff&r1=160236&r2=160237
==============================================================================
---
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractSetResourcePropertiesPortType.java
(original)
+++
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/impl/AbstractSetResourcePropertiesPortType.java
Tue Apr 5 16:06:35 2005
@@ -196,7 +196,7 @@
}
Object[] oldValue = getValue( prop );
- // TODO: we might need to clone the oldValue elems, since we might be
destroying them when we call clear() below
+
try
{
prop.clear();
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/XmlBeansResourcePropertyValueChangeEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/XmlBeansResourcePropertyValueChangeEvent.java?view=diff&r1=160236&r2=160237
==============================================================================
---
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/XmlBeansResourcePropertyValueChangeEvent.java
(original)
+++
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/XmlBeansResourcePropertyValueChangeEvent.java
Tue Apr 5 16:06:35 2005
@@ -52,7 +52,7 @@
ResourcePropertyValueChangeNotificationType.NewValue newValueXBean =
propValueChangeNotifXBean.addNewNewValue();
if ( newValue != null )
{
- for ( int i = 0; i < oldValue.length; i++ )
+ for ( int i = 0; i < newValue.length; i++ )
{
XmlBeanUtils.addChildElement( newValueXBean, (XmlObject)
newValue[i] );
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java?view=diff&r1=160236&r2=160237
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java Tue
Apr 5 16:06:35 2005
@@ -338,8 +338,6 @@
{
parentXBean = getRootElement( parentXBean );
XmlCursor parentCursor = parentXBean.newCursor();
-
-
if ( parentCursor.toLastChild() )
{
parentCursor.toEndToken();
@@ -588,14 +586,12 @@
{
XmlCursor srcCursor = srcXBean.newCursor( );
- // create an object to copy to
- XmlObject destXBean = XmlObject.Factory.newInstance( );
-
- // setup a cursor to copy into
+ // create an object of the appropriate type to copy to
+ XmlObject destXBean = XmlObject.Factory.newInstance( new XmlOptions(
).setDocumentType( srcXBean.schemaType() ) );
XmlCursor destCursor = destXBean.newCursor( );
// move into the document
- destCursor.toStartDoc( ); // don't think this line is necessary
+ destCursor.toStartDoc( ); // TODO: I think doing this is wrong, since
it assumes the src xbean is a document
destCursor.toNextToken( );
// copy the xml into the new document
Modified:
incubator/apollo/trunk/src/test/org/apache/ws/util/XmlBeanUtilsTestCase.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/util/XmlBeanUtilsTestCase.java?view=diff&r1=160236&r2=160237
==============================================================================
---
incubator/apollo/trunk/src/test/org/apache/ws/util/XmlBeanUtilsTestCase.java
(original)
+++
incubator/apollo/trunk/src/test/org/apache/ws/util/XmlBeanUtilsTestCase.java
Tue Apr 5 16:06:35 2005
@@ -18,14 +18,16 @@
import org.apache.ws.resource.properties.AbstractResourcePropertiesTestCase;
import org.apache.ws.resource.properties.SushiPropertyQNames;
import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlString;
-import org.apache.xmlbeans.XmlCursor;
+import
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionDocument;
+import
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionType;
+import
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.ResourcePropertyValueChangeNotificationType;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.ReferencePropertiesType;
-import
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionDocument;
-import
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionType;
import javax.xml.namespace.QName;
@@ -81,6 +83,15 @@
childElems = XmlBeanUtils.getChildElements( refPropsType, elemName );
assertEquals( 1, childElems.length );
assertTrue( childElems[0] instanceof XmlString );
+ ResourcePropertyValueChangeNotificationType
resourcePropertyValueChangeNotificationType =
ResourcePropertyValueChangeNotificationType.Factory.newInstance();
+ ResourcePropertyValueChangeNotificationType.OldValue oldValue =
resourcePropertyValueChangeNotificationType.addNewOldValue();
+ XmlBeanUtils.addChildElement( oldValue, XmlObject.Factory.parse(
"<foo/>" ) );
+ System.out.println( oldValue.xmlText( new XmlOptions( ).setSaveOuter()
) );
+ childElems = XmlBeanUtils.getChildElements( oldValue, new QName( "foo"
) );
+ assertEquals( 1, childElems.length );
+ XmlObject fooElem = childElems[0];
+ childElems = XmlBeanUtils.getChildElements( fooElem, new QName( "foo"
) );
+ assertEquals( 0, childElems.length );
}
/**
@@ -147,7 +158,7 @@
}
/**
- * Test for [EMAIL PROTECTED]
XmlBeanUtils#setValueAsQName(org.apache.xmlbeans.XmlObject,
javax.xml.namespace.QName)}.
+ * Test for [EMAIL PROTECTED] XmlBeanUtils#setValueAsQName(XmlObject,
QName)}.
*/
public void testSetValueAsQName()
{
@@ -158,6 +169,14 @@
String prefix = xCursor.prefixForNamespace(
SushiPropertyQNames.AKAGI.getNamespaceURI() );
String value = xCursor.getTextValue();
assertEquals( prefix + ":" + SushiPropertyQNames.AKAGI.getLocalPart(),
value );
+ }
+
+ /**
+ * Test for [EMAIL PROTECTED] XmlBeanUtils#copyXmlBean(XmlObject)}.
+ */
+ public void testCopyXmlBean()
+ {
+ // TODO: write this test
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]