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/01 23:09:01 UTC
svn commit: r179421 - in /incubator/muse/trunk/src/ieeedemo: eprs/ lib/
src/java/org/wsdmdemo/service/
src/java/org/wsdmdemo/service/weatherClientConfig/
src/java/org/wsdmdemo/service/weatherStation/
src/java/org/wsdmdemo/service/weatherStation/callbacks/ src/test/
Author: scamp
Date: Wed Jun 1 14:09:00 2005
New Revision: 179421
URL: http://svn.apache.org/viewcvs?rev=179421&view=rev
Log: (empty)
Added:
incubator/muse/trunk/src/ieeedemo/eprs/
incubator/muse/trunk/src/ieeedemo/eprs/weather-client-config-epr.xml
incubator/muse/trunk/src/ieeedemo/eprs/weather-station-1-epr.xml
incubator/muse/trunk/src/ieeedemo/eprs/weather-station-2-epr.xml
incubator/muse/trunk/src/ieeedemo/eprs/weather-station-dir-epr.xml
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/CallbackUtils.java
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/HumidityCallback.java
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/TemperatureCallback.java
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/VisibilityCallback.java
incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java
Modified:
incubator/muse/trunk/src/ieeedemo/lib/weather-client-config-xbeans.jar
incubator/muse/trunk/src/ieeedemo/lib/weather-station-dir-xbeans.jar
incubator/muse/trunk/src/ieeedemo/lib/weather-station-xbeans.jar
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigHome.java
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java
incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java
Added: incubator/muse/trunk/src/ieeedemo/eprs/weather-client-config-epr.xml
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/eprs/weather-client-config-epr.xml?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/eprs/weather-client-config-epr.xml (added)
+++ incubator/muse/trunk/src/ieeedemo/eprs/weather-client-config-epr.xml Wed Jun 1 14:09:00 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <Address>http://localhost:8080/muse/services/WeatherClientConfig</Address>
+ <ReferenceProperties>
+ <svr:ResourceIdentifier xmlns:svr="http://wsdmdemo.org/service/weather-client-config">weather-client-config-1</svr:ResourceIdentifier>
+ </ReferenceProperties>
+</EndpointReference>
+
Added: incubator/muse/trunk/src/ieeedemo/eprs/weather-station-1-epr.xml
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/eprs/weather-station-1-epr.xml?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/eprs/weather-station-1-epr.xml (added)
+++ incubator/muse/trunk/src/ieeedemo/eprs/weather-station-1-epr.xml Wed Jun 1 14:09:00 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <Address>http://localhost:8080/muse/services/WeatherStation</Address>
+ <ReferenceProperties>
+ <svr:ResourceIdentifier xmlns:svr="http://wsdmdemo.org/service/weather-station">weather-station-1</svr:ResourceIdentifier>
+ </ReferenceProperties>
+</EndpointReference>
+
Added: incubator/muse/trunk/src/ieeedemo/eprs/weather-station-2-epr.xml
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/eprs/weather-station-2-epr.xml?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/eprs/weather-station-2-epr.xml (added)
+++ incubator/muse/trunk/src/ieeedemo/eprs/weather-station-2-epr.xml Wed Jun 1 14:09:00 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <Address>http://localhost:8080/muse/services/WeatherStation</Address>
+ <ReferenceProperties>
+ <svr:ResourceIdentifier xmlns:svr="http://wsdmdemo.org/service/weather-station">weather-station-2</svr:ResourceIdentifier>
+ </ReferenceProperties>
+</EndpointReference>
+
Added: incubator/muse/trunk/src/ieeedemo/eprs/weather-station-dir-epr.xml
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/eprs/weather-station-dir-epr.xml?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/eprs/weather-station-dir-epr.xml (added)
+++ incubator/muse/trunk/src/ieeedemo/eprs/weather-station-dir-epr.xml Wed Jun 1 14:09:00 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <Address>http://localhost:8080/muse/services/WeatherStationDir</Address>
+ <ReferenceProperties>
+
+ </ReferenceProperties>
+</EndpointReference>
+
Modified: incubator/muse/trunk/src/ieeedemo/lib/weather-client-config-xbeans.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/lib/weather-client-config-xbeans.jar?rev=179421&r1=179420&r2=179421&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/muse/trunk/src/ieeedemo/lib/weather-station-dir-xbeans.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/lib/weather-station-dir-xbeans.jar?rev=179421&r1=179420&r2=179421&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/muse/trunk/src/ieeedemo/lib/weather-station-xbeans.jar
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/lib/weather-station-xbeans.jar?rev=179421&r1=179420&r2=179421&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java?rev=179421&r1=179420&r2=179421&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java Wed Jun 1 14:09:00 2005
@@ -12,8 +12,9 @@
/** Resource Keys for the Weather Stations **/
String WS1_KEY = "weather-station-1";
String WS2_KEY = "weather-station-2";
+
/** default relationship **/
- QName RELATIONSHIP_RELATION = new QName(WeatherStationDirHome.SERVICE_NAME.getNamespaceURI(), "contains", "wsdir");
+ QName RELATIONSHIP_RELATION = new QName(WeatherStationDirHome.SERVICE_NAME.getNamespaceURI(), "Contains", "wsdir");
/** Directory service Muws ResourceID **/
String DIR_RESOURCEID = "urn:SINGLETON";
@@ -24,4 +25,13 @@
/** BASE SERVICE ADDRESS **/
String BASE_ADDRESS = System.getProperty("BASE_ADDRESS","http://localhost:8080/muse/services/WeatherStationDir");
+ double MAX_HUMIDITY = 99.9;
+ double MIN_HUMIDITY = 02.0;
+ double DEFAULT_HUMIDITY = 36.0;
+ double DEFAULT_TEMP = 79.0;
+ double DEFAULT_VISIBILITY = 16.09;
+ double MAX_VISIBILITY = 0.1;
+ double MIN_VISIBILITY = 45.0;
+ int MAX_TEMP = 120;
+ int MIN_TEMP = 0;
}
Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigHome.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigHome.java?rev=179421&r1=179420&r2=179421&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigHome.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigHome.java Wed Jun 1 14:09:00 2005
@@ -73,7 +73,7 @@
catch (ResourceException re)
{
Object id = key.getValue();
- //create as many clients as requested...todo..may need to define 1....
+ //create as many clients as requested...
try
{
WeatherClientConfigResource myresource = (WeatherClientConfigResource) createInstance(key); //this will create the resource IF it is has default constructor. It also calls init() on the resource.
Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java?rev=179421&r1=179420&r2=179421&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java Wed Jun 1 14:09:00 2005
@@ -62,7 +62,8 @@
public WeatherStationHome()
{
- try
+ super();
+ /* try
{
//bootstrap the weather stations todo not sure we need to do this
SimpleTypeResourceKey ws1Key = new SimpleTypeResourceKey(RESOURCE_KEY_NAME, InteropConstants.WS1_KEY);
@@ -86,7 +87,7 @@
catch (ResourceException e)
{
e.printStackTrace();
- }
+ }*/
}
private void registerWeatherStation(EndpointReference epr)
Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java?rev=179421&r1=179420&r2=179421&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationResource.java Wed Jun 1 14:09:00 2005
@@ -10,6 +10,9 @@
import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;
import org.wsdmdemo.service.InteropConstants;
+import org.wsdmdemo.service.weatherStation.callbacks.VisibilityCallback;
+import org.wsdmdemo.service.weatherStation.callbacks.TemperatureCallback;
+import org.wsdmdemo.service.weatherStation.callbacks.HumidityCallback;
import org.wsdmdemo.service.weatherStationDir.WeatherStationDirPropertyQNames;
import java.util.Calendar;
@@ -100,27 +103,28 @@
org.wsdmdemo.service.weatherStation.VisibilityDocument prop_visibility = org.wsdmdemo.service.weatherStation.VisibilityDocument.Factory.newInstance();
org.wsdmdemo.service.weatherStation.VisibilityMetricType visibilityMetricType = prop_visibility.addNewVisibility();
visibilityMetricType.setResetAt(resetAt);
- visibilityMetricType.setDoubleValue(16.09);
+ visibilityMetricType.setDoubleValue(InteropConstants.DEFAULT_VISIBILITY);
resourceProperty.add(prop_visibility);
+ resourceProperty.setCallback(new VisibilityCallback());
// init the {http://wsdmdemo.org/service/weather-station}Temperature Resource Property
resourceProperty = resourcePropertySet.get(WeatherStationPropertyQNames.TEMPERATURE);
org.wsdmdemo.service.weatherStation.TemperatureDocument prop_temperature = org.wsdmdemo.service.weatherStation.TemperatureDocument.Factory.newInstance();
org.wsdmdemo.service.weatherStation.TemperatureMetricType temperatureMetricType = prop_temperature.addNewTemperature();
- temperatureMetricType.setDoubleValue(79.0);
+ temperatureMetricType.setDoubleValue(InteropConstants.DEFAULT_TEMP);
temperatureMetricType.setResetAt(resetAt);
resourceProperty.add(prop_temperature);
- //resourceProperty.addChangeListener(mowsMetricsCapability); todo do we want to expose mows metrics capability?
+ resourceProperty.setCallback(new TemperatureCallback());
// init the {http://wsdmdemo.org/service/weather-station}Humidity Resource Property
resourceProperty = resourcePropertySet.get(WeatherStationPropertyQNames.HUMIDITY);
org.wsdmdemo.service.weatherStation.HumidityDocument prop_humidity = org.wsdmdemo.service.weatherStation.HumidityDocument.Factory.newInstance();
org.wsdmdemo.service.weatherStation.HumidityMetricType humidityMetricType = prop_humidity.addNewHumidity();
- humidityMetricType.setDoubleValue(36.0);
+ humidityMetricType.setDoubleValue(InteropConstants.DEFAULT_HUMIDITY);
humidityMetricType.setResetAt(resetAt);
resourceProperty.add(prop_humidity);
-
+ resourceProperty.setCallback(new HumidityCallback());
// init the {http://wsdmdemo.org/service/weather-station}Price Resource Property
resourceProperty = resourcePropertySet.get(WeatherStationPropertyQNames.PRICE);
Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java?rev=179421&r1=179420&r2=179421&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationService.java Wed Jun 1 14:09:00 2005
@@ -92,7 +92,7 @@
//set status to unavailable
changeOperationalStatus(OperationalStatusDocument.OperationalStatus.UNAVAILABLE);
-
+ //todo spawn thread with timer to reset the op status to avail
return responseDocument;
}
Added: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/CallbackUtils.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/CallbackUtils.java?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/CallbackUtils.java (added)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/CallbackUtils.java Wed Jun 1 14:09:00 2005
@@ -0,0 +1,51 @@
+package org.wsdmdemo.service.weatherStation.callbacks;
+
+
+/**
+ * @author Sal Campana
+ */
+public class CallbackUtils
+{
+
+ /**
+ * Returns a random value within a given range.
+ *
+ * @param lastValue
+ * @param maxValue
+ * @param minValue
+ * @return a new random value
+ */
+ public static double getNextRandomValue(double lastValue, double maxValue, double minValue)
+ {
+ double rand = 100 * Math.random();
+ double mod = Math.round(100 * Math.random());
+ if (lastValue == -1)
+ {
+ lastValue = (double) Math.round(100 * Math.random());
+ }
+ else
+ {
+ double deflection = (double) Math.round(5 * Math.random());
+ double direction = (double) Math.round(2 * Math.random());
+
+ if (direction == 1)
+ {
+ lastValue = lastValue + deflection;
+ }
+ else
+ {
+ lastValue = lastValue - deflection;
+ }
+ if (lastValue < minValue)
+ {
+ lastValue = minValue;
+ }
+ if (lastValue > maxValue)
+ {
+ lastValue = maxValue;
+ }
+ }
+
+ return lastValue;
+ }
+}
Added: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/HumidityCallback.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/HumidityCallback.java?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/HumidityCallback.java (added)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/HumidityCallback.java Wed Jun 1 14:09:00 2005
@@ -0,0 +1,27 @@
+package org.wsdmdemo.service.weatherStation.callbacks;
+
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.wsdmdemo.service.InteropConstants;
+
+import java.util.Calendar;
+
+
+/**
+ * @author Sal Campana
+ */
+public class HumidityCallback implements ResourcePropertyCallback
+{
+ private double m_lastTemp = InteropConstants.DEFAULT_HUMIDITY;
+
+ public ResourceProperty refreshProperty(ResourceProperty resourceProperty) throws CallbackFailedException
+ {
+ Calendar resetAt = Calendar.getInstance();
+ org.wsdmdemo.service.weatherStation.HumidityDocument prop_humidity = (org.wsdmdemo.service.weatherStation.HumidityDocument) resourceProperty.get(0);
+ org.wsdmdemo.service.weatherStation.HumidityMetricType humidityMetricType = prop_humidity.addNewHumidity();
+ humidityMetricType.setDoubleValue(CallbackUtils.getNextRandomValue(m_lastTemp, InteropConstants.MAX_HUMIDITY, InteropConstants.MIN_HUMIDITY));
+ humidityMetricType.setResetAt(resetAt);
+ return resourceProperty;
+ }
+}
Added: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/TemperatureCallback.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/TemperatureCallback.java?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/TemperatureCallback.java (added)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/TemperatureCallback.java Wed Jun 1 14:09:00 2005
@@ -0,0 +1,27 @@
+package org.wsdmdemo.service.weatherStation.callbacks;
+
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.wsdmdemo.service.InteropConstants;
+
+import java.util.Calendar;
+
+
+/**
+ * @author Sal Campana
+ */
+public class TemperatureCallback implements ResourcePropertyCallback
+{
+ private double m_lastTemp = InteropConstants.DEFAULT_TEMP;
+
+ public ResourceProperty refreshProperty(ResourceProperty resourceProperty) throws CallbackFailedException
+ {
+ Calendar resetAt = Calendar.getInstance();
+ org.wsdmdemo.service.weatherStation.TemperatureDocument prop_temperature = (org.wsdmdemo.service.weatherStation.TemperatureDocument) resourceProperty.get(0);
+ org.wsdmdemo.service.weatherStation.TemperatureMetricType temperatureMetricType = prop_temperature.addNewTemperature();
+ temperatureMetricType.setDoubleValue(CallbackUtils.getNextRandomValue(m_lastTemp, InteropConstants.MAX_TEMP, InteropConstants.MIN_TEMP));
+ temperatureMetricType.setResetAt(resetAt);
+ return resourceProperty;
+ }
+}
Added: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/VisibilityCallback.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/VisibilityCallback.java?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/VisibilityCallback.java (added)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/callbacks/VisibilityCallback.java Wed Jun 1 14:09:00 2005
@@ -0,0 +1,27 @@
+package org.wsdmdemo.service.weatherStation.callbacks;
+
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.wsdmdemo.service.InteropConstants;
+
+import java.util.Calendar;
+
+
+/**
+ * @author Sal Campana
+ */
+public class VisibilityCallback implements ResourcePropertyCallback
+{
+ private double m_lastTemp = InteropConstants.DEFAULT_VISIBILITY;
+
+ public ResourceProperty refreshProperty(ResourceProperty resourceProperty) throws CallbackFailedException
+ {
+ Calendar resetAt = Calendar.getInstance();
+ org.wsdmdemo.service.weatherStation.VisibilityDocument prop_visibility = (org.wsdmdemo.service.weatherStation.VisibilityDocument) resourceProperty.get(0);
+ org.wsdmdemo.service.weatherStation.VisibilityMetricType visibilityMetricType = prop_visibility.addNewVisibility();
+ visibilityMetricType.setResetAt(resetAt);
+ visibilityMetricType.setDoubleValue(CallbackUtils.getNextRandomValue(m_lastTemp, InteropConstants.MAX_VISIBILITY, InteropConstants.MIN_VISIBILITY));
+ return resourceProperty;
+ }
+}
Added: incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java?rev=179421&view=auto
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java (added)
+++ incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java Wed Jun 1 14:09:00 2005
@@ -0,0 +1,79 @@
+
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.util.test.axis.AbstractOneAxisTestCase;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
+import org.wsdmdemo.service.InteropRequestUtils;
+import org.wsdmdemo.service.weatherClientConfig.WeatherClientConfigPropertyQNames;
+import org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
+
+import java.net.URL;
+
+/**
+ * @author Sal Campana
+ */
+public class IEEEDemoTest extends AbstractOneAxisTestCase
+{
+ private static final String WEATHER_STATION_1_EPR_URL = "http://localhost:8080/muse/epr/weather-station-1-epr.xml";
+ private static final String WEATHER_STATION_DIR_SERVICE_URL = "http://localhost:8080/muse/services/WeatherStationDir";
+
+ public void testDemo() throws Exception
+ {
+ //addweatherstation
+ AddWeatherStationDocument addWeatherStationDocument = AddWeatherStationDocument.Factory.newInstance();
+ org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument.AddWeatherStation addWeatherStation = addWeatherStationDocument.addNewAddWeatherStation();
+ EndpointReferenceDocument weatherStationEprDoc = getEndpointReference( new URL( WEATHER_STATION_1_EPR_URL ) );
+ addWeatherStation.setEndpointReference(weatherStationEprDoc.getEndpointReference());
+ XmlObject addResponse = InteropRequestUtils.sendRequest(addWeatherStationDocument,"http://wsdmdemo.org/service/weather-station-dir/AddWeatherStation",WEATHER_STATION_DIR_SERVICE_URL);
+
+ //retrieve the epr for weather station 1 from wc
+ GetResourcePropertyDocument getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
+ getResourcePropertyDocument.setGetResourceProperty(WeatherClientConfigPropertyQNames.WEATHERSTATIONREFERENCE);
+ XmlObject getResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument,"http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties",new XmlBeansEndpointReference(weatherStationEprDoc.getEndpointReference()));
+
+ /* //retrieve the metrics
+ GetMultipleResourcePropertiesDocument getMultipleResourcePropertiesDocument = GetMultipleResourcePropertiesDocument.Factory.newInstance();
+ GetMultipleResourcePropertiesDocument.GetMultipleResourceProperties getMultipleResourceProperties = getMultipleResourcePropertiesDocument.addNewGetMultipleResourceProperties();
+ QName[] metrics = {WeatherStationPropertyQNames.HUMIDITY, WeatherStationPropertyQNames.TEMPERATURE, WeatherStationPropertyQNames.VISIBILITY};
+ getMultipleResourceProperties.setResourcePropertyArray(metrics);
+ XmlObject getMultResp = InteropRequestUtils.sendRequest(getMultipleResourcePropertiesDocument,"http://wsdmdemo.org/service/weather-station-dir/GetMultipleResourceProperties",new XmlBeansEndpointReference(weatherStationEprDoc.addNewEndpointReference()));
+
+ //pull again should be different
+ XmlObject getMultResp2 = InteropRequestUtils.sendRequest(getMultipleResourcePropertiesDocument,"http://wsdmdemo.org/service/weather-station-dir/GetMultipleResourceProperties",new XmlBeansEndpointReference(weatherStationEprDoc.addNewEndpointReference()));
+
+
+ //get relationships from dir > 0
+ getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
+ getResourcePropertyDocument.setGetResourceProperty(WeatherStationDirPropertyQNames.RELATIONSHIP); //need epr
+ XmlObject getRelResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument,"http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties",WEATHER_STATION_DIR_SERVICE_URL);
+
+ //recalibrate ws1
+ RecalibrateDocument recalibrateDocument = RecalibrateDocument.Factory.newInstance();
+ XmlObject recalibResponse = InteropRequestUtils.sendRequest(recalibrateDocument,"http://wsdmdemo.org/service/weather-station-dir/Recalibrate",WEATHER_STATION_DIR_SERVICE_URL);
+
+ //check the OpStatus prop is PartiallyAvail .....also need to check notif
+ getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
+ getResourcePropertyDocument.setGetResourceProperty(WeatherStationPropertyQNames.OPERATIONALSTATUS);
+
+
+ //setWeatherStation
+ SetWeatherStationDocument setWeatherStationDocument = SetWeatherStationDocument.Factory.newInstance();
+ org.wsdmdemo.service.weatherClientConfig.SetWeatherStationDocument.SetWeatherStation setWeatherStation = setWeatherStationDocument.addNewSetWeatherStation();
+ setWeatherStation.setEndpointReference();
+
+ //get weather station
+ getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
+ getResourcePropertyDocument.setGetResourceProperty(WeatherClientConfigPropertyQNames.WEATHERSTATIONREFERENCE);
+
+*/
+ //todo test notifs....
+ }
+
+
+ protected EndpointReferenceDocument getEndpointReference( URL url ) throws Exception
+ {
+ return (EndpointReferenceDocument) XmlObject.Factory.parse( url );
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org