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/03/30 23:39:08 UTC

svn commit: r159526 - in incubator/muse/trunk/src/site/content/interop/src: java/org/apache/ws/resource/example/blackberry/BlackberryResource.java java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java test/org/apache/ws/muws/interop/client/SmallDeviceMgmtTestCase.java

Author: scamp
Date: Wed Mar 30 13:39:07 2005
New Revision: 159526

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


Modified:
    incubator/muse/trunk/src/site/content/interop/src/java/org/apache/ws/resource/example/blackberry/BlackberryResource.java
    incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java
    incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/SmallDeviceMgmtTestCase.java

Modified: incubator/muse/trunk/src/site/content/interop/src/java/org/apache/ws/resource/example/blackberry/BlackberryResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/java/org/apache/ws/resource/example/blackberry/BlackberryResource.java?view=diff&r1=159525&r2=159526
==============================================================================
--- incubator/muse/trunk/src/site/content/interop/src/java/org/apache/ws/resource/example/blackberry/BlackberryResource.java (original)
+++ incubator/muse/trunk/src/site/content/interop/src/java/org/apache/ws/resource/example/blackberry/BlackberryResource.java Wed Mar 30 13:39:07 2005
@@ -91,7 +91,9 @@
 
 
         /** Topics **/
-        TopicSpace muwsTopicSpace = getTopicSpace( MuwsConstants.NSURI_MUWS_PART2_TOPICS );
+        //MUWS TopicSpace
+        TopicSpace muwsTopicSpace = new TopicSpaceImpl( MuwsConstants.NSURI_MUWS_PART2_TOPICS );
+        getTopicSpaceSet().addTopicSpace(muwsTopicSpace);
 
         ManagementEventTopic operationalStatusCapability = new XmlBeansManagementEventTopicImpl(
                 "OperationalStatusCapability" );
@@ -99,9 +101,10 @@
         ManagementEventTopic metricsCapability = new XmlBeansManagementEventTopicImpl( "MetricsCapability" );
         muwsTopicSpace.addTopic( metricsCapability );
         ManagementEventTopic codeModuleSize = new XmlBeansManagementEventTopicImpl( "CodeModuleSize_Change" );
-        TopicSpace bbryTopicSpace = getTopicSpace(BlackberryPropertyQNames.ALLOCATEDSTORAGE.getNamespaceURI());
-        bbryTopicSpace.addTopic(codeModuleSize);
 
+        //Blackberry TopicSpace
+        TopicSpace bbryTopicSpace = new TopicSpaceImpl( BlackberryPropertyQNames.ALLOCATEDSTORAGE.getNamespaceURI() );
+        getTopicSpaceSet().addTopicSpace(muwsTopicSpace);        
 
 
         /** Properties **/
@@ -172,14 +175,6 @@
 
     }
 
-    private TopicSpace getTopicSpace( String namespace )
-    {
-        TopicSpace topicSpace = getTopicSpaceSet().getTopicSpace( namespace );
-        if ( topicSpace == null )
-        {
-            topicSpace = new TopicSpaceImpl( namespace );
-        }
-        return topicSpace;
-    }
+
 
 }

Modified: incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java?view=diff&r1=159525&r2=159526
==============================================================================
--- incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java (original)
+++ incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java Wed Mar 30 13:39:07 2005
@@ -86,9 +86,10 @@
         org.apache.ws.notification.topics.util.TopicUtils.addResourcePropertyValueChangeTopics(
                 getResourcePropertySet(), topicSpaceSet );
 
+        //MUWS TopicSpace
         TopicSpace muwsTopicSpace = new TopicSpaceImpl( MuwsConstants.NSURI_MUWS_PART2_TOPICS );
         getTopicSpaceSet().addTopicSpace(muwsTopicSpace);
-        
+
         ManagementEventTopic identityCapability = new XmlBeansManagementEventTopicImpl( "IdentityCapabiltiy" );
         muwsTopicSpace.addTopic( identityCapability );
         ManagementEventTopic manageabilityCharacteristicsCapability = new XmlBeansManagementEventTopicImpl(
@@ -105,7 +106,10 @@
                 "OperationalStatusCapability" );
         muwsTopicSpace.addTopic( operationalStatusCapability );
 
-        TopicSpace mowsTopicSpace = getTopicSpace( MowsConstants.NSURI_MOWS_TOPICS );
+        //MOWS TopicSpace
+        TopicSpace mowsTopicSpace = new TopicSpaceImpl( MowsConstants.NSURI_MOWS_TOPICS );
+        getTopicSpaceSet().addTopicSpace(mowsTopicSpace);
+
         ManagementEventTopic mowsIdentificationCapability = new XmlBeansManagementEventTopicImpl(
                 "IdentificationCapability" );
         mowsTopicSpace.addTopic( mowsIdentificationCapability );
