ws-muse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r180462 - in /incubator/muse/trunk/src/ieeedemo/src: java/org/wsdmdemo/service/ java/org/wsdmdemo/service/weatherClientConfig/ java/org/wsdmdemo/service/weatherStation/ java/org/wsdmdemo/service/weatherStationDir/ test/
Date Mon, 06 Jun 2005 19:50:51 GMT
Author: scamp
Date: Mon Jun  6 12:50:50 2005
New Revision: 180462

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

Modified:
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStation/WeatherStationHome.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java
    incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java

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=180462&r1=180461&r2=180462&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
Mon Jun  6 12:50:50 2005
@@ -5,6 +5,8 @@
 import javax.xml.namespace.QName;
 
 /**
+ * Configuration Constants for the Demo Application and Unit Test
+ *
  * @author Sal Campana
  */
 public interface InteropConstants
@@ -26,25 +28,45 @@
     String DIR_RESOURCEID = "urn:SINGLETON";
 
     /**
-     * Directory Service Location *
+     * BASE SERVICE ADDRESS *
      */
-    String DIR_SERVICE_ADDRESS = System.getProperty("DIRECTORY_SERVICE", "http://localhost:8080/muse/services/WeatherStationDir");
+    String BASE_ADDRESS = System.getProperty("BASE_ADDRESS", "http://localhost:8080/muse/services");
 
     /**
-     * BASE SERVICE ADDRESS *
+     * Min/Max Values
      */
-    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;
-    String WS1_EPR_URL = "WS1_EPR_URL";
-    String WS_DIR_SERVICE_URL = "WS_DIR_SERVICE_URL";
-    String WS_CLIENT_CONFIG_EPR_URL = "WS_CLIENT_CONFIG_EPR_URL";
+
+    /**
+     * Default Values
+     */
+    double DEFAULT_HUMIDITY = 36.0;
+    double DEFAULT_TEMP = 79.0;
+    double DEFAULT_VISIBILITY = 16.09;
+
+    /**
+     * Sysprops for config params
+     */
+    String SYSPROP_WS1_EPR_URL = "WS1_EPR_URL";
+    String SYSPROP_WS_DIR_SERVICE_URL = "WS_DIR_SERVICE_URL";
+    String SYSPROP_WS_CLIENT_CONFIG_EPR_URL = "WS_CLIENT_CONFIG_EPR_URL";
+    String SYSPROP_WS2_EPR_URL = "WS2_EPR_URL";
+
+    /**
+     * EPR URLS
+     */
+    String WEATHER_STATION_1_EPR_URL = System.getProperty(InteropConstants.SYSPROP_WS1_EPR_URL,
"http://localhost:8080/muse/epr/weather-station-1-epr.xml");
+    String WEATHER_STATION_2_EPR_URL = System.getProperty(InteropConstants.SYSPROP_WS2_EPR_URL,
"http://localhost:8080/muse/epr/weather-station-2-epr.xml");
+    //String WEATHER_STATION_CLIENT_CONFIG_EPR_URL = System.getProperty(InteropConstants.SYSPROP_WS_CLIENT_CONFIG_EPR_URL,
"http://localhost:8080/muse/epr/weather-client-config-epr.xml");;
+
+    /**
+     * Client Config Service URL
+     */
+    //String WEATHER_STATION_DIR_SERVICE_URL = System.getProperty(InteropConstants.SYSPROP_WS_DIR_SERVICE_URL,
"http://localhost:8080/muse/services/WeatherStationDir");
+
 }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java?rev=180462&r1=180461&r2=180462&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
(original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
Mon Jun  6 12:50:50 2005
@@ -9,6 +9,7 @@
 import org.xmlsoap.schemas.soap.envelope.Envelope;
 import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
 import org.xmlsoap.schemas.soap.envelope.Header;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
 
 import java.net.URI;
 import java.net.URL;
@@ -144,5 +145,10 @@
 
         XmlBeanUtils.addChildElement(header, toElem);
         XmlBeanUtils.addChildElement(header, actionElem);
+    }
+
+    public static EndpointReferenceDocument getEndpointReference( URL url ) throws Exception
+    {
+        return (EndpointReferenceDocument) XmlObject.Factory.parse( url );
     }
 }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java?rev=180462&r1=180461&r2=180462&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java
