Author: ips
Date: Wed Apr 6 09:30:48 2005
New Revision: 160309
URL: http://svn.apache.org/viewcvs?view=rev&rev=160309
Log:
latest mess
Modified:
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/util/XmlBeanUtils.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java?view=diff&r1=160308&r2=160309
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java Wed
Apr 6 09:30:48 2005
@@ -348,6 +348,7 @@
parentCursor.insertElement( getName( xBean ) );
parentCursor.toPrevSibling();
XmlObject childXBean = parentCursor.getObject();
+ xBean.newCursor().copyXmlContents( parentCursor );
parentCursor.dispose();
childXBean.set( xBean );
return childXBean;
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=160308&r2=160309
==============================================================================
---
incubator/apollo/trunk/src/test/org/apache/ws/util/XmlBeanUtilsTestCase.java
(original)
+++
incubator/apollo/trunk/src/test/org/apache/ws/util/XmlBeanUtilsTestCase.java
Wed Apr 6 09:30:48 2005
@@ -22,9 +22,11 @@
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlString;
+import
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
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.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.ResourcePropertyValueChangeNotificationDocument;
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;
@@ -64,6 +66,16 @@
public void testAddChildElement()
throws Exception
{
+ 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()
) );
+ XmlObject[] 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 );
+
final QName elemName = SushiPropertyQNames.IKA;
final String elemValue = "whatever";
final XmlObject xBean = XmlObject.Factory.parse(
@@ -72,9 +84,10 @@
">" );
// first test adding to an element that already has children...
XmlBeanUtils.addChildElement( m_propsDoc, xBean );
- XmlObject[] childElems = XmlBeanUtils.getChildElements( m_propsDoc,
elemName );
+ childElems = XmlBeanUtils.getChildElements( m_propsDoc, elemName );
assertEquals( 2, childElems.length );
assertTrue( childElems[1] instanceof XmlString );
+
// now test adding to a childless element...
EndpointReferenceDocument eprDoc =
EndpointReferenceDocument.Factory.newInstance();
EndpointReferenceType epr = eprDoc.addNewEndpointReference();
@@ -83,15 +96,6 @@
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 );
}
/**
@@ -177,6 +181,38 @@
public void testCopyXmlBean()
{
// TODO: write this test
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void testSet()
+ {
+ XmlString xString1 = XmlString.Factory.newInstance();
+ xString1.setStringValue( "one" );
+ XmlString xString2 = XmlString.Factory.newInstance();
+ xString2.setStringValue( "two" );
+ XmlCursor xmlCursor = xString1.newCursor();
+ xmlCursor.toPrevToken();
+ XmlObject object = xmlCursor.getObject();
+ xString1 = (XmlString) object.set( xString2 );
+ System.out.println( xString1 );
+ ResourcePropertyValueChangeNotificationDocument
resourcePropertyValueChangeNotificationDocument1 =
ResourcePropertyValueChangeNotificationDocument.Factory.newInstance();
+ ResourcePropertyValueChangeNotificationType
resourcePropertyValueChangeNotificationType1 =
resourcePropertyValueChangeNotificationDocument1.addNewResourcePropertyValueChangeNotification();
+ ResourcePropertyValueChangeNotificationType.OldValue oldValue1 =
resourcePropertyValueChangeNotificationType1.addNewOldValue();
+ oldValue1.newCursor().setTextValue( "one" );
+ System.out.println( resourcePropertyValueChangeNotificationDocument1 );
+ ResourcePropertyValueChangeNotificationType
resourcePropertyValueChangeNotificationType2 =
ResourcePropertyValueChangeNotificationType.Factory.newInstance();
+ ResourcePropertyValueChangeNotificationType.OldValue oldValue2 =
resourcePropertyValueChangeNotificationType2.addNewOldValue();
+ oldValue2.newCursor().setTextValue( "two" );
+ oldValue1 = (ResourcePropertyValueChangeNotificationType.OldValue)
oldValue1.set( oldValue2 );
+ System.out.println( resourcePropertyValueChangeNotificationDocument1 );
+ GetResourcePropertyDocument getResourcePropertyDoc1 =
GetResourcePropertyDocument.Factory.newInstance();
+ getResourcePropertyDoc1.setGetResourceProperty( new QName( "one" ) );
+ GetResourcePropertyDocument getResourcePropertyDoc2 =
GetResourcePropertyDocument.Factory.newInstance();
+ getResourcePropertyDoc2.setGetResourceProperty( new QName( "two" ) );
+ getResourcePropertyDoc1 = (GetResourcePropertyDocument)
getResourcePropertyDoc1.set( getResourcePropertyDoc2 );
+ System.out.println( getResourcePropertyDoc1 );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]