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/06/09 21:22:41 UTC

svn commit: r189799 - /incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java

Author: scamp
Date: Thu Jun  9 12:22:40 2005
New Revision: 189799

URL: http://svn.apache.org/viewcvs?rev=189799&view=rev
Log: (empty)

Modified:
    incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java

Modified: incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java?rev=189799&r1=189798&r2=189799&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java Thu Jun  9 12:22:40 2005
@@ -11,16 +11,21 @@
 import org.apache.ws.util.test.PortListen;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.impl.ManagementEventTypeImpl;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ComponentType;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ComponentAddressType;
 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.InteropConstants;
 import org.wsdmdemo.service.InteropRequestUtils;
 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;
 
 import javax.xml.namespace.QName;
 import java.io.IOException;
@@ -42,12 +47,13 @@
         WEATHER_STATION_1_EPR_DOC = InteropRequestUtils.getEndpointReference(new URL(WEATHER_STATION_1_EPR_URL));
     }
 
+
     public void testNotif() throws FaultException, IOException, XmlException
     {
         //subscribe for op status change.....notice the QName I use for the topic.
         XmlBeansEndpointReference xepr = new XmlBeansEndpointReference(WEATHER_STATION_1_EPR_DOC.getEndpointReference());
         m_resource = new ResourceStub(xepr);
-        EndpointReference subscriptionEndpointReference = m_resource.subscribe("http://12.35.246.160:8001", new QName(MuwsConstants.NSURI_MUWS_PART2_TOPICS, OperationalStatusCapability.TOPIC_NAME));
+        EndpointReference subscriptionEndpointReference = m_resource.subscribe("http://12.35.246.160:8001/notifs", new QName(MuwsConstants.NSURI_MUWS_PART2_TOPICS, OperationalStatusCapability.TOPIC_NAME));
 
         //setup listener
         m_listener = new PortListen(80, 600000);
@@ -76,7 +82,23 @@
             NotificationMessageHolderType noteMess = ele.getNotificationMessageArray(0);
             XmlAnyTypeImpl mess = (XmlAnyTypeImpl) noteMess.getMessage();
             ManagementEventTypeImpl manEvt = (ManagementEventTypeImpl) XmlBeanUtils.getChildElements(mess)[0];
-            //todo...get the epr.....or the address from the epr...
+            ComponentType sourceComponent = manEvt.getSourceComponent();
+            ComponentAddressType sourceCompAddr = sourceComponent.getComponentAddressArray(0);
+
+            //get the epr.....or the address from the epr...
+            //here is the epr and the address of the source of the event....this is the weatherstation which caused the event.
+            EndpointReferenceType sourceEpr = (EndpointReferenceType) XmlBeanUtils.getChildElements(sourceCompAddr)[0];
+            String sourceAddress = sourceEpr.getAddress().getStringValue();
+
+
+            //get the current operational status.....
+            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();
+            String currentStatus = xmlCursor.getTextValue();
+
         }
         catch (Exception e)
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org