(original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherClientConfig/WeatherClientConfigResource.java
Mon Jun  6 12:50:50 2005
@@ -12,9 +12,7 @@
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
 import org.apache.ws.resource.PropertiesResource;
-import org.apache.ws.resource.Resource;
 import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.impl.SimpleTypeResourceKey;
 import org.apache.ws.resource.properties.ResourceProperty;
 import org.apache.ws.resource.properties.ResourcePropertySet;
 import org.apache.ws.resource.properties.SetResourcePropertyCallback;
@@ -28,12 +26,12 @@
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipTypeType;
 import org.wsdmdemo.service.InteropConstants;
-import org.wsdmdemo.service.weatherStation.WeatherStationHome;
+import org.wsdmdemo.service.InteropRequestUtils;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
 
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import javax.xml.namespace.QName;
+import java.net.MalformedURLException;
+import java.net.URL;
 
 /**
  * **** NOTE: This file will not be overwritten during generation ****
@@ -200,14 +198,9 @@
         org.apache.ws.notification.topics.util.TopicUtils.initNotificationProducerProperties(getTopicSpaceSet(),
getResourcePropertySet());
     }
 
-    private EndpointReferenceType getWeatherStationEPR() throws NamingException, ResourceException
+    private EndpointReferenceType getWeatherStationEPR() throws Exception, ResourceException,
MalformedURLException
     {
-        //lookup the EPR from the Home.
-        InitialContext ic = new InitialContext();
-        WeatherStationHome home = (WeatherStationHome) ic.lookup(WeatherStationHome.HOME_LOCATION);
-        Resource resource = home.find(new SimpleTypeResourceKey(WeatherStationHome.RESOURCE_KEY_NAME,
InteropConstants.WS1_KEY));
-        //get the 2004 EPR
-        return (EndpointReferenceType) ((XmlBeansEndpointReference) resource.getEndpointReference()).getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+        return InteropRequestUtils.getEndpointReference(new URL(InteropConstants.WEATHER_STATION_1_EPR_URL)).getEndpointReference();
     }
 
     /**
@@ -231,7 +224,7 @@
      */
     public void insertProperty(Object[] propElems) throws CallbackFailedException
     {
-         if(propElems.length == 1)                //todo CHECK THIS...May throw ClassCast..unsure
of type...
+         if(propElems.length == 1)
          {
               //get the request epr
              EndpointReferenceType weatherStationEpr = (EndpointReferenceType) propElems[0];

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=180462&r1=180461&r2=180462&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
Mon Jun  6 12:50:50 2005
@@ -73,7 +73,7 @@
     public synchronized void init() throws Exception
     {
         super.init();
-        try
+        /*try
         {
             //bootstrap the weather stations  todo not sure we need to do this
             SimpleTypeResourceKey ws1Key = new SimpleTypeResourceKey(RESOURCE_KEY_NAME, InteropConstants.WS1_KEY);
@@ -97,7 +97,7 @@
         catch (ResourceException e)
         {
             e.printStackTrace();
-        }
+        }*/
     }
 
     private void registerWeatherStation(EndpointReference epr)
@@ -105,7 +105,7 @@
         AddWeatherStationDocument addWeatherStationDocument = AddWeatherStationDocument.Factory.newInstance();
         org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument.AddWeatherStation
addWeatherStation = addWeatherStationDocument.addNewAddWeatherStation();
         addWeatherStation.setEndpointReference((org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType)
((XmlBeansEndpointReference) epr).getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA));
-        XmlObject xmlObject = InteropRequestUtils.sendRequest(addWeatherStationDocument,
"http://wsdmdemo.org/service/weather-station-dir/AddWeatherStation", InteropConstants.DIR_SERVICE_ADDRESS);
+        XmlObject xmlObject = InteropRequestUtils.sendRequest(addWeatherStationDocument,
"http://wsdmdemo.org/service/weather-station-dir/AddWeatherStation", InteropConstants.WEATHER_STATION_DIR_SERVICE_URL);
     }
 
     /**

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java?rev=180462&r1=180461&r2=180462&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java
(original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java
Mon Jun  6 12:50:50 2005
@@ -1,5 +1,7 @@
 package org.wsdmdemo.service.weatherStationDir;
 
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
 import org.apache.ws.muws.v1_0.MuwsConstants;
 import org.apache.ws.muws.v1_0.capability.IdentityCapability;
 import org.apache.ws.muws.v1_0.capability.ManageabilityCharacteristicsCapability;
@@ -8,7 +10,19 @@
 import org.apache.ws.muws.v1_0.topics.impl.XmlBeansManagementEventTopicImpl;
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipParticipantType;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipTypeType;
 import org.wsdmdemo.service.InteropConstants;
+import org.wsdmdemo.service.InteropRequestUtils;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+
+import java.net.URL;
 
 /**
  * **** NOTE: This file will not be overwritten during generation ****
@@ -85,7 +99,8 @@
 
             // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Relationship
Resource Property
             resourceProperty = resourcePropertySet.get(WeatherStationDirPropertyQNames.RELATIONSHIP);
-            resourceProperty.addChangeListener(relationshipCapability);            
+            initRelationships(resourceProperty);
+            resourceProperty.addChangeListener(relationshipCapability);
 
             /** END RESOURCE PROPERTIES **/
         }
