You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-commits@ws.apache.org by sc...@apache.org on 2005/08/02 18:30:44 UTC
svn commit: r227033 [26/27] - in /webservices/wsrf/trunk: ./
src/java/org/apache/ws/ src/java/org/apache/ws/addressing/
src/java/org/apache/ws/addressing/v2003_03/
src/java/org/apache/ws/addressing/v2004_08_10/
src/java/org/apache/ws/resource/ src/java...
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java Tue Aug 2 09:28:49 2005
@@ -1,153 +1,157 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.properties;
-
-import org.apache.ws.addressing.EndpointReference;
-import org.apache.ws.resource.PropertiesResource;
-import org.apache.ws.resource.Resource;
-import org.apache.ws.resource.lifetime.ResourceTerminationEvent;
-import org.apache.ws.resource.lifetime.ResourceTerminationListener;
-import org.apache.ws.resource.lifetime.impl.ResourceTerminationEventImpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Sal Campana
- */
-public class SushiResource
- implements Resource, PropertiesResource
-{
- /**
- * The resource ID of the instance.
- */
- public String m_id;
-
- /**
- * The ResourceProperty Set containing the resource props.
- */
- ResourcePropertySet m_propSet;
-
- /**
- * A list of termination listeners to be notified when the resource is terminated.
- */
- private List m_terminationListeners = new ArrayList();
-
- /** The EndpointReference for this resource **/
- protected EndpointReference m_endpointReference;
-
- /**
- * DOCUMENT_ME
- *
- * @param id DOCUMENT_ME
- */
- public void setID( Object id )
- {
- if ( m_id != null )
- {
- throw new IllegalStateException( "This resource's ID has already been set." );
- }
-
- try
- {
- m_id = (String) id;
- }
- catch ( ClassCastException cce )
- {
- throw new IllegalArgumentException( "Specified ID is not a String." );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public Object getID( )
- {
- return m_id;
- }
-
- public void destroy()
- {
- ResourceTerminationEvent rte = new ResourceTerminationEventImpl(getID(),"Job Destroyed");
- for (int i = 0; i < m_terminationListeners.size(); i++)
- {
- ResourceTerminationListener resourceTerminationListener = (ResourceTerminationListener) m_terminationListeners.get(i);
- resourceTerminationListener.terminationOccurred(rte);
- }
- }
-
- public void init()
- {
-
- }
-
-
-
- /**
- * Adds a listener to be invoked when the resource has been terminated.
- *
- * @param listener
- */
- public void addTerminationListener(ResourceTerminationListener listener)
- {
- m_terminationListeners.add(listener);
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param propSet DOCUMENT_ME
- */
- public void setResourcePropertySet( ResourcePropertySet propSet )
- {
- m_propSet = propSet;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public ResourcePropertySet getResourcePropertySet( )
- {
- return m_propSet;
- }
-
- /**
- * Returns the EndpointReference associated with this Resource.
- *
- * @return The Resource's EndpointReference or null if the EndpointReference has not been set.
- *
- * Note: It is the responsibility of the Resource creator to set the EndpointReference (i.e. ResourceHome impl)
- */
- public org.apache.ws.addressing.EndpointReference getEndpointReference()
- {
- return m_endpointReference;
- }
-
- /**
- * Sets the EndpointReference associated with this Resource.
- *
- * @param epr The EndpointReference for the Resource.
- */
- public void setEndpointReference(org.apache.ws.addressing.EndpointReference epr)
- {
- m_endpointReference = epr;
- }
-
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.properties;
+
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.resource.PropertiesResource;
+import org.apache.ws.resource.Resource;
+import org.apache.ws.resource.lifetime.ResourceTerminationEvent;
+import org.apache.ws.resource.lifetime.ResourceTerminationListener;
+import org.apache.ws.resource.lifetime.impl.ResourceTerminationEventImpl;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sal Campana
+ */
+public class SushiResource
+ implements Resource,
+ PropertiesResource
+{
+ /**
+ * The resource ID of the instance.
+ */
+ public String m_id;
+
+ /**
+ * The ResourceProperty Set containing the resource props.
+ */
+ ResourcePropertySet m_propSet;
+
+ /**
+ * A list of termination listeners to be notified when the resource is terminated.
+ */
+ private List m_terminationListeners = new ArrayList( );
+
+ /** The EndpointReference for this resource **/
+ protected EndpointReference m_endpointReference;
+
+ /**
+ * Sets the EndpointReference associated with this Resource.
+ *
+ * @param epr The EndpointReference for the Resource.
+ */
+ public void setEndpointReference( org.apache.ws.addressing.EndpointReference epr )
+ {
+ m_endpointReference = epr;
+ }
+
+ /**
+ * Returns the EndpointReference associated with this Resource.
+ *
+ * @return The Resource's EndpointReference or null if the EndpointReference has not been set.
+ *
+ * Note: It is the responsibility of the Resource creator to set the EndpointReference (i.e. ResourceHome impl)
+ */
+ public org.apache.ws.addressing.EndpointReference getEndpointReference( )
+ {
+ return m_endpointReference;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param id DOCUMENT_ME
+ */
+ public void setID( Object id )
+ {
+ if ( m_id != null )
+ {
+ throw new IllegalStateException( "This resource's ID has already been set." );
+ }
+
+ try
+ {
+ m_id = (String) id;
+ }
+ catch ( ClassCastException cce )
+ {
+ throw new IllegalArgumentException( "Specified ID is not a String." );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Object getID( )
+ {
+ return m_id;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propSet DOCUMENT_ME
+ */
+ public void setResourcePropertySet( ResourcePropertySet propSet )
+ {
+ m_propSet = propSet;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourcePropertySet getResourcePropertySet( )
+ {
+ return m_propSet;
+ }
+
+ /**
+ * Adds a listener to be invoked when the resource has been terminated.
+ *
+ * @param listener
+ */
+ public void addTerminationListener( ResourceTerminationListener listener )
+ {
+ m_terminationListeners.add( listener );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void destroy( )
+ {
+ ResourceTerminationEvent rte = new ResourceTerminationEventImpl( getID( ),
+ "Job Destroyed" );
+ for ( int i = 0; i < m_terminationListeners.size( ); i++ )
+ {
+ ResourceTerminationListener resourceTerminationListener =
+ (ResourceTerminationListener) m_terminationListeners.get( i );
+ resourceTerminationListener.terminationOccurred( rte );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void init( )
+ {
+ }
}
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResourceContext.java Tue Aug 2 09:28:49 2005
@@ -1,138 +1,220 @@
-package org.apache.ws.resource.properties;
-
-import org.apache.ws.resource.Resource;
-import org.apache.ws.resource.ResourceContext;
-import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.ResourceHome;
-
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URI;
-import java.util.Iterator;
-
-/**
- * Resource context that serves as part of the unit test fixture.
- *
- * @author Sal Campana
- * @author Ian Springer
- */
-public class SushiResourceContext implements ResourceContext
-{
-
- ResourceHome m_home;
- private Resource m_resource;
-
- private static final String SERVICE_NAME = "sushi";
- public static final String ID = "1212";
-
- /**
- * Creates a new {@link SushiResourceContext} object.
- */
- public SushiResourceContext() throws Exception
- {
- this( true );
- }
-
- /**
- * Creates a new {@link SushiResourceContext} object.
- */
- public SushiResourceContext( boolean isOpenContent ) throws Exception
- {
- m_home = new SushiHome( isOpenContent );
- m_resource = m_home.find( SushiResourceContext.ID );
- }
-
- public ResourceHome getResourceHome()
- {
- return m_home;
- }
-
- public SOAPMessage getSOAPMessage()
- {
- try
- {
- return MessageFactory.newInstance().createMessage();
- }
- catch ( SOAPException soape )
- {
- throw new JAXRPCException( soape );
- }
- }
-
- public String getServiceName()
- {
- return SERVICE_NAME;
- }
-
- public URL getServiceURL()
- {
- try
- {
- return new URL( "http://localhost:8080/muse/" + SERVICE_NAME );
- }
- catch ( MalformedURLException murle )
- {
- murle.printStackTrace();
- }
- return null;
- }
-
- /**
- * Gets the base URL from which service urls are based.
- *
- * @return The String representation of the base url
- */
- public String getBaseURL()
- {
- return null;
- }
-
- public boolean containsProperty( String name )
- {
- return false;
- }
-
- public void removeProperty( String name )
- {
-
- }
-
- /**
- * Returns the value of the WS-Addressing Action header
- *
- * @return WS-Addressing Action Header value
- */
- public String getRequestAction()
- {
- return null;
- }
-
- public void setProperty( String name, Object value )
- {
- }
-
- public Object getProperty( String name )
- {
- return null;
- }
-
- public Iterator getPropertyNames()
- {
- return null;
- }
-
- public Resource getResource() throws ResourceException
- {
- return m_resource;
- }
-
- public void setResponseAction( URI action )
- {
- return;
- }
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.properties;
+
+import org.apache.ws.resource.Resource;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.ResourceHome;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Iterator;
+
+/**
+ * Resource context that serves as part of the unit test fixture.
+ *
+ * @author Sal Campana
+ * @author Ian Springer
+ */
+public class SushiResourceContext
+ implements ResourceContext
+{
+ private static final String SERVICE_NAME = "sushi";
+
+ /** DOCUMENT_ME */
+ public static final String ID = "1212";
+
+ /** DOCUMENT_ME */
+ ResourceHome m_home;
+ private Resource m_resource;
+
+ /**
+ * Creates a new {@link SushiResourceContext} object.
+ */
+ public SushiResourceContext( )
+ throws Exception
+ {
+ this( true );
+ }
+
+ /**
+ * Creates a new {@link SushiResourceContext} object.
+ */
+ public SushiResourceContext( boolean isOpenContent )
+ throws Exception
+ {
+ m_home = new SushiHome( isOpenContent );
+ m_resource = m_home.find( SushiResourceContext.ID );
+ }
+
+ /**
+ * Gets the base URL from which service urls are based.
+ *
+ * @return The String representation of the base url
+ */
+ public String getBaseURL( )
+ {
+ return null;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ * @param value DOCUMENT_ME
+ */
+ public void setProperty( String name,
+ Object value )
+ {
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Object getProperty( String name )
+ {
+ return null;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Iterator getPropertyNames( )
+ {
+ return null;
+ }
+
+ /**
+ * Returns the value of the WS-Addressing Action header
+ *
+ * @return WS-Addressing Action Header value
+ */
+ public String getRequestAction( )
+ {
+ return null;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws ResourceException DOCUMENT_ME
+ */
+ public Resource getResource( )
+ throws ResourceException
+ {
+ return m_resource;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceHome getResourceHome( )
+ {
+ return m_home;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param action DOCUMENT_ME
+ */
+ public void setResponseAction( URI action )
+ {
+ return;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public SOAPMessage getSOAPMessage( )
+ {
+ try
+ {
+ return MessageFactory.newInstance( ).createMessage( );
+ }
+ catch ( SOAPException soape )
+ {
+ throw new JAXRPCException( soape );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceName( )
+ {
+ return SERVICE_NAME;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public URL getServiceURL( )
+ {
+ try
+ {
+ return new URL( "http://localhost:8080/muse/" + SERVICE_NAME );
+ }
+ catch ( MalformedURLException murle )
+ {
+ murle.printStackTrace( );
+ }
+
+ return null;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public boolean containsProperty( String name )
+ {
+ return false;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ */
+ public void removeProperty( String name )
+ {
+ }
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiService.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiService.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiService.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiService.java Tue Aug 2 09:28:49 2005
@@ -1,48 +1,48 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.properties;
-
-import org.apache.ws.resource.ResourceContext;
-
-/**
- * @author Sal Campana
- */
-public class SushiService
- extends AbstractSushiService
-{
- private ResourceContext m_resourceContext;
-
- /**
- * Creates a new {@link SushiService} object.
- *
- * @param resourceContext DOCUMENT_ME
- */
- public SushiService( ResourceContext resourceContext )
- {
- m_resourceContext = resourceContext;
- init( );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public ResourceContext getResourceContext( )
- {
- return m_resourceContext;
- }
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.properties;
+
+import org.apache.ws.resource.ResourceContext;
+
+/**
+ * @author Sal Campana
+ */
+public class SushiService
+ extends AbstractSushiService
+{
+ private ResourceContext m_resourceContext;
+
+ /**
+ * Creates a new {@link SushiService} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public SushiService( ResourceContext resourceContext )
+ {
+ m_resourceContext = resourceContext;
+ init( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceContext getResourceContext( )
+ {
+ return m_resourceContext;
+ }
}
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/ThrowsCallback.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/ThrowsCallback.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/ThrowsCallback.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/ThrowsCallback.java Tue Aug 2 09:28:49 2005
@@ -1,47 +1,89 @@
-package org.apache.ws.resource.properties;
-
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.ws.resource.properties.impl.CallbackFailedException;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlInt;
-
-import javax.xml.namespace.QName;
-
-/**
- * @author Sal Campana
- */
-public class ThrowsCallback implements SetResourcePropertyCallback
-{
-
-
- public ResourceProperty refreshProperty( ResourceProperty prop ) throws CallbackFailedException
- {
- Exception e = new Exception("Do we see this message?");
- throw new CallbackFailedException("Refresh Failed!", e);
- }
-
- private QName getPropName( ResourceProperty prop )
- {
- return prop.getMetaData().getName();
- }
-
- public void deleteProperty( QName propQName ) throws CallbackFailedException
- {
- Exception e = new Exception("Do we see this message?");
- throw new CallbackFailedException("Delete Failed!", e);
- }
-
- public void insertProperty( Object[] prop ) throws CallbackFailedException
- {
- Exception e = new Exception("Do we see this message?");
- throw new CallbackFailedException("Insert Failed!", e);
- }
-
- public void updateProperty( Object[] prop ) throws CallbackFailedException
- {
- Exception e = new Exception("Do we see this message?");
- throw new CallbackFailedException("Update Failed!", e);
- }
-
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.properties;
+
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import javax.xml.namespace.QName;
+
+/**
+ * @author Sal Campana
+ */
+public class ThrowsCallback
+ implements SetResourcePropertyCallback
+{
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propQName DOCUMENT_ME
+ *
+ * @throws CallbackFailedException DOCUMENT_ME
+ */
+ public void deleteProperty( QName propQName )
+ throws CallbackFailedException
+ {
+ Exception e = new Exception( "Do we see this message?" );
+ throw new CallbackFailedException( "Delete Failed!", e );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param prop DOCUMENT_ME
+ *
+ * @throws CallbackFailedException DOCUMENT_ME
+ */
+ public void insertProperty( Object[] prop )
+ throws CallbackFailedException
+ {
+ Exception e = new Exception( "Do we see this message?" );
+ throw new CallbackFailedException( "Insert Failed!", e );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param prop DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws CallbackFailedException DOCUMENT_ME
+ */
+ public ResourceProperty refreshProperty( ResourceProperty prop )
+ throws CallbackFailedException
+ {
+ Exception e = new Exception( "Do we see this message?" );
+ throw new CallbackFailedException( "Refresh Failed!", e );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param prop DOCUMENT_ME
+ *
+ * @throws CallbackFailedException DOCUMENT_ME
+ */
+ public void updateProperty( Object[] prop )
+ throws CallbackFailedException
+ {
+ Exception e = new Exception( "Do we see this message?" );
+ throw new CallbackFailedException( "Update Failed!", e );
+ }
+
+ private QName getPropName( ResourceProperty prop )
+ {
+ return prop.getMetaData( ).getName( );
+ }
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetMetaDataTestCase.java Tue Aug 2 09:28:49 2005
@@ -20,8 +20,8 @@
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.apache.ws.resource.properties.AbstractResourcePropertiesTestCase;
-import org.apache.ws.resource.properties.SushiPropertyQNames;
import org.apache.ws.resource.properties.ResourcePropertyMetaData;
+import org.apache.ws.resource.properties.SushiPropertyQNames;
/**
* Test case for {@link XmlBeansResourcePropertySet}.
@@ -31,7 +31,6 @@
public class XmlBeansResourcePropertySetMetaDataTestCase
extends AbstractResourcePropertiesTestCase
{
-
/**
* DOCUMENT_ME
*
@@ -40,7 +39,7 @@
public void setUp( )
throws Exception
{
- initResourcePropsDoc();
+ initResourcePropsDoc( );
}
/**
@@ -76,7 +75,7 @@
throws Exception
{
assertEquals( SushiPropertyQNames.OPEN_SUSHI_PROPERTIES,
- m_resourcePropSet.getMetaData().getName( ) );
+ m_resourcePropSet.getMetaData( ).getName( ) );
}
/**
@@ -84,16 +83,10 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testPropertyMetaDatas( )
+ public void testIsOpenContent( )
throws Exception
{
- ResourcePropertyMetaData[] propMetaDatas = m_resourcePropSet.getMetaData().getPropertyMetaDatas();
- assertEquals( 9, propMetaDatas.length );
- for ( int i = 0; i < propMetaDatas.length; i++ )
- {
- boolean expectedReadOnly = propMetaDatas[i].getName().equals( SushiPropertyQNames.OHTORO );
- assertEquals( expectedReadOnly, propMetaDatas[i].isReadOnly() );
- }
+ assertTrue( m_resourcePropSet.getMetaData( ).isOpenContent( ) );
}
/**
@@ -101,9 +94,16 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testIsOpenContent( )
+ public void testPropertyMetaDatas( )
throws Exception
{
- assertTrue( m_resourcePropSet.getMetaData().isOpenContent( ) );
+ ResourcePropertyMetaData[] propMetaDatas = m_resourcePropSet.getMetaData( ).getPropertyMetaDatas( );
+ assertEquals( 9, propMetaDatas.length );
+ for ( int i = 0; i < propMetaDatas.length; i++ )
+ {
+ boolean expectedReadOnly = propMetaDatas[i].getName( ).equals( SushiPropertyQNames.OHTORO );
+ assertEquals( expectedReadOnly,
+ propMetaDatas[i].isReadOnly( ) );
+ }
}
}
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetTestCase.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetTestCase.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertySetTestCase.java Tue Aug 2 09:28:49 2005
@@ -25,7 +25,6 @@
import org.apache.ws.util.XmlBeanUtils;
import org.apache.xmlbeans.XmlObject;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument;
-
import javax.xml.namespace.QName;
import java.util.Iterator;
@@ -35,20 +34,20 @@
* @author Ian P. Springer
*/
public class XmlBeansResourcePropertySetTestCase
- extends AbstractResourcePropertiesTestCase
+ extends AbstractResourcePropertiesTestCase
{
-
- private static final QName EPR_TYPE_QNAME = new QName( "http://schemas.xmlsoap.org/ws/2003/03/addressing", "EndpointReference", "wsa" );
+ private static final QName EPR_TYPE_QNAME =
+ new QName( "http://schemas.xmlsoap.org/ws/2003/03/addressing", "EndpointReference", "wsa" );
/**
* DOCUMENT_ME
*
* @throws Exception DOCUMENT_ME
*/
- public void setUp()
- throws Exception
+ public void setUp( )
+ throws Exception
{
- initResourcePropsDoc();
+ initResourcePropsDoc( );
}
/**
@@ -58,8 +57,8 @@
*/
public static void main( String[] args )
{
- TestResult result = TestRunner.run( XmlBeansResourcePropertySetTestCase.suite() );
- if ( !result.wasSuccessful() )
+ TestResult result = TestRunner.run( XmlBeansResourcePropertySetTestCase.suite( ) );
+ if ( !result.wasSuccessful( ) )
{
System.exit( 1 );
}
@@ -70,7 +69,7 @@
*
* @return DOCUMENT_ME
*/
- public static Test suite()
+ public static Test suite( )
{
return new TestSuite( XmlBeansResourcePropertySetTestCase.class );
}
@@ -80,16 +79,17 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testAdd()
- throws Exception
+ public void testAdd( )
+ throws Exception
{
XmlBeansResourcePropertyMetaData metaData =
- new XmlBeansResourcePropertyMetaData( EndpointReferenceDocument.type.getElementProperty( EPR_TYPE_QNAME ), false );
+ new XmlBeansResourcePropertyMetaData( EndpointReferenceDocument.type.getElementProperty( EPR_TYPE_QNAME ),
+ false );
m_resourcePropSet.add( metaData.create( m_resourcePropSet ) );
ResourceProperty resourceProp = m_resourcePropSet.get( EPR_TYPE_QNAME );
assertNotNull( resourceProp );
assertEquals( EPR_TYPE_QNAME,
- resourceProp.getMetaData().getName() );
+ resourceProp.getMetaData( ).getName( ) );
}
/**
@@ -97,15 +97,16 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testCreate()
- throws Exception
+ public void testCreate( )
+ throws Exception
{
XmlBeansResourcePropertyMetaData metaData =
- new XmlBeansResourcePropertyMetaData( EndpointReferenceDocument.type.getElementProperty( EPR_TYPE_QNAME ), false );
- ResourceProperty resourceProp = metaData.create( m_resourcePropSet );
+ new XmlBeansResourcePropertyMetaData( EndpointReferenceDocument.type.getElementProperty( EPR_TYPE_QNAME ),
+ false );
+ ResourceProperty resourceProp = metaData.create( m_resourcePropSet );
assertNotNull( resourceProp );
assertEquals( EPR_TYPE_QNAME,
- resourceProp.getMetaData().getName() );
+ resourceProp.getMetaData( ).getName( ) );
}
/**
@@ -113,14 +114,17 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testGet()
- throws Exception
+ public void testGet( )
+ throws Exception
{
ResourceProperty resourceProp = m_resourcePropSet.get( SushiPropertyQNames.AKAGI );
- assertEquals( 1, resourceProp.size() );
- assertEquals( SushiPropertyQNames.AKAGI, resourceProp.getMetaData().getName() );
+ assertEquals( 1,
+ resourceProp.size( ) );
+ assertEquals( SushiPropertyQNames.AKAGI,
+ resourceProp.getMetaData( ).getName( ) );
XmlObject propElemXBean = (XmlObject) resourceProp.get( 0 );
- assertEquals( "24", XmlBeanUtils.getValue( propElemXBean ) );
+ assertEquals( "24",
+ XmlBeanUtils.getValue( propElemXBean ) );
}
/**
@@ -128,16 +132,17 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testIterator()
- throws Exception
+ public void testIterator( )
+ throws Exception
{
- Iterator iter = m_resourcePropSet.iterator();
- int i = 0;
- while ( iter.hasNext() )
+ Iterator iter = m_resourcePropSet.iterator( );
+ int i = 0;
+ while ( iter.hasNext( ) )
{
- assertTrue( iter.next() instanceof ResourceProperty );
+ assertTrue( iter.next( ) instanceof ResourceProperty );
i++;
}
+
assertEquals( 9, i );
}
@@ -146,11 +151,12 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testRemove()
- throws Exception
+ public void testRemove( )
+ throws Exception
{
ResourceProperty resourceProp = m_resourcePropSet.get( SushiPropertyQNames.IKA );
- assertEquals( 1, resourceProp.size() );
+ assertEquals( 1,
+ resourceProp.size( ) );
m_resourcePropSet.remove( SushiPropertyQNames.IKA );
resourceProp = m_resourcePropSet.get( SushiPropertyQNames.IKA );
assertNull( resourceProp );
@@ -161,8 +167,8 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testToElement()
- throws Exception
+ public void testToElement( )
+ throws Exception
{
// TODO (low priority): implement
}
@@ -172,10 +178,9 @@
*
* @throws Exception DOCUMENT_ME
*/
- public void testToSOAPElement()
- throws Exception
+ public void testToSOAPElement( )
+ throws Exception
{
//TODO (low priority): implement
}
-
-}
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertyTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertyTestCase.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertyTestCase.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/impl/XmlBeansResourcePropertyTestCase.java Tue Aug 2 09:28:49 2005
@@ -34,16 +34,15 @@
* @author Ian P. Springer
*/
public class XmlBeansResourcePropertyTestCase
- extends AbstractResourcePropertiesTestCase
+ extends AbstractResourcePropertiesTestCase
{
-
/**
* @throws Exception
*/
- public void setUp()
- throws Exception
+ public void setUp( )
+ throws Exception
{
- initResourcePropsDoc();
+ initResourcePropsDoc( );
}
/**
@@ -53,8 +52,8 @@
*/
public static void main( String[] args )
{
- TestResult result = TestRunner.run( XmlBeansResourcePropertyTestCase.suite() );
- if ( !result.wasSuccessful() )
+ TestResult result = TestRunner.run( XmlBeansResourcePropertyTestCase.suite( ) );
+ if ( !result.wasSuccessful( ) )
{
System.exit( 1 );
}
@@ -65,7 +64,7 @@
*
* @return DOCUMENT_ME
*/
- public static Test suite()
+ public static Test suite( )
{
return new TestSuite( XmlBeansResourcePropertyTestCase.class );
}
@@ -73,149 +72,165 @@
/**
* Test for XmlBeansResourceProperty#add.
*/
- public void testAdd()
- throws Exception
+ public void testAdd( )
+ throws Exception
{
- ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
- final String stringValue = "somethang";
- prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
+ ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
+ final String stringValue = "somethang";
+ prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart( ) + " xmlns=\""
+ + SushiPropertyQNames.IKA.getNamespaceURI( ) + "\">" + stringValue
+ + "</" + SushiPropertyQNames.IKA.getLocalPart( ) + ">" ) );
assertEquals( 2,
- prop.size() );
+ prop.size( ) );
XmlString xString = (XmlString) prop.get( 1 );
assertEquals( stringValue,
- xString.getStringValue() );
+ xString.getStringValue( ) );
}
/**
* Test for XmlBeansResourceProperty#clear.
*/
- public void testClear()
- throws Exception
+ public void testClear( )
+ throws Exception
{
ResourceProperty manufacturerProp = m_resourcePropSet.get( SushiPropertyQNames.IKA );
- manufacturerProp.clear();
- assertTrue( manufacturerProp.isEmpty() );
+ manufacturerProp.clear( );
+ assertTrue( manufacturerProp.isEmpty( ) );
}
/**
* Test for XmlBeansResourceProperty#get.
*/
- public void testGet()
- throws Exception
+ public void testGet( )
+ throws Exception
{
ResourceProperty manufacturerProp = m_resourcePropSet.get( SushiPropertyQNames.AKAGI );
- Object propObj = manufacturerProp.get( 0 );
+ Object propObj = manufacturerProp.get( 0 );
assertTrue( propObj instanceof XmlInt );
XmlInt xInt = (XmlInt) propObj;
assertEquals( "24",
- xInt.getStringValue() );
+ xInt.getStringValue( ) );
}
/**
* Test for XmlBeansResourceProperty#getMetaData.
*/
- public void testGetMetaData()
- throws Exception
+ public void testGetMetaData( )
+ throws Exception
{
- ResourceProperty blockSize = m_resourcePropSet.get( SushiPropertyQNames.EBI );
- ResourcePropertyMetaData metaData = blockSize.getMetaData();
+ ResourceProperty blockSize = m_resourcePropSet.get( SushiPropertyQNames.EBI );
+ ResourcePropertyMetaData metaData = blockSize.getMetaData( );
assertNotNull( metaData );
assertEquals( SushiPropertyQNames.EBI,
- metaData.getName() );
+ metaData.getName( ) );
assertEquals( 1,
- metaData.getMinOccurs() );
+ metaData.getMinOccurs( ) );
assertEquals( -1,
- metaData.getMaxOccurs() );
- assertFalse( metaData.isNillable() );
- assertFalse( metaData.isReadOnly() );
+ metaData.getMaxOccurs( ) );
+ assertFalse( metaData.isNillable( ) );
+ assertFalse( metaData.isReadOnly( ) );
+
// TODO: add some more cases to test props that are nillable and/or read-only
}
/**
* Test for XmlBeansResourceProperty#isEmpty.
*/
- public void testIsEmpty()
- throws Exception
+ public void testIsEmpty( )
+ throws Exception
{
ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
- assertFalse( prop.isEmpty() );
- prop.clear();
- assertTrue( prop.isEmpty() );
+ assertFalse( prop.isEmpty( ) );
+ prop.clear( );
+ assertTrue( prop.isEmpty( ) );
assertEquals( 0,
- prop.size() );
+ prop.size( ) );
}
/**
- * Test for XmlBeansResourceProperty#remove.
+ * Another test for XmlBeansResourceProperty#remove.
*/
- public void testRemoveExistingElement()
- throws Exception
+ public void testRemoveAddedElement( )
+ throws Exception
{
ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.HAMACHI );
+ prop.clear( );
+ XmlObject hamachiDoc =
+ XmlObject.Factory.parse( "<Hamachi xmlns=\"http://ws.apache.org/resource/properties/test/sushi\">\n"
+ + " <Flavor>disgusting</Flavor>\n" + "</Hamachi>" );
+ prop.add( hamachiDoc );
+ assertEquals( 1,
+ prop.size( ) );
+ assertEquals( 1,
+ XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject( ),
+ SushiPropertyQNames.HAMACHI ).length );
prop.remove( prop.get( 0 ) );
- assertTrue( prop.isEmpty() );
- assertEquals( 0, XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject(), SushiPropertyQNames.HAMACHI ).length );
+ assertTrue( prop.isEmpty( ) );
+ assertEquals( 0,
+ XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject( ),
+ SushiPropertyQNames.HAMACHI ).length );
}
- /**
- * Another test for XmlBeansResourceProperty#remove.
- */
- public void testRemoveAddedElement()
- throws Exception
- {
- ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.HAMACHI );
- prop.clear();
- XmlObject hamachiDoc = XmlObject.Factory.parse( "<Hamachi xmlns=\"http://ws.apache.org/resource/properties/test/sushi\">\n" +
- " <Flavor>disgusting</Flavor>\n" +
- "</Hamachi>" );
- prop.add( hamachiDoc );
- assertEquals( 1, prop.size() );
- assertEquals( 1, XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject(), SushiPropertyQNames.HAMACHI ).length );
- prop.remove( prop.get( 0 ) );
- assertTrue( prop.isEmpty() );
- assertEquals( 0, XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject(), SushiPropertyQNames.HAMACHI ).length );
- }
+ /**
+ * Test for XmlBeansResourceProperty#remove.
+ */
+ public void testRemoveExistingElement( )
+ throws Exception
+ {
+ ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.HAMACHI );
+ prop.remove( prop.get( 0 ) );
+ assertTrue( prop.isEmpty( ) );
+ assertEquals( 0,
+ XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject( ),
+ SushiPropertyQNames.HAMACHI ).length );
+ }
/**
* Test for XmlBeansResourceProperty#set.
*/
- public void testSet()
- throws Exception
+ public void testSet( )
+ throws Exception
{
- ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
- final String stringValue = "somethang";
+ ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
+ final String stringValue = "somethang";
prop.set( 0,
- XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
+ XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart( ) + " xmlns=\""
+ + SushiPropertyQNames.IKA.getNamespaceURI( ) + "\">" + stringValue
+ + "</" + SushiPropertyQNames.IKA.getLocalPart( ) + ">" ) );
XmlString xString = (XmlString) prop.get( 0 );
assertEquals( stringValue,
- xString.getStringValue() );
+ xString.getStringValue( ) );
}
/**
* Test for XmlBeansResourceProperty#size.
*/
- public void testSize()
- throws Exception
+ public void testSize( )
+ throws Exception
{
ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
assertEquals( 1,
- prop.size() );
+ prop.size( ) );
final String stringValue = "somethang";
- prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
- prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
+ prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart( ) + " xmlns=\""
+ + SushiPropertyQNames.IKA.getNamespaceURI( ) + "\">" + stringValue
+ + "</" + SushiPropertyQNames.IKA.getLocalPart( ) + ">" ) );
+ prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart( ) + " xmlns=\""
+ + SushiPropertyQNames.IKA.getNamespaceURI( ) + "\">" + stringValue
+ + "</" + SushiPropertyQNames.IKA.getLocalPart( ) + ">" ) );
assertEquals( 3,
- prop.size() );
+ prop.size( ) );
prop.remove( prop.get( 0 ) );
prop.remove( prop.get( 0 ) );
assertEquals( 1,
- prop.size() );
+ prop.size( ) );
}
/**
* Test for XmlBeansResourceProperty#toElements.
*/
- public void testToElements()
- throws Exception
+ public void testToElements( )
+ throws Exception
{
// TODO (low priority): implement
}
@@ -223,8 +238,8 @@
/**
* Test for XmlBeansResourceProperty#toSOAPElements.
*/
- public void testToSOAPElements()
- throws Exception
+ public void testToSOAPElements( )
+ throws Exception
{
// TODO (low priority): implement
}
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/AbstractWsrpPortTypeImplTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/AbstractWsrpPortTypeImplTestCase.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/AbstractWsrpPortTypeImplTestCase.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/AbstractWsrpPortTypeImplTestCase.java Tue Aug 2 09:28:49 2005
@@ -1,118 +1,178 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.properties.v2004_06.porttype.impl;
-
-import org.apache.ws.resource.properties.AbstractResourcePropertiesTestCase;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.InsertType;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.UpdateType;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.DeleteType;
-
-import javax.xml.namespace.QName;
-
-/**
- * Base class for test cases for WSRP portType impls.
- *
- * @author Ian Springer
- */
-public abstract class AbstractWsrpPortTypeImplTestCase extends AbstractResourcePropertiesTestCase
-{
-
- protected static final String INITIAL_PROP_VALUE_FUGU = "dangerous!";
- protected static final QName BOGUS_PROP_NAME = new QName( "http://blah.com/", "Bogus" );
- protected static final QName ANOTHER_BOGUS_PROP_NAME = new QName( "http://blah.com/", "EvenMoreBogus" );
-
- protected XmlObject createXsdAnyPropElem()
- throws XmlException
- {
- XmlOptions xOpts = new XmlOptions();
- XmlObject xBean = XmlObject.Factory.parse( "<fu:Fugu xmlns:fu=\"http://ws.apache.org/resource/properties/test/sushi/blowfish\">"
- + INITIAL_PROP_VALUE_FUGU + "</fu:Fugu>", xOpts );
- return xBean;
- }
-
- protected void insertXsdAnyPropElem()
- throws XmlException
- {
- XmlObject anyXBean = createXsdAnyPropElem();
- insertResourceProperty( new XmlObject[] {anyXBean} );
- }
-
- protected void assertPropHasOneElemWithGivenValue( QName propName, String expectedValue )
- {
- GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourcePropertyResponse = getResourceProperty( propName );
- XmlObject[] propElems = XmlBeanUtils.getChildElements( getResourcePropertyResponse, propName );
- assertNotNull( propElems );
- String value = XmlBeanUtils.getValue( propElems[0] );
- assertEquals( expectedValue, value );
- }
-
- protected GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourceProperty( QName propName )
- {
- GetResourcePropertyPortTypeImpl get_provider = new GetResourcePropertyPortTypeImpl( m_resourceContext );
- GetResourcePropertyDocument get_document = GetResourcePropertyDocument.Factory.newInstance();
- get_document.setGetResourceProperty( propName );
- GetResourcePropertyResponseDocument resourceProperty = get_provider.getResourceProperty( get_document );
- GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourcePropertyResponse =
- resourceProperty.getGetResourcePropertyResponse();
- return getResourcePropertyResponse;
- }
-
- protected void insertResourceProperty( XmlObject[] propElems )
- {
- SetResourcePropertiesPortTypeImpl setProvider = new SetResourcePropertiesPortTypeImpl( m_resourceContext );
- SetResourcePropertiesDocument setDocument = SetResourcePropertiesDocument.Factory.newInstance();
- SetResourcePropertiesDocument.SetResourceProperties setType = setDocument.addNewSetResourceProperties();
- InsertType insertType = setType.addNewInsert();
- for ( int i = 0; i < propElems.length; i++ )
- {
- XmlBeanUtils.addChildElement( insertType, propElems[i] );
- }
-
- setProvider.setResourceProperties( setDocument ).getSetResourcePropertiesResponse();
-
- }
-
- protected void updateResourceProperty( XmlObject[] propElems )
- {
- SetResourcePropertiesPortTypeImpl setProvider = new SetResourcePropertiesPortTypeImpl( m_resourceContext );
- SetResourcePropertiesDocument setDocument = SetResourcePropertiesDocument.Factory.newInstance();
- SetResourcePropertiesDocument.SetResourceProperties setType = setDocument.addNewSetResourceProperties();
- UpdateType updateType = setType.addNewUpdate();
- for ( int i = 0; i < propElems.length; i++ )
- {
- XmlBeanUtils.addChildElement( updateType, propElems[i] );
- }
- setProvider.setResourceProperties( setDocument ).getSetResourcePropertiesResponse();
- }
-
- protected void deleteResourceProperty( QName propName )
- {
- SetResourcePropertiesPortTypeImpl setProvider = new SetResourcePropertiesPortTypeImpl( m_resourceContext );
- SetResourcePropertiesDocument setDocument = SetResourcePropertiesDocument.Factory.newInstance();
- SetResourcePropertiesDocument.SetResourceProperties setType = setDocument.addNewSetResourceProperties();
- DeleteType deleteType = setType.addNewDelete();
- deleteType.setResourceProperty( propName );
- setProvider.setResourceProperties( setDocument ).getSetResourcePropertiesResponse();
- }
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.properties.v2004_06.porttype.impl;
+
+import org.apache.ws.resource.properties.AbstractResourcePropertiesTestCase;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.DeleteType;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.InsertType;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.UpdateType;
+import javax.xml.namespace.QName;
+
+/**
+ * Base class for test cases for WSRP portType impls.
+ *
+ * @author Ian Springer
+ */
+public abstract class AbstractWsrpPortTypeImplTestCase
+ extends AbstractResourcePropertiesTestCase
+{
+ /** DOCUMENT_ME */
+ protected static final String INITIAL_PROP_VALUE_FUGU = "dangerous!";
+
+ /** DOCUMENT_ME */
+ protected static final QName BOGUS_PROP_NAME = new QName( "http://blah.com/", "Bogus" );
+
+ /** DOCUMENT_ME */
+ protected static final QName ANOTHER_BOGUS_PROP_NAME = new QName( "http://blah.com/", "EvenMoreBogus" );
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propName DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourceProperty( QName propName )
+ {
+ GetResourcePropertyPortTypeImpl get_provider = new GetResourcePropertyPortTypeImpl( m_resourceContext );
+ GetResourcePropertyDocument get_document = GetResourcePropertyDocument.Factory.newInstance( );
+ get_document.setGetResourceProperty( propName );
+ GetResourcePropertyResponseDocument resourceProperty =
+ get_provider.getResourceProperty( get_document );
+ GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourcePropertyResponse =
+ resourceProperty.getGetResourcePropertyResponse( );
+ return getResourcePropertyResponse;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propName DOCUMENT_ME
+ * @param expectedValue DOCUMENT_ME
+ */
+ protected void assertPropHasOneElemWithGivenValue( QName propName,
+ String expectedValue )
+ {
+ GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourcePropertyResponse =
+ getResourceProperty( propName );
+ XmlObject[] propElems =
+ XmlBeanUtils.getChildElements( getResourcePropertyResponse, propName );
+ assertNotNull( propElems );
+ String value = XmlBeanUtils.getValue( propElems[0] );
+ assertEquals( expectedValue, value );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws XmlException DOCUMENT_ME
+ */
+ protected XmlObject createXsdAnyPropElem( )
+ throws XmlException
+ {
+ XmlOptions xOpts = new XmlOptions( );
+ XmlObject xBean =
+ XmlObject.Factory.parse( "<fu:Fugu xmlns:fu=\"http://ws.apache.org/resource/properties/test/sushi/blowfish\">"
+ + INITIAL_PROP_VALUE_FUGU + "</fu:Fugu>", xOpts );
+ return xBean;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propName DOCUMENT_ME
+ */
+ protected void deleteResourceProperty( QName propName )
+ {
+ SetResourcePropertiesPortTypeImpl setProvider =
+ new SetResourcePropertiesPortTypeImpl( m_resourceContext );
+ SetResourcePropertiesDocument setDocument =
+ SetResourcePropertiesDocument.Factory.newInstance( );
+ SetResourcePropertiesDocument.SetResourceProperties setType =
+ setDocument.addNewSetResourceProperties( );
+ DeleteType deleteType = setType.addNewDelete( );
+ deleteType.setResourceProperty( propName );
+ setProvider.setResourceProperties( setDocument ).getSetResourcePropertiesResponse( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propElems DOCUMENT_ME
+ */
+ protected void insertResourceProperty( XmlObject[] propElems )
+ {
+ SetResourcePropertiesPortTypeImpl setProvider =
+ new SetResourcePropertiesPortTypeImpl( m_resourceContext );
+ SetResourcePropertiesDocument setDocument =
+ SetResourcePropertiesDocument.Factory.newInstance( );
+ SetResourcePropertiesDocument.SetResourceProperties setType =
+ setDocument.addNewSetResourceProperties( );
+ InsertType insertType = setType.addNewInsert( );
+ for ( int i = 0; i < propElems.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( insertType, propElems[i] );
+ }
+
+ setProvider.setResourceProperties( setDocument ).getSetResourcePropertiesResponse( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @throws XmlException DOCUMENT_ME
+ */
+ protected void insertXsdAnyPropElem( )
+ throws XmlException
+ {
+ XmlObject anyXBean = createXsdAnyPropElem( );
+ insertResourceProperty( new XmlObject[]
+ {
+ anyXBean
+ } );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propElems DOCUMENT_ME
+ */
+ protected void updateResourceProperty( XmlObject[] propElems )
+ {
+ SetResourcePropertiesPortTypeImpl setProvider =
+ new SetResourcePropertiesPortTypeImpl( m_resourceContext );
+ SetResourcePropertiesDocument setDocument =
+ SetResourcePropertiesDocument.Factory.newInstance( );
+ SetResourcePropertiesDocument.SetResourceProperties setType =
+ setDocument.addNewSetResourceProperties( );
+ UpdateType updateType = setType.addNewUpdate( );
+ for ( int i = 0; i < propElems.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( updateType, propElems[i] );
+ }
+
+ setProvider.setResourceProperties( setDocument ).getSetResourcePropertiesResponse( );
+ }
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java Tue Aug 2 09:28:49 2005
@@ -1,129 +1,170 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.properties.v2004_06.porttype.impl;
-
-import org.apache.ws.resource.properties.ResourceProperty;
-import org.apache.ws.resource.properties.SushiCallback;
-import org.apache.ws.resource.properties.SushiPlate;
-import org.apache.ws.resource.properties.SushiPropertyQNames;
-import org.apache.ws.resource.properties.SushiResource;
-import org.apache.ws.resource.properties.SushiResourceContext;
-import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlObject;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetMultipleResourcePropertiesDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetMultipleResourcePropertiesResponseDocument;
-
-import javax.xml.namespace.QName;
-
-/**
- * Test case for {@link GetMultipleResourcePropertiesPortTypeImpl}.
- *
- * @author Sal Campana, Ian Springer
- */
-public class GetMultipleResourcePropertiesProviderTestCase
- extends AbstractWsrpPortTypeImplTestCase
-{
-
- /**
- * DOCUMENT_ME
- */
- public void testGetMultiExistingProps() throws Exception
- {
- m_resourceContext = new SushiResourceContext();
- final QName[] propNames = new QName[]{SushiPropertyQNames.EBI, SushiPropertyQNames.IKA};
- GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = getMultipleResourceProperties( propNames );
- XmlObject[] propElems = XmlBeanUtils.getChildElements( response, null );
- assertNotNull( propElems );
- assertEquals( propNames.length, propElems.length );
- assertEquals( propNames[0], XmlBeanUtils.getName( propElems[0] ) );
- assertEquals( "9", XmlBeanUtils.getValue( propElems[0] ) );
- assertEquals( propNames[1], XmlBeanUtils.getName( propElems[1] ) );
- assertEquals( "mamamia", XmlBeanUtils.getValue( propElems[1] ) );
- }
-
- /**
- * DOCUMENT_ME
- */
- public void testGetMultiWithAllInvalidPropNames() throws Exception
- {
- m_resourceContext = new SushiResourceContext( true );
- assertGetMultiRequestThrowsFault( new QName[]{BOGUS_PROP_NAME, ANOTHER_BOGUS_PROP_NAME} );
- m_resourceContext = new SushiResourceContext( false );
- assertGetMultiRequestThrowsFault( new QName[]{BOGUS_PROP_NAME, ANOTHER_BOGUS_PROP_NAME} );
- }
-
- /**
- * DOCUMENT_ME
- */
- public void testGetMultiWithSomeInvalidPropNames() throws Exception
- {
- m_resourceContext = new SushiResourceContext( true );
- assertGetMultiRequestThrowsFault( new QName[]{SushiPropertyQNames.OHTORO, BOGUS_PROP_NAME} );
- m_resourceContext = new SushiResourceContext( false );
- assertGetMultiRequestThrowsFault( new QName[]{SushiPropertyQNames.OHTORO, BOGUS_PROP_NAME} );
- }
-
- /**
- * DOCUMENT_ME
- */
- public void testGetMultipleResourcePropertiesCallback()
- throws Exception
- {
- m_resourceContext = new SushiResourceContext();
- SushiPlate plate = new SushiPlate();
- SushiCallback callback = new SushiCallback( plate );
- SushiResource resource = (SushiResource) m_resourceContext.getResource();
- ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
- resourceProp.setCallback( callback );
- final QName[] propNames = new QName[]{SushiPropertyQNames.EBI, SushiPropertyQNames.IKA};
- GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = getMultipleResourceProperties( propNames );
- XmlObject[] propElems = XmlBeanUtils.getChildElements( response );
- assertNotNull( propElems );
- assertEquals( propNames[0], XmlBeanUtils.getName( propElems[0] ) );
- assertEquals( plate.getEbi().getNumberOfPieces(), XmlBeanUtils.getValue( propElems[0] ) );
- }
-
- private GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse getMultipleResourceProperties( QName[] propNames )
- {
- GetMultipleResourcePropertiesPortTypeImpl provider = new GetMultipleResourcePropertiesPortTypeImpl( m_resourceContext );
- GetMultipleResourcePropertiesDocument doc = GetMultipleResourcePropertiesDocument.Factory.newInstance();
- GetMultipleResourcePropertiesDocument.GetMultipleResourceProperties getMultipleResourceProperties = doc.addNewGetMultipleResourceProperties();
- for ( int i = 0; i < propNames.length; i++ )
- {
- getMultipleResourceProperties.addResourceProperty( propNames[i] );
- }
- GetMultipleResourcePropertiesResponseDocument responseDoc = provider.getMultipleResourceProperties( doc );
- GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response =
- responseDoc.getGetMultipleResourcePropertiesResponse();
- return response;
- }
-
- private void assertGetMultiRequestThrowsFault( QName[] propNames )
- {
- GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = null;
- try
- {
- response = getMultipleResourceProperties( propNames );
- fail( response != null ? "Expected fault, but received response." : null );
- }
- catch ( InvalidResourcePropertyQNameFaultException expectedFault )
- {
- return;
- }
- }
-
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.properties.v2004_06.porttype.impl;
+
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.SushiCallback;
+import org.apache.ws.resource.properties.SushiPlate;
+import org.apache.ws.resource.properties.SushiPropertyQNames;
+import org.apache.ws.resource.properties.SushiResource;
+import org.apache.ws.resource.properties.SushiResourceContext;
+import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetMultipleResourcePropertiesDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetMultipleResourcePropertiesResponseDocument;
+import javax.xml.namespace.QName;
+
+/**
+ * Test case for {@link GetMultipleResourcePropertiesPortTypeImpl}.
+ *
+ * @author Sal Campana, Ian Springer
+ */
+public class GetMultipleResourcePropertiesProviderTestCase
+ extends AbstractWsrpPortTypeImplTestCase
+{
+ /**
+ * DOCUMENT_ME
+ */
+ public void testGetMultiExistingProps( )
+ throws Exception
+ {
+ m_resourceContext = new SushiResourceContext( );
+ final QName[] propNames =
+ new QName[]
+ {
+ SushiPropertyQNames.EBI,
+ SushiPropertyQNames.IKA
+ };
+ GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response =
+ getMultipleResourceProperties( propNames );
+ XmlObject[] propElems =
+ XmlBeanUtils.getChildElements( response, null );
+ assertNotNull( propElems );
+ assertEquals( propNames.length, propElems.length );
+ assertEquals( propNames[0],
+ XmlBeanUtils.getName( propElems[0] ) );
+ assertEquals( "9",
+ XmlBeanUtils.getValue( propElems[0] ) );
+ assertEquals( propNames[1],
+ XmlBeanUtils.getName( propElems[1] ) );
+ assertEquals( "mamamia",
+ XmlBeanUtils.getValue( propElems[1] ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void testGetMultiWithAllInvalidPropNames( )
+ throws Exception
+ {
+ m_resourceContext = new SushiResourceContext( true );
+ assertGetMultiRequestThrowsFault( new QName[]
+ {
+ BOGUS_PROP_NAME,
+ ANOTHER_BOGUS_PROP_NAME
+ } );
+ m_resourceContext = new SushiResourceContext( false );
+ assertGetMultiRequestThrowsFault( new QName[]
+ {
+ BOGUS_PROP_NAME,
+ ANOTHER_BOGUS_PROP_NAME
+ } );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void testGetMultiWithSomeInvalidPropNames( )
+ throws Exception
+ {
+ m_resourceContext = new SushiResourceContext( true );
+ assertGetMultiRequestThrowsFault( new QName[]
+ {
+ SushiPropertyQNames.OHTORO,
+ BOGUS_PROP_NAME
+ } );
+ m_resourceContext = new SushiResourceContext( false );
+ assertGetMultiRequestThrowsFault( new QName[]
+ {
+ SushiPropertyQNames.OHTORO,
+ BOGUS_PROP_NAME
+ } );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void testGetMultipleResourcePropertiesCallback( )
+ throws Exception
+ {
+ m_resourceContext = new SushiResourceContext( );
+ SushiPlate plate = new SushiPlate( );
+ SushiCallback callback = new SushiCallback( plate );
+ SushiResource resource = (SushiResource) m_resourceContext.getResource( );
+ ResourceProperty resourceProp = resource.getResourcePropertySet( ).get( SushiPropertyQNames.EBI );
+ resourceProp.setCallback( callback );
+ final QName[] propNames =
+ new QName[]
+ {
+ SushiPropertyQNames.EBI,
+ SushiPropertyQNames.IKA
+ };
+ GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response =
+ getMultipleResourceProperties( propNames );
+ XmlObject[] propElems =
+ XmlBeanUtils.getChildElements( response );
+ assertNotNull( propElems );
+ assertEquals( propNames[0],
+ XmlBeanUtils.getName( propElems[0] ) );
+ assertEquals( plate.getEbi( ).getNumberOfPieces( ),
+ XmlBeanUtils.getValue( propElems[0] ) );
+ }
+
+ private GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse getMultipleResourceProperties( QName[] propNames )
+ {
+ GetMultipleResourcePropertiesPortTypeImpl provider =
+ new GetMultipleResourcePropertiesPortTypeImpl( m_resourceContext );
+ GetMultipleResourcePropertiesDocument doc =
+ GetMultipleResourcePropertiesDocument.Factory.newInstance( );
+ GetMultipleResourcePropertiesDocument.GetMultipleResourceProperties getMultipleResourceProperties =
+ doc.addNewGetMultipleResourceProperties( );
+ for ( int i = 0; i < propNames.length; i++ )
+ {
+ getMultipleResourceProperties.addResourceProperty( propNames[i] );
+ }
+
+ GetMultipleResourcePropertiesResponseDocument responseDoc =
+ provider.getMultipleResourceProperties( doc );
+ GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response =
+ responseDoc.getGetMultipleResourcePropertiesResponse( );
+ return response;
+ }
+
+ private void assertGetMultiRequestThrowsFault( QName[] propNames )
+ {
+ GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = null;
+ try
+ {
+ response = getMultipleResourceProperties( propNames );
+ fail( ( response != null ) ? "Expected fault, but received response." : null );
+ }
+ catch ( InvalidResourcePropertyQNameFaultException expectedFault )
+ {
+ return;
+ }
+ }
}
Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/v2004_06/porttype/impl/GetResourcePropertyProviderTestCase.java Tue Aug 2 09:28:49 2005
@@ -1,111 +1,124 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.properties.v2004_06.porttype.impl;
-
-import org.apache.ws.resource.properties.ResourceProperty;
-import org.apache.ws.resource.properties.SushiCallback;
-import org.apache.ws.resource.properties.SushiPlate;
-import org.apache.ws.resource.properties.SushiPropertyQNames;
-import org.apache.ws.resource.properties.SushiResource;
-import org.apache.ws.resource.properties.SushiResourceContext;
-import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlObject;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
-
-/**
- * Test case for {@link GetResourcePropertyPortTypeImpl}, which consists of only one
- * operation: {@link GetResourcePropertyPortTypeImpl#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}
- *
- * @author Sal Campana, Ian Springer
- */
-public class GetResourcePropertyProviderTestCase
- extends AbstractWsrpPortTypeImplTestCase
-{
-
- /**
- * Tests that a GetRP request for an existing prop returns a GetRPResponse elem containing that prop.
- */
- public void testGetExistingProp() throws Exception
- {
- m_resourceContext = new SushiResourceContext();
- GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.IKA );
- XmlObject[] ebiPropElems = XmlBeanUtils.getChildElements( response, SushiPropertyQNames.IKA );
- assertNotNull( ebiPropElems );
- assertEquals( 1, ebiPropElems.length );
- assertEquals( "mamamia", XmlBeanUtils.getValue( ebiPropElems[0] ) );
- }
-
- /**
- * Tests that a GetRP request for a non-existing optional prop returns an empty GetRPResponse elem.
- */
- public void testGetNonexistingOptionalProp() throws Exception
- {
- m_resourceContext = new SushiResourceContext();
- GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.UNI );
- XmlObject[] uniPropElems = XmlBeanUtils.getChildElements( response, SushiPropertyQNames.UNI );
- assertNotNull( uniPropElems );
- assertEquals( 0, uniPropElems.length );
- }
-
- /**
- * Tests that a GetRP request for an invalid prop QName throws a fault exception,
- * wether or not the RP doc permits open content.
- */
- public void testGetInvalidProp() throws Exception
- {
- m_resourceContext = new SushiResourceContext( true );
- assertGetRequestForInvalidPropThrowsFault();
- m_resourceContext = new SushiResourceContext( false );
- assertGetRequestForInvalidPropThrowsFault();
- }
-
- /**
- * Test that {@link GetResourcePropertyPortTypeImpl#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}
- * invokes a {@link org.apache.ws.resource.properties.ResourcePropertyCallback} if one is registered for the
- * requested property.
- */
- public void testGetPropertyTriggersCallback() throws Exception
- {
- m_resourceContext = new SushiResourceContext();
- // create and register callback object
- SushiPlate plate = new SushiPlate();
- SushiCallback callback = new SushiCallback( plate );
- SushiResource resource = (SushiResource) m_resourceContext.getResource();
- ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
- resourceProp.setCallback( callback );
- // send GetRP request and make sure prop got updated by callback.refreshProperty()
- GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.EBI );
- XmlObject[] ebiPropElems = XmlBeanUtils.getChildElements( response, SushiPropertyQNames.EBI );
- assertNotNull( ebiPropElems );
- assertEquals( 1, ebiPropElems.length );
- assertEquals( plate.getEbi().getNumberOfPieces(), XmlBeanUtils.getValue( ebiPropElems[0] ) );
- }
-
- private void assertGetRequestForInvalidPropThrowsFault()
- {
- try
- {
- GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( BOGUS_PROP_NAME );
- fail( response != null ? "Expected fault, but received response." : null );
- }
- catch ( InvalidResourcePropertyQNameFaultException expectedFault )
- {
- return;
- }
- }
-
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.properties.v2004_06.porttype.impl;
+
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.SushiCallback;
+import org.apache.ws.resource.properties.SushiPlate;
+import org.apache.ws.resource.properties.SushiPropertyQNames;
+import org.apache.ws.resource.properties.SushiResource;
+import org.apache.ws.resource.properties.SushiResourceContext;
+import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
+
+/**
+ * Test case for {@link GetResourcePropertyPortTypeImpl}, which consists of only one
+ * operation: {@link GetResourcePropertyPortTypeImpl#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}
+ *
+ * @author Sal Campana, Ian Springer
+ */
+public class GetResourcePropertyProviderTestCase
+ extends AbstractWsrpPortTypeImplTestCase
+{
+ /**
+ * Tests that a GetRP request for an existing prop returns a GetRPResponse elem containing that prop.
+ */
+ public void testGetExistingProp( )
+ throws Exception
+ {
+ m_resourceContext = new SushiResourceContext( );
+ GetResourcePropertyResponseDocument.GetResourcePropertyResponse response =
+ getResourceProperty( SushiPropertyQNames.IKA );
+ XmlObject[] ebiPropElems =
+ XmlBeanUtils.getChildElements( response, SushiPropertyQNames.IKA );
+ assertNotNull( ebiPropElems );
+ assertEquals( 1, ebiPropElems.length );
+ assertEquals( "mamamia",
+ XmlBeanUtils.getValue( ebiPropElems[0] ) );
+ }
+
+ /**
+ * Tests that a GetRP request for an invalid prop QName throws a fault exception,
+ * wether or not the RP doc permits open content.
+ */
+ public void testGetInvalidProp( )
+ throws Exception
+ {
+ m_resourceContext = new SushiResourceContext( true );
+ assertGetRequestForInvalidPropThrowsFault( );
+ m_resourceContext = new SushiResourceContext( false );
+ assertGetRequestForInvalidPropThrowsFault( );
+ }
+
+ /**
+ * Tests that a GetRP request for a non-existing optional prop returns an empty GetRPResponse elem.
+ */
+ public void testGetNonexistingOptionalProp( )
+ throws Exception
+ {
+ m_resourceContext = new SushiResourceContext( );
+ GetResourcePropertyResponseDocument.GetResourcePropertyResponse response =
+ getResourceProperty( SushiPropertyQNames.UNI );
+ XmlObject[] uniPropElems =
+ XmlBeanUtils.getChildElements( response, SushiPropertyQNames.UNI );
+ assertNotNull( uniPropElems );
+ assertEquals( 0, uniPropElems.length );
+ }
+
+ /**
+ * Test that {@link GetResourcePropertyPortTypeImpl#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}
+ * invokes a {@link org.apache.ws.resource.properties.ResourcePropertyCallback} if one is registered for the
+ * requested property.
+ */
+ public void testGetPropertyTriggersCallback( )
+ throws Exception
+ {
+ m_resourceContext = new SushiResourceContext( );
+
+ // create and register callback object
+ SushiPlate plate = new SushiPlate( );
+ SushiCallback callback = new SushiCallback( plate );
+ SushiResource resource = (SushiResource) m_resourceContext.getResource( );
+ ResourceProperty resourceProp = resource.getResourcePropertySet( ).get( SushiPropertyQNames.EBI );
+ resourceProp.setCallback( callback );
+
+ // send GetRP request and make sure prop got updated by callback.refreshProperty()
+ GetResourcePropertyResponseDocument.GetResourcePropertyResponse response =
+ getResourceProperty( SushiPropertyQNames.EBI );
+ XmlObject[] ebiPropElems =
+ XmlBeanUtils.getChildElements( response, SushiPropertyQNames.EBI );
+ assertNotNull( ebiPropElems );
+ assertEquals( 1, ebiPropElems.length );
+ assertEquals( plate.getEbi( ).getNumberOfPieces( ),
+ XmlBeanUtils.getValue( ebiPropElems[0] ) );
+ }
+
+ private void assertGetRequestForInvalidPropThrowsFault( )
+ {
+ try
+ {
+ GetResourcePropertyResponseDocument.GetResourcePropertyResponse response =
+ getResourceProperty( BOGUS_PROP_NAME );
+ fail( ( response != null ) ? "Expected fault, but received response." : null );
+ }
+ catch ( InvalidResourcePropertyQNameFaultException expectedFault )
+ {
+ return;
+ }
+ }
}