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 22:06:33 UTC
svn commit: r189806 -
/incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java
Author: scamp
Date: Thu Jun 9 13:06:32 2005
New Revision: 189806
URL: http://svn.apache.org/viewcvs?rev=189806&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=189806&r1=189805&r2=189806&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/test/WeatherStationNotifTest.java Thu Jun 9 13:06:32 2005
@@ -30,6 +30,7 @@
import javax.xml.namespace.QName;
import java.io.IOException;
import java.net.URL;
+import java.net.MalformedURLException;
/**
* @author Sal Campana
@@ -50,24 +51,27 @@
public void testNotif() throws FaultException, IOException, XmlException
{
- //subscribe for op status change.....notice the QName I use for the topic.
+ //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);
- EndpointReference subscriptionEndpointReference = m_resource.subscribe("http://12.35.246.160:8001/notifs", new QName(MuwsConstants.NSURI_MUWS_PART2_TOPICS, OperationalStatusCapability.TOPIC_NAME));
+
+
+ //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
+ subscribeForOperationalStatusChangeEvents(consumerUrl, m_resource);
//setup listener
m_listener = new PortListen(80, 600000);
//call recalibrate (after noticing erratic behavior) to trigger the status change evennt
- ServiceStub sstub = new ServiceStub(new URL(xepr.getAddress()));
- RecalibrateDocument recalibrateDocument = RecalibrateDocument.Factory.newInstance();
- recalibrateDocument.addNewRecalibrate();
- sstub.sendRequest(recalibrateDocument, "http://kickme", new URL(xepr.getAddress()));
+ sendRecalibrateRequest(xepr);
//listen for operational change notif ...this will actually capture any message that comes in...
String messageText = m_listener.waitForIncomingMessage();
-
//upon notification.......
System.out.println(messageText);
@@ -93,6 +97,21 @@
{
e.printStackTrace();
}
+ }
+
+ private void subscribeForOperationalStatusChangeEvents(String consumerUrl, ResourceStub resourceStub)
+ throws FaultException
+ {
+ EndpointReference subscriptionEndpointReference = resourceStub.subscribe(consumerUrl, new QName(MuwsConstants.NSURI_MUWS_PART2_TOPICS, OperationalStatusCapability.TOPIC_NAME));
+ }
+
+ private void sendRecalibrateRequest(XmlBeansEndpointReference xepr)
+ throws MalformedURLException
+ {
+ ServiceStub sstub = new ServiceStub(new URL(xepr.getAddress()));
+ RecalibrateDocument recalibrateDocument = RecalibrateDocument.Factory.newInstance();
+ recalibrateDocument.addNewRecalibrate();
+ sstub.sendRequest(recalibrateDocument, "http://kickme", new URL(xepr.getAddress()));
}
private String parseCurrentOperationalStatus(ManagementEventTypeImpl manEvt)
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org