@@ -326,16 +330,6 @@
         lastRespDurationMetric.setGDurationValue( builder.toGDuration() );
         resourceProperty.add( lastResponseTimeDocument );
         resourceProperty.addChangeListener( mowsMetricsCapability );
-    }
-
-    private TopicSpace getTopicSpace( String namespace )
-    {
-        TopicSpace topicSpace = getTopicSpaceSet().getTopicSpace( namespace );
-        if ( topicSpace == null )
-        {
-            topicSpace = new TopicSpaceImpl( namespace );
-        }
-        return topicSpace;
     }
 
     public void setFCCID( FCCIDDocument fccidDocument )

Modified: incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/SmallDeviceMgmtTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/SmallDeviceMgmtTestCase.java?view=diff&r1=159525&r2=159526
==============================================================================
--- incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/SmallDeviceMgmtTestCase.java (original)
+++ incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/SmallDeviceMgmtTestCase.java Wed Mar 30 13:39:07 2005
@@ -18,10 +18,21 @@
 import org.apache.ws.muws.v1_0.capability.ManageabilityCharacteristicsCapability;
 import org.apache.ws.muws.v1_0.capability.MetricsCapability;
 import org.apache.ws.muws.v1_0.capability.ConfigurationCapability;
+import org.apache.ws.muws.v1_0.MuwsConstants;
 import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.util.test.PortListen;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.notification.base.v1_2.BaseNotification1_2Constants;
+import org.apache.ws.resource.properties.v2004_06.ResourcePropertiesConstants;
 import org.apache.xmlbeans.XmlDateTime;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
 import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument;
+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventDocument;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventType;
 
 import java.net.URL;
 
@@ -51,6 +62,9 @@
     private static final QName PROP_NAME_DATE = new QName( NSURI_BLACKBERRY, "date", NSPREFIX_BLACKBERRY );
     private static final QName PROP_NAME_TIME = new QName( NSURI_BLACKBERRY, "time", NSPREFIX_BLACKBERRY );
 
+    private static final int        LISTENER_TIMEOUT           = 50000;
+    private static final int        NOTIFICATION_LISTENER_PORT = 9101;
+
     private ResourceStub m_resource;
 
     protected void setUp() throws Exception
@@ -102,11 +116,40 @@
         performMuwsMetricChangeAct( m_resource );
     }
 
-    public void testBlackberryCodeModuleSizeChangeEvent() throws FaultException
+    public void testBlackberryCodeModuleSizeChangeEvent() throws FaultException, XmlException
     {
         XmlObject[] capabilityElems = m_resource.getResourceProperty( ManageabilityCharacteristicsCapability.PROP_NAME_MANAGEABILITY_CAPABILITY );
         assertContainsURI( capabilityElems, MetricsCapability.URI );
         // TODO: subscribe to bbry:CodeModuleSizeChange topic and receive a propChanged event
+
+        //test as a listener for events
+        PortListen notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, LISTENER_TIMEOUT );
+
+        //invoke the change by calling set
+
+        // wait for that termination notification
+        String incomingMessage = notificationListener.waitForIncomingMessage();
+
+        //get envelope
+        XmlObject xmlObject = XmlObject.Factory.parse(incomingMessage);
+        assertTrue("The returned message was not a SOAP Envelope.", xmlObject instanceof EnvelopeDocument);
+        EnvelopeDocument envelope = (EnvelopeDocument) xmlObject;
+
+        //get notify
+        XmlObject notifyDoc = XmlBeanUtils.getChildElements(envelope.getEnvelope().getBody(), new QName(BaseNotification1_2Constants.NSURI_WSNT_SCHEMA, "Notify"))[0];
+        assertTrue("The body did not contain a NotifyDocument.", notifyDoc instanceof NotifyDocument);
+        NotifyDocument notify = (NotifyDocument) notifyDoc;
+
+        //get contained management event
+        NotificationMessageHolderType notificationMessageType = notify.getNotify().getNotificationMessageArray(0);
+        XmlObject message = notificationMessageType.getMessage();
+        XmlObject xmlManagementEvent = XmlBeanUtils.getChildElements(message, new QName(MuwsConstants.NSURI_MUWS_PART1_SCHEMA, "ManagementEvent"))[0];
+        assertTrue("The Notify did not contain a ManagementEvent.", xmlManagementEvent instanceof ManagementEventDocument);
+
+        ManagementEventDocument med = (ManagementEventDocument) xmlManagementEvent;
+        ManagementEventType managementEvent = med.getManagementEvent();
+        XmlObject rpcEvent = XmlBeanUtils.getChildElements(managementEvent, new QName(ResourcePropertiesConstants.NSURI_WSRP_SCHEMA, "ResourcePropertyValueChangeNotification"))[0];
+        assertNotNull("There was no ResourcePropertyChangeEvent",rpcEvent);
     }
 
     public void testMuwsStatusChangeEvent() throws FaultException



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