@@ -118,5 +133,68 @@
          * @param propSet
          */
         org.apache.ws.notification.topics.util.TopicUtils.initNotificationProducerProperties(getTopicSpaceSet(),
getResourcePropertySet());
+    }
+
+    /**
+     * Initializes the default relationships
+     *
+     * @param resourceProperty
+     * @throws Exception
+     */
+    private void initRelationships(ResourceProperty resourceProperty) throws Exception
+    {
+        org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType ws1Epr = InteropRequestUtils.getEndpointReference(new
URL(InteropConstants.WEATHER_STATION_1_EPR_URL)).getEndpointReference();
+        org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType ws2Epr = InteropRequestUtils.getEndpointReference(new
URL(InteropConstants.WEATHER_STATION_2_EPR_URL)).getEndpointReference();
+        addRelation(resourceProperty,ws1Epr);
+        addRelation(resourceProperty,ws2Epr);
+    }
+
+    /**
+     * Adds a relationship to this resource with a given epr as the child relation
+     *
+     * @param resourceProperty
+     * @param childEpr
+     */
+    private void addRelation(ResourceProperty resourceProperty, EndpointReferenceType childEpr)
+    {
+        //define a relationship
+        RelationshipDocument relationshipDocument = RelationshipDocument.Factory.newInstance();
+        RelationshipType  relationshipType = createRelationshipType(relationshipDocument,
relationshipDocument.addNewRelationship());
+
+        //add self as a participant
+        RelationshipParticipantType relationshipParticipantType = relationshipType.addNewParticipant();
+        XmlBeansEndpointReference dirEpr = (XmlBeansEndpointReference) getEndpointReference();
+        EndpointReferenceType dirEndpointReferenceType = (EndpointReferenceType) dirEpr.getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
+        relationshipParticipantType.setResourceId(InteropConstants.DIR_RESOURCEID);
+        relationshipParticipantType.setRole("urn://parent");//uri
+        relationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{dirEndpointReferenceType});
+
+
+        //add the new ws as the other participant
+        RelationshipParticipantType relationshipParticipantType2 = relationshipType.addNewParticipant();
+        //todo barties needs to fix communications
+        // relationshipParticipantType2.setResourceId(getResourceId(addedEpr));
+        relationshipParticipantType2.setResourceId(InteropConstants.WS1_KEY);
+        relationshipParticipantType2.setRole("urn://child");//uri
+        relationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{childEpr});
+
+        resourceProperty.add(relationshipDocument);
+    }
+
+    private RelationshipType createRelationshipType(RelationshipDocument relationshipDocument,
RelationshipType relationshipType)
+    {
+        try
+        {
+            //define the relationship type
+            relationshipType = relationshipDocument.addNewRelationship();
+            RelationshipTypeType relationshipTypeType = relationshipType.addNewType();
+            XmlObject relationType = XmlObject.Factory.parse("<" + InteropConstants.RELATIONSHIP_RELATION.getPrefix()
+ ":" + InteropConstants.RELATIONSHIP_RELATION.getLocalPart() + " xmlns:" + InteropConstants.RELATIONSHIP_RELATION.getPrefix()
+ "=" + "\"" + InteropConstants.RELATIONSHIP_RELATION.getNamespaceURI() + "\" />");
+            XmlBeanUtils.addChildElement(relationshipTypeType, relationType);
+        }
+        catch (XmlException e)
+        {
+            e.printStackTrace();
+        }
+        return relationshipType;
     }
 }

