Author: wire
Date: Mon Aug  8 11:30:26 2005
New Revision: 230846

URL: http://svn.apache.org/viewcvs?rev=230846&view=rev
Log:
New Tests

Added:
    
webservices/muse/trunk/src/examples/ieeedemo/client/test/WeatherStationNotifTest.java
    
webservices/muse/trunk/src/examples/ieeedemo/client/test/WsCompatabilityTest.java

Added: 
webservices/muse/trunk/src/examples/ieeedemo/client/test/WeatherStationNotifTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/test/WeatherStationNotifTest.java?rev=230846&view=auto
==============================================================================
--- 
webservices/muse/trunk/src/examples/ieeedemo/client/test/WeatherStationNotifTest.java
 (added)
+++ 
webservices/muse/trunk/src/examples/ieeedemo/client/test/WeatherStationNotifTest.java
 Mon Aug  8 11:30:26 2005
@@ -0,0 +1,209 @@
+/*=============================================================================*

+ *  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.

+ 
*=============================================================================*/

+

+import java.io.IOException;

+

+import javax.xml.namespace.QName;

+

+import junit.framework.TestCase;

+

+import org.apache.ws.addressing.EndpointReference;

+import org.apache.ws.addressing.XmlBeansEndpointReference;

+import org.apache.ws.muws.interop.client.FaultException;

+import org.apache.ws.muws.interop.client.ResourceStub;

+import org.apache.ws.muws.v1_0.MuwsConstants;

+import org.apache.ws.muws.v1_0.capability.OperationalStatusCapability;

+import org.apache.ws.util.XmlBeanUtils;

+import org.apache.ws.util.test.PortListen;

+import org.apache.xmlbeans.XmlCursor;

+import org.apache.xmlbeans.XmlException;

+import org.apache.xmlbeans.XmlObject;

+import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;

+import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ComponentAddressType;

+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ComponentType;

+import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.impl.ManagementEventTypeImpl;

+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;

+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;

+import 
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.ResourcePropertyValueChangeNotificationType;

+import org.wsdmdemo.service.weatherStation.RecalibrateDocument;

+import org.xmlsoap.schemas.soap.envelope.Body;

+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;

+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;

+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;

+

+/**

+ * @author Sal Campana

+ */

+public class WeatherStationNotifTest

+        extends TestCase

+{

+    private static final String WEATHER_STATION_1_EPR_URL ="";

+//            System.getProperty(InteropConstants.SYSPROP_WS1_EPR_URL,

+//                               
"http://localhost:8080/muse/epr/weather-station-1-epr.xml";);

+    private static EndpointReferenceDocument WEATHER_STATION_1_EPR_DOC;

+    private ResourceStub m_resource;

+    private PortListen m_listener;

+

+    /**

+     * The actual unit test...well not really a unit test but still....

+     *

+     * @throws FaultException

+     * @throws IOException

+     * @throws XmlException

+     */

+    public void testNotif()

+            throws FaultException,

+                   IOException,

+                   XmlException

+    {

+        //build a resource stub for the weather station you plan to talk to

+        XmlBeansEndpointReference xepr =

+                new 
XmlBeansEndpointReference(WEATHER_STATION_1_EPR_DOC.getEndpointReference());

+        m_resource = new ResourceStub(xepr);

+

+        //make sure to have path in consumer url...not sure if he still needs 
it be we had added at one point

+        String consumerUrl = "http://12.35.246.160:8001/notifs";;

+

+        //subscribe for the events

+        EndpointReference subscriptionEPR = 
subscribeForOperationalStatusChangeEvents(consumerUrl, m_resource);

+

+        //setup port listener

+        m_listener = new PortListen(80, 600000);

+

+        //call recalibrate (after noticing erratic behavior) on webservice to 
trigger the status change evennt

+        sendRecalibrateRequest(xepr);

+

+        //listen for operational change notif    ...this will actually capture 
any message that comes in...

+        String messageText = m_listener.waitForIncomingMessage();

+

+        //upon notification.......dump to standard out for debugging

+        System.out.println(messageText);

+

+        try

+        {

+            //parse out the managementevent

+            ManagementEventTypeImpl manEvt = parseManagementEvent(messageText);

+

+            //here is the epr and the address of the source of the 
event....this is the weatherstation which caused the event.

+            EndpointReferenceType sourceEpr = parseSourceEpr(manEvt);

+            String sourceAddress = sourceEpr.getAddress().getStringValue();

+

+            //get the current operational status.....

+            String currentOperationalStatus = 
parseCurrentOperationalStatus(manEvt);

+

+            //try again to get the available message ...this was to debug 
their end....

+            m_listener = new PortListen(80, 600000);

+            String messageText2 = m_listener.waitForIncomingMessage();

+        }

+        catch (Exception e)

+        {

+            e.printStackTrace();

+        }

+    }

