You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by ip...@apache.org on 2004/12/13 20:07:07 UTC
svn commit: r111742 - in incubator/apollo/trunk/src: java/org/apache/ws/resource/properties/porttype/impl test/org/apache/ws/resource/properties/porttype/impl
Author: ips
Date: Mon Dec 13 11:07:05 2004
New Revision: 111742
URL: http://svn.apache.org/viewcvs?view=rev&rev=111742
Log:
finished unit tests for Get + GetMulti portTypeImpls
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProvider.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProvider.java
incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java
incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java
incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProviderTestCase.java
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProvider.java?view=diff&rev=111742&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProvider.java&r1=111741&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProvider.java&r2=111742
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProvider.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProvider.java Mon Dec 13 11:07:05 2004
@@ -33,86 +33,89 @@
import java.util.Iterator;
/**
- * LOG-DONE
- * An operation provider for wsrp:GetMultipleResourceProperties.
+ * LOG-DONE An operation provider for wsrp:GetMultipleResourceProperties.
*
* @author Ian P. Springer
*/
public class GetMultipleResourcePropertiesProvider
- extends AbstractResourcePropertiesPortType
- implements GetMultipleResourcePropertiesPortType
+ extends AbstractResourcePropertiesPortType
+ implements GetMultipleResourcePropertiesPortType
{
-
- private static final Log LOG = LogFactory.getLog( GetMultipleResourcePropertiesProvider.class );
- private static final Messages MSG = MessagesImpl.getInstance( );
-
- /**
- * Creates a new {@link GetMultipleResourcePropertiesProvider} object.
- *
- * @param resourceContext DOCUMENT_ME
- */
- public GetMultipleResourcePropertiesProvider( ResourceContext resourceContext )
- {
- super( resourceContext );
- }
-
- /**
- * Implementation of the wsrp:GetMultipleResourceProperties operation.
- *
- * @param requestDoc the requestDoc XMLBean
- *
- * @return the response XMLBean
- *
- * @throws InvalidResourcePropertyQNameFaultException
- *
- * @throws org.apache.ws.resource.faults.ResoureKeyHeaderNotFoundFaultException
- *
- */
- public GetMultipleResourcePropertiesResponseDocument getMultipleResourceProperties( GetMultipleResourcePropertiesDocument requestDoc )
- {
- if ( LOG.isDebugEnabled( ) )
- {
- LOG.debug( MSG.getMessage( Keys.GET_MULTI_RP_REQ,
- requestDoc.toString( ) ) );
- }
-
- GetMultipleResourcePropertiesResponseDocument responseDoc = createResponseDocument( );
- QName[] propNames =
- requestDoc.getGetMultipleResourceProperties( ).getResourcePropertyArray( );
-
- for ( int i = 0; i < propNames.length; i++ )
- {
- ResourceProperty prop = getProperties( ).get( propNames[i] );
- refreshProperty( prop );
- if ( prop == null )
- {
- throw new InvalidResourcePropertyQNameFaultException( propNames[i] );
- }
-
- addPropertyToResponse( prop,
- responseDoc.getGetMultipleResourcePropertiesResponse( ) );
- }
-
- return responseDoc;
- }
-
- private void addPropertyToResponse( ResourceProperty prop,
- GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response )
- {
- Iterator propElemIter = prop.iterator( );
- while ( propElemIter.hasNext( ) )
- {
- XmlObject propElem = (XmlObject) propElemIter.next( );
- XmlBeanUtils.addChildElement( response, propElem );
- }
- }
-
- private GetMultipleResourcePropertiesResponseDocument createResponseDocument( )
- {
- GetMultipleResourcePropertiesResponseDocument responseDoc =
- GetMultipleResourcePropertiesResponseDocument.Factory.newInstance( );
- responseDoc.addNewGetMultipleResourcePropertiesResponse( );
- return responseDoc;
- }
-
+
+ private static final Log LOG = LogFactory.getLog( GetMultipleResourcePropertiesProvider.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+
+ /**
+ * Creates a new {@link GetMultipleResourcePropertiesProvider} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public GetMultipleResourcePropertiesProvider( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * Implementation of the wsrp:GetMultipleResourceProperties operation.
+ *
+ * @param requestDoc the requestDoc XMLBean
+ *
+ * @return the response XMLBean
+ *
+ * @throws InvalidResourcePropertyQNameFaultException
+ *
+ * @throws org.apache.ws.resource.faults.ResoureKeyHeaderNotFoundFaultException
+ *
+ */
+ public GetMultipleResourcePropertiesResponseDocument getMultipleResourceProperties( GetMultipleResourcePropertiesDocument requestDoc )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.GET_MULTI_RP_REQ,
+ requestDoc.toString() ) );
+ }
+
+ GetMultipleResourcePropertiesResponseDocument responseDoc = createResponseDocument();
+ QName[] propNames =
+ requestDoc.getGetMultipleResourceProperties().getResourcePropertyArray();
+
+ for ( int i = 0; i < propNames.length; i++ )
+ {
+ ResourceProperty prop = getProperties().get( propNames[i] );
+ if ( prop == null )
+ {
+ throw new InvalidResourcePropertyQNameFaultException( propNames[i] );
+ }
+ refreshProperty( prop );
+ if ( prop == null )
+ {
+ throw new InvalidResourcePropertyQNameFaultException( propNames[i] );
+ }
+
+ addPropertyToResponse( prop,
+ responseDoc.getGetMultipleResourcePropertiesResponse() );
+ }
+
+ return responseDoc;
+ }
+
+ private void addPropertyToResponse( ResourceProperty prop,
+ GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response )
+ {
+ Iterator propElemIter = prop.iterator();
+ while ( propElemIter.hasNext() )
+ {
+ XmlObject propElem = (XmlObject) propElemIter.next();
+ XmlBeanUtils.addChildElement( response, propElem );
+ }
+ }
+
+ private GetMultipleResourcePropertiesResponseDocument createResponseDocument()
+ {
+ GetMultipleResourcePropertiesResponseDocument responseDoc =
+ GetMultipleResourcePropertiesResponseDocument.Factory.newInstance();
+ responseDoc.addNewGetMultipleResourcePropertiesResponse();
+ return responseDoc;
+ }
+
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProvider.java?view=diff&rev=111742&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProvider.java&r1=111741&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProvider.java&r2=111742
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProvider.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProvider.java Mon Dec 13 11:07:05 2004
@@ -15,19 +15,20 @@
*=============================================================================*/
package org.apache.ws.resource.properties.porttype.impl;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.ws.resource.ResourceContext;
-import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.faults.InvalidResourcePropertyQNameFaultException;
import org.apache.ws.resource.properties.porttype.GetResourcePropertyPortType;
import org.apache.ws.util.XmlBeanUtils;
import org.apache.ws.util.i18n.Messages;
import org.apache.xmlbeans.XmlObject;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
+
import javax.xml.namespace.QName;
import java.util.Iterator;
@@ -37,63 +38,64 @@
* @author Ian P. Springer
*/
public class GetResourcePropertyProvider
- extends AbstractResourcePropertiesPortType
- implements GetResourcePropertyPortType
+ extends AbstractResourcePropertiesPortType
+ implements GetResourcePropertyPortType
{
-
+
private static final Log LOG = LogFactory.getLog( GetResourcePropertyProvider.class );
private static final Messages MSG = MessagesImpl.getInstance();
- /**
- * Creates a new {@link GetResourcePropertyProvider} object.
- *
- * @param resourceContext DOCUMENT_ME
- */
- public GetResourcePropertyProvider( ResourceContext resourceContext )
- {
- super( resourceContext );
- }
-
- /**
- * Implementation of the wsrp:GetResourceProperty operation.
- *
- * @param requestDoc the requestDoc XMLBean
- *
- * @return the response XMLBean
- *
- * @throws InvalidResourcePropertyQNameFaultException
- *
- * @throws org.apache.ws.resource.faults.ResoureKeyHeaderNotFoundFaultException
- */
- public GetResourcePropertyResponseDocument getResourceProperty( GetResourcePropertyDocument requestDoc )
- {
- if(LOG.isDebugEnabled())
- {
- LOG.debug(MSG.getMessage( Keys.GET_RP_REQ,requestDoc.toString()));
- }
- GetResourcePropertyResponseDocument responseDoc = createResponseDocument( );
- QName propName = requestDoc.getGetResourceProperty( );
- ResourceProperty prop = getProperties( ).get( propName );
- if ( prop == null )
- {
- throw new InvalidResourcePropertyQNameFaultException( requestDoc.getGetResourceProperty( ) );
- }
- refreshProperty(prop);
- Iterator propElemIter = prop.iterator( );
- while ( propElemIter.hasNext( ) )
- {
- XmlObject propElem = (XmlObject) propElemIter.next( );
- XmlBeanUtils.addChildElement( responseDoc.getGetResourcePropertyResponse( ),
- propElem );
- }
- return responseDoc;
- }
-
- private GetResourcePropertyResponseDocument createResponseDocument( )
- {
- GetResourcePropertyResponseDocument responseDoc =
- GetResourcePropertyResponseDocument.Factory.newInstance( );
- responseDoc.addNewGetResourcePropertyResponse( );
- return responseDoc;
- }
+ /**
+ * Creates a new {@link GetResourcePropertyProvider} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public GetResourcePropertyProvider( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * Implementation of the wsrp:GetResourceProperty operation.
+ *
+ * @param requestDoc the requestDoc XMLBean
+ *
+ * @return the response XMLBean
+ *
+ * @throws InvalidResourcePropertyQNameFaultException
+ *
+ * @throws org.apache.ws.resource.faults.ResoureKeyHeaderNotFoundFaultException
+ *
+ */
+ public GetResourcePropertyResponseDocument getResourceProperty( GetResourcePropertyDocument requestDoc )
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.GET_RP_REQ, requestDoc.toString() ) );
+ }
+ GetResourcePropertyResponseDocument responseDoc = createResponseDocument();
+ QName propName = requestDoc.getGetResourceProperty();
+ ResourceProperty prop = getProperties().get( propName );
+ if ( prop == null )
+ {
+ throw new InvalidResourcePropertyQNameFaultException( propName );
+ }
+ refreshProperty( prop );
+ Iterator propElemIter = prop.iterator();
+ while ( propElemIter.hasNext() )
+ {
+ XmlObject propElem = (XmlObject) propElemIter.next();
+ XmlBeanUtils.addChildElement( responseDoc.getGetResourcePropertyResponse(),
+ propElem );
+ }
+ return responseDoc;
+ }
+
+ private GetResourcePropertyResponseDocument createResponseDocument()
+ {
+ GetResourcePropertyResponseDocument responseDoc =
+ GetResourcePropertyResponseDocument.Factory.newInstance();
+ responseDoc.addNewGetResourcePropertyResponse();
+ return responseDoc;
+ }
}
Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java?view=diff&rev=111742&p1=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java&r1=111741&p2=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java&r2=111742
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java (original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/AbstractWsrpPortTypeImplTestCase.java Mon Dec 13 11:07:05 2004
@@ -39,6 +39,7 @@
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
Modified: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java?view=diff&rev=111742&p1=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java&r1=111741&p2=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java&r2=111742
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java (original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetMultipleResourcePropertiesProviderTestCase.java Mon Dec 13 11:07:05 2004
@@ -21,6 +21,7 @@
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;
@@ -38,22 +39,45 @@
/**
* DOCUMENT_ME
*/
- public void testGetMultipleResourceProperties()
+ public void testGetMultiExistingProps()
{
m_resourceContext = new SushiResourceContext();
- GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = getMultipleResourceProperties( new QName[]{SushiPropertyQNames.EBI, SushiPropertyQNames.IKA} );
+ final QName[] propNames = new QName[]{SushiPropertyQNames.EBI, SushiPropertyQNames.IKA};
+ GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = getMultipleResourceProperties( propNames );
XmlObject[] propElems = XmlBeanUtils.getChildElements( response, null );
assertNotNull( propElems );
- assertEquals( 2, propElems.length );
- assertEquals( SushiPropertyQNames.EBI, XmlBeanUtils.getName( propElems[0] ) );
+ assertEquals( propNames.length, propElems.length );
+ assertEquals( propNames[0], XmlBeanUtils.getName( propElems[0] ) );
assertEquals( "9", XmlBeanUtils.getValue( propElems[0] ) );
- assertEquals( SushiPropertyQNames.IKA, XmlBeanUtils.getName( propElems[1] ) );
+ assertEquals( propNames[1], XmlBeanUtils.getName( propElems[1] ) );
assertEquals( "mamamia", XmlBeanUtils.getValue( propElems[1] ) );
}
/**
* DOCUMENT_ME
*/
+ public void testGetMultiWithAllInvalidPropNames()
+ {
+ 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()
+ {
+ 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
{
@@ -63,11 +87,12 @@
SushiResource resource = (SushiResource) m_resourceContext.getResource();
ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
resourceProp.setCallback( callback );
- GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = getMultipleResourceProperties( new QName[]{SushiPropertyQNames.EBI, SushiPropertyQNames.HAMACHI} );
- XmlObject[] propElems = XmlBeanUtils.getChildElements( response, null );
+ final QName[] propNames = new QName[]{SushiPropertyQNames.EBI, SushiPropertyQNames.IKA};
+ GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = getMultipleResourceProperties( propNames );
+ XmlObject[] propElems = XmlBeanUtils.getChildElements( response );
assertNotNull( propElems );
- String value = XmlBeanUtils.getValue( propElems[0] );
- assertEquals( plate.getEbi().getNumberOfPieces(), value );
+ assertEquals( propNames[0], XmlBeanUtils.getName( propElems[0] ) );
+ assertEquals( plate.getEbi().getNumberOfPieces(), XmlBeanUtils.getValue( propElems[0] ) );
}
private GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse getMultipleResourceProperties( QName[] propNames )
@@ -85,5 +110,18 @@
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: incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProviderTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProviderTestCase.java?view=diff&rev=111742&p1=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProviderTestCase.java&r1=111741&p2=incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProviderTestCase.java&r2=111742
==============================================================================
--- incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProviderTestCase.java (original)
+++ incubator/apollo/trunk/src/test/org/apache/ws/resource/properties/porttype/impl/GetResourcePropertyProviderTestCase.java Mon Dec 13 11:07:05 2004
@@ -27,7 +27,8 @@
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
/**
- * Test case for {@link GetResourcePropertyProvider}.
+ * Test case for {@link GetResourcePropertyProvider}, which consists of only one
+ * operation: {@link GetResourcePropertyProvider#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}
*
* @author Sal Campana, Ian Springer
*/
@@ -36,9 +37,9 @@
{
/**
- * Test for {@link GetResourcePropertyProvider#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}.
+ * Tests that a GetRP request for an existing prop returns a GetRPResponse elem containing that prop.
*/
- public void testGetExistingProperty()
+ public void testGetExistingProp()
{
m_resourceContext = new SushiResourceContext();
GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.IKA );
@@ -49,9 +50,9 @@
}
/**
- * Test for {@link GetResourcePropertyProvider#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}.
+ * Tests that a GetRP request for a non-existing optional prop returns an empty GetRPResponse elem.
*/
- public void testGetNonexistingOptionalProperty()
+ public void testGetNonexistingOptionalProp()
{
m_resourceContext = new SushiResourceContext();
GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.UNI );
@@ -61,32 +62,15 @@
}
/**
- * Test for {@link GetResourcePropertyProvider#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}.
+ * 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 testGetNonexistingXsdAnyProperty()
- {
- m_resourceContext = new SushiResourceContext();
- GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.EBI );
- XmlObject[] ebiPropElems = XmlBeanUtils.getChildElements( response, BOGUS_PROP_NAME );
- assertNotNull( ebiPropElems );
- assertEquals( 0, ebiPropElems.length );
- }
-
- /**
- * Test for {@link GetResourcePropertyProvider#getResourceProperty(org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument)}.
- */
- public void testGetInvalidProperty()
+ public void testGetInvalidProp()
{
+ m_resourceContext = new SushiResourceContext( true );
+ assertGetRequestForInvalidPropThrowsFault();
m_resourceContext = new SushiResourceContext( false );
- try
- {
- GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( BOGUS_PROP_NAME );
- fail( response != null ? "Expected fault, but received response." : null );
- }
- catch ( InvalidResourcePropertyQNameFaultException expectedFault )
- {
- return;
- }
+ assertGetRequestForInvalidPropThrowsFault();
}
/**
@@ -111,4 +95,17 @@
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;
+ }
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org