Modified: 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=180462&r1=180461&r2=180462&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java Mon Jun  6 12:50:50 2005
@@ -1,103 +1,102 @@
 
 import junit.framework.TestCase;
 import org.apache.ws.addressing.XmlBeansEndpointReference;
-import org.apache.ws.util.XmlBeanUtils;
 import org.apache.xmlbeans.XmlObject;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.UpdateType;
 import org.wsdmdemo.service.InteropConstants;
 import org.wsdmdemo.service.InteropRequestUtils;
 import org.wsdmdemo.service.weatherClientConfig.WeatherClientConfigPropertyQNames;
-import org.wsdmdemo.service.weatherClientConfig.WeatherStationReferenceDocument;
+import org.wsdmdemo.service.weatherStation.RecalibrateDocument;
 import org.wsdmdemo.service.weatherStation.WeatherStationPropertyQNames;
-import org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument;
+import org.wsdmdemo.service.weatherStationDir.WeatherStationDirPropertyQNames;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
 
 import java.net.URL;
+
 /**
  * @author Sal Campana
  */
 public class IEEEDemoTest extends TestCase
 {
-    private static final String WEATHER_STATION_1_EPR_URL = System.getProperty(InteropConstants.WS1_EPR_URL,"http://localhost:8080/muse/epr/weather-station-1-epr.xml");
-    private static final String WEATHER_STATION_DIR_SERVICE_URL = System.getProperty(InteropConstants.WS_DIR_SERVICE_URL,"http://localhost:8080/muse/services/WeatherStationDir");
-    private static final String WEATHER_STATION_CLIENT_CONFIG_EPR_URL = System.getProperty(InteropConstants.WS_CLIENT_CONFIG_EPR_URL,"http://localhost:8080/muse/epr/weather-client-config-epr.xml");;
+    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 final String WEATHER_STATION_DIR_SERVICE_URL = System.getProperty(InteropConstants.SYSPROP_WS_DIR_SERVICE_URL,
"http://localhost:8080/muse/services/WeatherStationDir");
+    private static final String WEATHER_STATION_CLIENT_CONFIG_EPR_URL = System.getProperty(InteropConstants.SYSPROP_WS_CLIENT_CONFIG_EPR_URL,
"http://localhost:8080/muse/epr/weather-client-config-epr.xml");;
 
     public void testDemo() throws Exception
     {
-        EndpointReferenceDocument weatherStationEprDoc = getEndpointReference( new URL( WEATHER_STATION_1_EPR_URL
) );
-        EndpointReferenceDocument clientConfigEpr = getEndpointReference( new URL( WEATHER_STATION_CLIENT_CONFIG_EPR_URL
) );
+        EndpointReferenceDocument weatherStationEprDoc = InteropRequestUtils.getEndpointReference(new
URL(WEATHER_STATION_1_EPR_URL));
+        EndpointReferenceDocument clientConfigEpr = InteropRequestUtils.getEndpointReference(new
URL(WEATHER_STATION_CLIENT_CONFIG_EPR_URL));
 
-        //set the weatherstation config prop to ws1 resource
-        SetResourcePropertiesDocument setResourcePropertiesDocument = SetResourcePropertiesDocument.Factory.newInstance();
-        SetResourcePropertiesDocument.SetResourceProperties setResourceProperties = setResourcePropertiesDocument.addNewSetResourceProperties();
-        UpdateType update = UpdateType.Factory.newInstance();
-        WeatherStationReferenceDocument weatherStationReferenceDocument = WeatherStationReferenceDocument.Factory.newInstance();
-        weatherStationReferenceDocument.setWeatherStationReference(weatherStationEprDoc.getEndpointReference());
-        XmlBeanUtils.addChildElement(update,weatherStationReferenceDocument);
-        setResourceProperties.setUpdateArray(new UpdateType[]{update});
-        XmlObject addResponse = InteropRequestUtils.sendRequest(setResourcePropertiesDocument,"http://wsdmdemo.org/service/weather-station-dir/SetResourceProperties",new
XmlBeansEndpointReference(clientConfigEpr.getEndpointReference()));
-
-        //addweatherstation
-        AddWeatherStationDocument addWeatherStationDocument = AddWeatherStationDocument.Factory.newInstance();
-        org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument.AddWeatherStation
addWeatherStation = addWeatherStationDocument.addNewAddWeatherStation();
+        //set the weatherstation config prop to ws1 resource   ..no need internally configured
+        /* SetResourcePropertiesDocument setResourcePropertiesDocument = SetResourcePropertiesDocument.Factory.newInstance();
+         SetResourcePropertiesDocument.SetResourceProperties setResourceProperties = setResourcePropertiesDocument.addNewSetResourceProperties();
+         UpdateType update = UpdateType.Factory.newInstance();
+         WeatherStationReferenceDocument weatherStationReferenceDocument = WeatherStationReferenceDocument.Factory.newInstance();
+         weatherStationReferenceDocument.setWeatherStationReference(weatherStationEprDoc.getEndpointReference());
+         XmlBeanUtils.addChildElement(update,weatherStationReferenceDocument);
+         setResourceProperties.setUpdateArray(new UpdateType[]{update});
+         XmlObject addResponse = InteropRequestUtils.sendRequest(setResourcePropertiesDocument,"http://wsdmdemo.org/service/weather-station-dir/SetResourceProperties",new
XmlBeansEndpointReference(clientConfigEpr.getEndpointReference()));
+
+         //addweatherstation
+         AddWeatherStationDocument addWeatherStationDocument = AddWeatherStationDocument.Factory.newInstance();
+         org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument.AddWeatherStation
addWeatherStation = addWeatherStationDocument.addNewAddWeatherStation();
+
+         addWeatherStation.setEndpointReference(weatherStationEprDoc.getEndpointReference());
+         addResponse = InteropRequestUtils.sendRequest(addWeatherStationDocument,"http://wsdmdemo.org/service/weather-station-dir/AddWeatherStation",WEATHER_STATION_DIR_SERVICE_URL);
+        */
 
-        addWeatherStation.setEndpointReference(weatherStationEprDoc.getEndpointReference());
-        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(clientConfigEpr.getEndpointReference()));
+        XmlObject getResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument,
"http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties", new XmlBeansEndpointReference(clientConfigEpr.getEndpointReference()));
 