+

+

+    protected void setUp()

+            throws Exception

+    {

+        //init the epr

+      //  WEATHER_STATION_1_EPR_DOC = 
InteropRequestUtils.getEndpointReference(new URL(WEATHER_STATION_1_EPR_URL));

+    }

+

+    /**

+     * Gets the current OperationalStatus from the ManagementEvent

+     *

+     * @param manEvt

+     * @return OperationalStatus (i.e. Available)

+     */

+    private String parseCurrentOperationalStatus(ManagementEventTypeImpl 
manEvt)

+    {

+        XmlObject[] childElements = XmlBeanUtils.getChildElements(manEvt);

+        ResourcePropertyValueChangeNotificationType propChange =

+                (ResourcePropertyValueChangeNotificationType) childElements[3];

+        ResourcePropertyValueChangeNotificationType.NewValue newValue = 
propChange.getNewValue();

+        XmlObject operationalStatus =

+                XmlBeanUtils.getChildElements(newValue)[0];

+        XmlCursor xmlCursor = operationalStatus.newCursor();

+        return xmlCursor.getTextValue();

+    }

+

+    /**

+     * Parses the ManagementEvent out of the SOAPEnvelope

+     *

+     * @param messageText

+     * @return ManagementEvent

+     * @throws XmlException

+     */

+    private ManagementEventTypeImpl parseManagementEvent(String messageText)

+            throws XmlException

+    {

+        EnvelopeDocument ed = (EnvelopeDocument) 
XmlObject.Factory.parse(messageText);

+        org.xmlsoap.schemas.soap.envelope.Envelope env = ed.getEnvelope();

+        Body body = env.getBody();

+        XmlObject[] arryStuff = XmlBeanUtils.getChildElements(body);

+        NotifyDocument.Notify ele = (NotifyDocument.Notify) arryStuff[0];

+        NotificationMessageHolderType noteMess = 
ele.getNotificationMessageArray(0);

+        XmlAnyTypeImpl mess = (XmlAnyTypeImpl) noteMess.getMessage();

+        ManagementEventTypeImpl manEvt =

+                (ManagementEventTypeImpl) 
XmlBeanUtils.getChildElements(mess)[0];

+        return manEvt;

+    }

+

+    /**

+     * Parses the source (web service which threw event) epr from the 
ManagementEvent

+     *

+     * @param manEvt

+     * @return Source EPR

+     */

+    private EndpointReferenceType parseSourceEpr(ManagementEventTypeImpl 
manEvt)

+    {

+        ComponentType sourceComponent = manEvt.getSourceComponent();

+        ComponentAddressType sourceCompAddr = 
sourceComponent.getComponentAddressArray(0);

+        EndpointReferenceType sourceEpr =

+                (EndpointReferenceType) 
XmlBeanUtils.getChildElements(sourceCompAddr)[0];

+        return sourceEpr;

+    }

+

+    /**

+     * Sends a recalibrate call to the webservice.....

+     *

+     * @param xepr

+     */

+    private void sendRecalibrateRequest(XmlBeansEndpointReference xepr)

+    {

+        ResourceStub sstub = new ResourceStub(xepr);

+        RecalibrateDocument recalibrateDocument = 
RecalibrateDocument.Factory.newInstance();

+        recalibrateDocument.addNewRecalibrate();

+//        sstub.sendRequest(recalibrateDocument,

+//                          "http://recalibrate";);

+    }

+

+    /**

+     * Subscribes for OperationalStatusCapability Notifications

+     *

+     * @param consumerUrl

+     * @param resourceStub

+     * @throws FaultException

+     */

