You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by sc...@apache.org on 2005/03/29 23:38:00 UTC
svn commit: r159429 - in
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client:
AbstractWsdmInteropTestCase.java WebServicesMgmtTestCase.java
Author: scamp
Date: Tue Mar 29 13:37:59 2005
New Revision: 159429
URL: http://svn.apache.org/viewcvs?view=rev&rev=159429
Log:
Completed testMowsIdentification
Completed testWeatherStationCorrelateableProperties (we need to add a new epr to server)
Modified:
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/AbstractWsdmInteropTestCase.java
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
Modified: incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/AbstractWsdmInteropTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/AbstractWsdmInteropTestCase.java?view=diff&r1=159428&r2=159429
==============================================================================
--- incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/AbstractWsdmInteropTestCase.java (original)
+++ incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/AbstractWsdmInteropTestCase.java Tue Mar 29 13:37:59 2005
@@ -22,11 +22,14 @@
import org.apache.ws.util.test.axis.AbstractOneAxisTestCase;
import org.apache.xmlbeans.XmlAnyURI;
import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlPositiveInteger;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument;
+import org.everestWeather.wsdm.samples.x2005.x04.schema.WeatherstationPropertyQNames;
import javax.xml.namespace.QName;
import java.net.URL;
+import java.math.BigInteger;
/**
* TODO
@@ -121,4 +124,14 @@
return (EndpointReferenceDocument) XmlObject.Factory.parse( url );
}
+ protected BigInteger getFCCID(ResourceStub resource)
+ throws FaultException
+ {
+ XmlObject[] resourceFCCIDArray = resource.getResourceProperty(WeatherstationPropertyQNames.FCCID);
+ XmlObject resourceFCCID = resourceFCCIDArray[0];
+ assertTrue("FCCID was not a xs:positiveInteger", resourceFCCID instanceof XmlPositiveInteger);
+ XmlPositiveInteger resFccidInt = (XmlPositiveInteger) resourceFCCID;
+ BigInteger resFccidBigIntegerValue = resFccidInt.getBigIntegerValue();
+ return resFccidBigIntegerValue;
+ }
}
Modified: incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java?view=diff&r1=159428&r2=159429
==============================================================================
--- incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java (original)
+++ incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java Tue Mar 29 13:37:59 2005
@@ -18,28 +18,37 @@
import org.apache.ws.mows.v1_0.capability.EndpointIdentificationCapability;
import org.apache.ws.mows.v1_0.capability.EndpointMetricsCapability;
import org.apache.ws.mows.v1_0.capability.RequestProcessingStateCapability;
+import org.apache.ws.muws.v1_0.MuwsConstants;
import org.apache.ws.muws.v1_0.capability.CorrelatablePropertiesCapability;
import org.apache.ws.muws.v1_0.capability.IdentityCapability;
import org.apache.ws.muws.v1_0.capability.ManageabilityCharacteristicsCapability;
import org.apache.ws.muws.v1_0.capability.MetricsCapability;
import org.apache.ws.muws.v1_0.capability.RelationshipsCapability;
-import org.apache.ws.muws.v1_0.MuwsConstants;
import org.apache.ws.util.XmlBeanUtils;
import org.apache.xmlbeans.XmlAnyURI;
-import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlDateTime;
+import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlQName;
+import org.everestWeather.wsdm.samples.x2005.x04.schema.WeatherstationPropertyQNames;
import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.DurationMetric;
-import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.IntegerCounter;
import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.EndpointDescriptionsDocument;
-import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;
+import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.IntegerCounter;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.CorrelatablePropertiesType;
-import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmPbm.MatchDocument;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.ReferencePropertiesType;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-import org.everestWeather.wsdm.samples.x2005.x04.schema.WeatherstationPropertyQNames;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
+import java.math.BigInteger;
+import java.net.MalformedURLException;
import java.net.URL;
/**
@@ -53,7 +62,7 @@
public static final String SYSPROP_WEATHER_STATION_EPR_URL = "weather_station.epr";
- private static final String DEFAULT_WEATHER_STATION_EPR_URL = "http://cvs.apache.org/~ips/interop/weather_station-epr.xml";
+ private static final String DEFAULT_WEATHER_STATION_EPR_URL = "http://people.apache.org/~ips/interop/weather_station-epr.xml";
private static final String WEATHER_STATION_EPR_URL = System.getProperty( SYSPROP_WEATHER_STATION_EPR_URL, DEFAULT_WEATHER_STATION_EPR_URL );
private ResourceStub m_resource;
@@ -71,7 +80,7 @@
performMuwsIdentityCharacteristicsAct( m_resource );
}
- public void testMowsIdentification() throws FaultException
+ public void testMowsIdentification() throws FaultException, WSDLException
{
XmlObject[] capabilityElems = m_resource.getResourceProperty( ManageabilityCharacteristicsCapability.PROP_NAME_MANAGEABILITY_CAPABILITY );
assertContainsURI( capabilityElems, EndpointIdentificationCapability.URI );
@@ -84,13 +93,33 @@
assertTrue( epDescsPropElem instanceof EndpointDescriptionsDocument.EndpointDescriptions );
EndpointDescriptionsDocument.EndpointDescriptions epDescs = (EndpointDescriptionsDocument.EndpointDescriptions)epDescsPropElem;
assertTrue( "mows-xs:EndpointDescriptions element is not valid", epDescs.validate() );
- // TODO: validate each endpoint description URLs point to valid WSDLs that each contain a single port
- // with a soap:address that matches the wsa:Address in the mows-xs:EPR
+
+ String[] descriptionArray = epDescs.getDescriptionArray();
+ boolean addressMatch = false;
+ for (int i = 0; i < descriptionArray.length; i++)
+ {
+ String s = descriptionArray[i];
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ Definition definition = wsdlReader.readWSDL(s);
+ assertNotNull("WSDL at location: " + s + " was null.",definition);//valid wsdls
+ assertEquals("There must only be 1 service in the wsdl file.", 1, definition.getServices().size()); //single service
+ Service service = (Service) definition.getServices().values().iterator().next();
+ assertEquals("There must only be 1 port associated with the service in the wsdl file.", 1, service.getPorts().size()); //single port
+ Port port = (Port) service.getPorts().values().iterator().next();
+ SOAPAddress soapAddress = (SOAPAddress) port.getExtensibilityElements().get(0);
+ if(address.equals(soapAddress.getLocationURI()) ) //check that EPR address matches that contained in soap:address
+ {
+ addressMatch = true;
+ }
+ }
+
+ assertTrue("The EPR Address URI did not match any contained in the WSDLS", addressMatch);
}
public void testMowsManageabilityReferences()
{
// TODO: invoke GetManageabilityReferences operation and validate response
+ //the interop doc should be more precise...says WSDL description of or an EPR...should be more concrete to avoid compatibility issues
}
public void testMowsMetrics() throws FaultException
@@ -151,7 +180,7 @@
}
}
- public void testWeatherStationCorrelateableProperties() throws FaultException
+ public void testWeatherStationCorrelateableProperties() throws Exception, MalformedURLException
{
XmlObject[] capabilityElems = m_resource.getResourceProperty( ManageabilityCharacteristicsCapability.PROP_NAME_MANAGEABILITY_CAPABILITY );
assertContainsURI( capabilityElems, CorrelatablePropertiesCapability.URI );
@@ -164,7 +193,26 @@
assertTrue( matchElems[0] instanceof XmlQName );
XmlQName match = (XmlQName) matchElems[0];
assertEquals( WeatherstationPropertyQNames.FCCID, match.getQNameValue() );
- // TODO: validate that the match assertion is true
+
+ BigInteger res1FccidBigIntegerValue = getFCCID(m_resource);
+
+ //get second resource
+ //todo this needs to be generic enough to be transparent... ideally there is another epr to reference (we should add a second)
+ //this will avoid the need to read one in and modify it
+ EndpointReferenceDocument weatherStationEprDoc = getEndpointReference( new URL( WEATHER_STATION_EPR_URL ) );
+ org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType endpointReference = weatherStationEprDoc.getEndpointReference();
+ ReferencePropertiesType referenceProperties = endpointReference.getReferenceProperties();
+
+ //update the ResourceID
+ XmlObject[] childElements = XmlBeanUtils.getChildElements(referenceProperties, new QName("http://everest-weather.org/wsdm/samples/2005/04/schema","ResourceID") );
+ XmlBeanUtils.setValue(childElements[0],"weather2");
+ //end update
+
+ ResourceStub resource2 = new ResourceStub( endpointReference ); //resource2
+ BigInteger res2FccidBigIntegerValue = getFCCID(resource2);
+
+ assertEquals("FCCID's did not match.", res1FccidBigIntegerValue, res2FccidBigIntegerValue);
+
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org