+        //assertTrue(getResp instanceof )
+        //todo check its ws1
 
         getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
         getResourcePropertyDocument.setGetResourceProperty(WeatherStationPropertyQNames.TEMPERATURE);
-        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()));
+        getResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument, "http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties",
new XmlBeansEndpointReference(weatherStationEprDoc.getEndpointReference()));
+        //todo assert
 
+        /* //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);
+        XmlObject getRelResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument,
"http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties", WEATHER_STATION_DIR_SERVICE_URL);
+        //todo assert we get both relationships
+
+        //check the OpStatus prop is PartiallyAvail .....also need to check notif
+        getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
+        getResourcePropertyDocument.setGetResourceProperty(WeatherStationPropertyQNames.OPERATIONALSTATUS);
+        getResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument, "http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties",
new XmlBeansEndpointReference(weatherStationEprDoc.getEndpointReference()));
+        //todo check avail
 
         //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);
+        org.wsdmdemo.service.weatherStation.RecalibrateDocument.Recalibrate recalibrate =
recalibrateDocument.addNewRecalibrate();
+        XmlObject recalibResponse = InteropRequestUtils.sendRequest(recalibrateDocument,
"http://wsdmdemo.org/service/weather-station-dir/Recalibrate", new XmlBeansEndpointReference(weatherStationEprDoc.getEndpointReference()));
+        //todo assert not fault
 
         //check the OpStatus prop is PartiallyAvail .....also need to check notif
         getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
         getResourcePropertyDocument.setGetResourceProperty(WeatherStationPropertyQNames.OPERATIONALSTATUS);
+        getResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument, "http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties",
new XmlBeansEndpointReference(weatherStationEprDoc.getEndpointReference()));
+        //todo check unavail
 
 
-        //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....
+        //todo test notifs....???are there notifs anymore??
     }
 
-
-    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


Mime
View raw message