+    private EndpointReference subscribeForOperationalStatusChangeEvents(String 
consumerUrl,

+                                                                        
ResourceStub resourceStub)

+            throws FaultException

+    {

+        return resourceStub.subscribe(consumerUrl,

+                                      new 
QName(MuwsConstants.NSURI_MUWS_PART2_TOPICS,

+                                                
OperationalStatusCapability.TOPIC_NAME));

+    }

+}
\ No newline at end of file

Added: 
webservices/muse/trunk/src/examples/ieeedemo/client/test/WsCompatabilityTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/test/WsCompatabilityTest.java?rev=230846&view=auto
==============================================================================
--- 
webservices/muse/trunk/src/examples/ieeedemo/client/test/WsCompatabilityTest.java
 (added)
+++ 
webservices/muse/trunk/src/examples/ieeedemo/client/test/WsCompatabilityTest.java
 Mon Aug  8 11:30:26 2005
@@ -0,0 +1,341 @@
+import java.io.IOException;

+import java.util.Calendar;

+import java.util.Set;

+import java.util.TreeSet;

+

+import javax.xml.namespace.QName;

+

+import junit.framework.TestCase;

+

+import org.apache.interop.smgr.MessageListener;

+import org.apache.interop.smgr.NotificationListener;

+import org.apache.ws.addressing.EndpointReference;

+import org.apache.ws.addressing.XmlBeansEndpointReference;

+import org.apache.ws.addressing.v2004_08_10.AddressingConstants;

+import org.apache.ws.muws.interop.client.FaultException;

+import org.apache.ws.muws.interop.client.ResourceStub;

+import org.apache.ws.muws.v1_0.MuwsConstants;

+import org.apache.ws.muws.v1_0.capability.OperationalStatusCapability;

+import org.apache.xmlbeans.GDuration;

+import org.apache.xmlbeans.XmlException;

+import org.apache.xmlbeans.XmlObject;

+import org.apache.xmlbeans.impl.values.XmlDoubleImpl;

+import org.apache.xmlbeans.impl.values.XmlStringImpl;

+import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.impl.DurationMetricImpl;

+import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.impl.ManagementEventTypeImpl;

+import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.impl.OperationalStatusDocumentImpl;

+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;

+import org.wsdmdemo.service.weatherStation.RecalibrateDocument;

+import org.wsdmdemo.service.weatherStation.impl.PriceDocumentImpl;

+import org.wsdmdemo.service.weatherStation.impl.TemperatureMetricTypeImpl;

+import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;

+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;

+import org.apache.interop.wcmgr.WcMgrApp;

+/**

+ * Objective: 

+ * 

+ * This test can be applied to an Interop Weather Station resource to

+ * see if it will be compatable with the the weather station demo 

+ * applications

+ * 

+ * @author William Reichardt, HP

+ * @version 1.0.0

+ * 

+ */

+public class WsCompatabilityTest extends TestCase  {

+       

+       /** 

+        * Should be of the form:

+        *              
http://66.57.65.244:4400/ettk/wsdm/services/WeatherStation 

+        */

+       private static String weatherStationURL;

+       

+       /**

+        * Can be absent or null to indicate a singleton

+        */

+       private static String weatherStationRid;  

+       

+       private static String weatherStationListenerHostname;

+       

+       private static final int LISTENER_PORT = 8089;

+       private static final int NOTIFICATION_TIMEOUT = 60000;

+       private static final QName weatherStationNameQname= new 
QName("http://wsdmdemo.org/service/weather-station";, "Name", "tns");

+       private static final QName weatherStationTemperatureQname= new 
QName("http://wsdmdemo.org/service/weather-station","Temperature";);

+       private static final QName weatherStationPricepQname= new 
QName("http://wsdmdemo.org/service/weather-station","Price";);

+       private static final QName weatherStationStatusQname= new 
QName("http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd";, 
"OperationalStatus", "muws-p2-xs");

+       private static final QName weatherStationLastResponseTime = new QName( 
"http://docs.oasis-open.org/wsdm/2004/12/mows/wsdm-mows.xsd";, 
"LastResponseTime", "mows-xs");        

+       private static final QName weatherStationStatusTopic=new 
QName(MuwsConstants.NSURI_MUWS_PART2_TOPICS,OperationalStatusCapability.TOPIC_NAME);

+

+       private EndpointReference m_wsEpr;

+       private ResourceStub m_wsResourceStub;

+       private NotificationListener m_listener;

+       

+       /**

+        * This buffer acts as lock provider for the unit test thread

+        * while waiting for received notifications.

+        */

+       private StringBuffer m_buffer=new StringBuffer();

+

+       

+       protected void setUp() throws Exception {

+               super.setUp();

+               
weatherStationURL=System.getProperty("WeatherStationServiceURL");

+               
weatherStationRid=System.getProperty("WeatherStationServiceResourceID");  

+               
weatherStationListenerHostname=System.getProperty("WeatherStationListenerHostname");

+               
m_wsEpr=getEpr(weatherStationURL,weatherStationRid,weatherStationNameQname);

+               m_wsResourceStub=new ResourceStub( m_wsEpr );

+       }

+

+       protected void tearDown() throws Exception {

+               super.tearDown();

+               m_wsEpr=null;

+               m_wsResourceStub=null;

+               if(m_listener!=null){

+                       m_listener.stop();

+                       m_listener=null;

+               }

+       }

+       

+       /**

+        * Objective: Test for price in range of 0.01 to 0.99.

+        * Test to see that price returned is constant.

+        * @throws FaultException 

+        *

+        */     

+       public void testGetPrice() throws FaultException{

+               XmlObject[] 
priceArry=m_wsResourceStub.getResourceProperty(weatherStationPricepQname);

+               assertNotNull(priceArry);

+               assertTrue(priceArry.length>0);

+               

+               assertTrue("The response document was not a XmlDoubleImpl. This 
may indicate that you are missing the xbean jars for the Weather Station. 
Confirm that they are on the classpath and try again.",

+                               priceArry[0] instanceof XmlDoubleImpl);

+

+               XmlDoubleImpl priceDocument=(XmlDoubleImpl) priceArry[0];

+               double price = priceDocument.getDoubleValue();

+               assertTrue("Weather Station prices should be greater than 
zero.",price>0.0);

+               assertTrue("Weather Station prices should be less than 
$1.00.",price<1.0);                                                             
         

+       }

+       

+       /**

+        * Objective: Make sure init status is good.

+        * Cause status to change and then check it for failuire and

+        * then wait for it to return to good within a timeframe.

+        * @throws FaultException 

+        *

+        */

+       public void testGetStatus() throws FaultException{

+               XmlObject[] 
statArry=m_wsResourceStub.getResourceProperty(weatherStationStatusQname);

+               assertNotNull(statArry);

+               assertTrue(statArry.length>0);

+               assertTrue("The response document was not a 
OperationalStatusDocumentImpl.OperationalStatusImpl. This may indicate that you 
are missing the xbean jars for the Weather Station. Confirm that they are on 
the classpath and try again.",

+                               statArry[0] instanceof 
OperationalStatusDocumentImpl.OperationalStatusImpl);

+               OperationalStatusDocumentImpl.OperationalStatusImpl 
statusDocument=(OperationalStatusDocumentImpl.OperationalStatusImpl)statArry[0];

+               String status = statusDocument.getStringValue();

+               assertNotNull(status);

+               assertEquals("Available",status);

+               

+               // TODO  Not Done, Force it unavailable

+       }

+       

+       /**

+        * Make sure a station name is returned.

+        * @throws FaultException 

+        *

+        */

+       public void testGetStationName() throws FaultException{

+               XmlObject[] 
nameArry=m_wsResourceStub.getResourceProperty(weatherStationNameQname);

+               assertNotNull(nameArry);

+               assertTrue(nameArry.length>0);

+               assertTrue("The response document was not a XmlStringImpl. This 
may indicate that you are missing the xbean jars for the Weather Station. 
Confirm that they are on the classpath and try again.",

+                               nameArry[0] instanceof XmlStringImpl);

+               XmlStringImpl nameDocument=(XmlStringImpl)nameArry[0];

+               String status = nameDocument.getStringValue();

+               assertNotNull(status);

+               assertTrue("Returned Station Name Should Not be the empty 
string. Try using your Resource ID.",status.length()>0);

+               

+       }

+

+       /**

+        * Collect multiple temeratures. 

+        * Make sure the variance is between 75-79 degrees.

+        * @throws FaultException 

+        */

+       public void testGetTemperature() throws FaultException{

+               Set results= new TreeSet();

+               for (int i = 0; i < 50; i++) {

+                       Double temp=new Double(getCurrentTemperature());

+                       if(!results.contains(temp)){

+                               results.add(temp);

+                       }

+               }

+               

+               assertTrue("Reported temperatures must vary. They cannot be 
constant.",results.size()>1);

+       }

+

+       private double getCurrentTemperature() throws FaultException {

+               XmlObject[] 
responseArry=m_wsResourceStub.getResourceProperty(weatherStationTemperatureQname);

+               assertNotNull(responseArry);

+               assertTrue(responseArry.length>0);

+

+               assertTrue("The response document was not a 
TemperatureMetricTypeImpl. This may indicate that you are missing the xbean 
jars for the Weather Station. Confirm that they are on the classpath and try 
again.",

+                               responseArry[0] instanceof 
TemperatureMetricTypeImpl);

+               

+               TemperatureMetricTypeImpl 
temperatureMetric=(TemperatureMetricTypeImpl)responseArry[0];

+               assertNotNull(temperatureMetric);

+                               

+               double temperature = temperatureMetric.doubleValue();

+               assertTrue("Temperature should be 75 Degrees or higher during 
normal operation.",temperature>=75.0);

+               assertTrue("Temperature should be 78 Degrees or less during 
normal operation. Your station reported "+temperature+" 
degrees.",temperature<=78.0);

+               return temperature;

+       }

+       /**

+        * This test makes sure that a returned response time has been filled 
out fully.

+        * It does not yet check to see if they change orver time or if your 
last reset or

+        * last updated values are meaningful or even different. This will come 
soon

+        * @throws FaultException

+        */

+       public void testGetResponseTime() throws FaultException{

+               //TODO check for variations in response time, reset and updated 
values over time. 

+               XmlObject[] 
durationArry=m_wsResourceStub.getResourceProperty(weatherStationLastResponseTime);

+               assertNotNull(durationArry);

+               assertTrue(durationArry.length>0);

+               assertTrue("The response document was not a DurationMetricImpl. 
This may indicate that you are missing the xbean jars for the Weather Station. 
Confirm that they are on the classpath and try again.",

+                               durationArry[0] instanceof DurationMetricImpl);

+               

+               DurationMetricImpl 
durationMetric=(DurationMetricImpl)durationArry[0];

+               assertNotNull(durationMetric);

+               GDuration gduration=durationMetric.getGDurationValue();

+               assertNotNull(gduration);

+               //ex P1Y2M3DT4H5M6.789S

+               String durationString=gduration.toString();

+               assertTrue(durationString.startsWith("P"));

+               assertTrue(durationString.endsWith("S"));

+               Calendar timeUpdated = durationMetric.getLastUpdated();

+               assertNotNull(timeUpdated);

+               Calendar timeReset = durationMetric.getResetAt();

+               assertNotNull(timeReset);

+               assertTrue(durationMetric.isSetLastUpdated());

+               assertTrue(durationMetric.isSetResetAt());

+                               

+       }

+       

+       /** 

+        * Objectives:

+        * When a recalibrate is issued, status should become unavailable then

+        * after a short window, become available again. 

+        * Create a listener.

+        * Subscribe for status notficiation.

+        * force the weather station offline.

+        * Wait for a timeout period to receive a notification of unavailable

+        * Wait for about a minute to receive notification of available

+        * Verify its content

+        * @throws IOException 

+        * @throws InterruptedException 

+        * @throws XmlException 

+        * @throws FaultException 

+        *

+        */

+       public void testRecalibrate() throws IOException, InterruptedException, 
XmlException, FaultException{

+               // Start Listener, Notifications will be passed to 

+               m_listener=new 
NotificationListener(LISTENER_PORT,NOTIFICATION_TIMEOUT,m_buffer);

+               m_listener.start();

+               

+               // Subscribe

+               assertNotNull("Please define the WeatherStationListenerHostname 
System property.",weatherStationListenerHostname);

+               String notificationURL = 
"http://"+weatherStationListenerHostname+":"+LISTENER_PORT+"/unittest";;

+               EndpointReference subscriptionEpr = 
m_wsResourceStub.subscribe(notificationURL,weatherStationStatusTopic);

+               assertNotNull(subscriptionEpr);

+               

+               // Unit test thread will now block until a notification or a 
timeout occurs

+               synchronized(m_buffer){

+               RecalibrateDocument recalibrateDocument = 
RecalibrateDocument.Factory.newInstance();

+               recalibrateDocument.addNewRecalibrate();

+               XmlObject recalResponse = 
m_wsResourceStub.sendRequest(recalibrateDocument,"http://recalibrate","M";);

+                       assertNotNull(recalResponse);

+                       m_buffer.wait();

+               }

+               

+               synchronized(m_buffer){

+                       String messageText=m_buffer.toString();         

+                       m_buffer.notify();// Release the buffer

+                       String status = extractStatus(messageText);

+                       assertEquals("Your weather station did not report 
unavailable in response to recalibrate","Unavailable",status);

+               }

+               // There should be an available notification too

+               synchronized(m_buffer){

+                       m_buffer.wait();

+               }

+

+               synchronized(m_buffer){

+                       String messageText=m_buffer.toString();         

+                       m_buffer.notify();// Release the buffer

+                       String status = extractStatus(messageText);

+                       assertEquals("Your weather station did not report 
available after unavailable in response to recalibrate","Available",status);

+               }

+       }

+

+       private String extractStatus(String messageText) throws XmlException {

+               // If we get here there is something in our buffer

+               System.out.println("Notification Starts.");

+               System.out.println(messageText);

+               System.out.println("Notification Ends.");

+

+               // Break down the message

+               NotificationMessageHolderType noteMess = 
WcMgrApp.getNotificationMessageHolder(messageText);

+               assertNotNull(noteMess);

+               ManagementEventTypeImpl manEvt = 
WcMgrApp.parseManagementEvent(noteMess);                               

+               assertNotNull(manEvt);

+               String optStatus = 
WcMgrApp.parseCurrentOperationalStatus(manEvt);

+               assertNotNull(optStatus);

+               EndpointReferenceType epr = WcMgrApp.parseSourceEpr(noteMess);

+               assertNotNull(epr);

+               assertNotNull("You are required to provide a vailid Source Epr 
for your notifications.",epr);

+               AttributedURI address = epr.getAddress();

+               assertNotNull(address);

+               assertEquals("The Source EPR address should match your 
service's EPR for the clients to identify the origination of your 
notification.",weatherStationURL,address.getStringValue());

+               return optStatus;

+       }

+       

+       /**

+        * Objectives:

+        * When a kick is issued, weather readings should drop out of the 
expected range.

+        *

+        */

+       public void testForKickResponse(){

+                               

+       }

+       

+       

+       /**

+        * Builds an EPR for text.

+        * @param URL

+        * @param Rid

+        * @param weatherStationNameQname

+        * @return

+        * @throws XmlException

+        */

+       private EndpointReference getEpr(String URL, String Rid, QName 
weatherStationNameQname) throws XmlException{

+               XmlBeansEndpointReference x=new 
XmlBeansEndpointReference(URL,AddressingConstants.NSURI_ADDRESSING_SCHEMA);

+               if(Rid!=null)

+                       x.setReferenceProperties(new 
XmlObject[]{(XmlObject)XmlObject.Factory.parse("<svr:ResourceIdentifier 
xmlns:svr=\""+weatherStationNameQname.getNamespaceURI()+"\">"+Rid+"</svr:ResourceIdentifier>")});
          

+               return x;               

+       }

+

+       public static void main(String[] args) {

+               if(args.length==0){

+                       System.out.println("Usage: wstest <ServiceURL> 
<ServiceResourceID> <ListenerHostname>");

+                       return;

+               }

+               if(args.length>=1)

+                       System.setProperty("WeatherStationServiceURL",args[0]);

+               if(args.length>=2)

+                       
System.setProperty("WeatherStationServiceResourceID",args[1]);

+               if(args.length>=3)

+                       
System.setProperty("WeatherStationListenerHostname",args[2]);

+               

+               

+               junit.swingui.TestRunner.run(WsCompatabilityTest.class);

+       }

+

+

+}




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to