Author: ips
Date: Tue Apr  5 13:56:08 2005
New Revision: 160218

URL: http://svn.apache.org/viewcvs?view=rev&rev=160218
Log:
all server acts are done; weather station GetMgmtRefs act is done

Added:
    
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ServiceStub.java
Modified:
    
incubator/muse/trunk/src/site/content/interop/src/java/com/dell/wsdm/demos/interop/x2005/x04/IpmiserverResource.java
    
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ResourceStub.java
    
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java

Modified: 
incubator/muse/trunk/src/site/content/interop/src/java/com/dell/wsdm/demos/interop/x2005/x04/IpmiserverResource.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/java/com/dell/wsdm/demos/interop/x2005/x04/IpmiserverResource.java?view=diff&r1=160217&r2=160218
==============================================================================
--- 
incubator/muse/trunk/src/site/content/interop/src/java/com/dell/wsdm/demos/interop/x2005/x04/IpmiserverResource.java
 (original)
+++ 
incubator/muse/trunk/src/site/content/interop/src/java/com/dell/wsdm/demos/interop/x2005/x04/IpmiserverResource.java
 Tue Apr  5 13:56:08 2005
@@ -1,10 +1,9 @@
-
 package com.dell.wsdm.demos.interop.x2005.x04;
 
 import org.apache.ws.muws.v1_0.capability.IdentityCapability;
 import org.apache.ws.muws.v1_0.capability.OperationalStatusCapability;
+import org.apache.ws.muws.v1_0.capability.ConfigurationCapability;
 import org.apache.ws.resource.properties.ResourceProperty;
-import org.apache.xmlbeans.XmlObject;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument;
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CurrentTimeDocument;
@@ -21,7 +20,6 @@
 
 {
 
-
     /**
      * A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
      */
@@ -40,68 +38,96 @@
          * call TopicUtils.addResourcePropertyValueChangeTopic for each
          * Topic you'd like to expose property change notifications for.
          */
-        
org.apache.ws.notification.topics.util.TopicUtils.addResourcePropertyValueChangeTopics(getResourcePropertySet(),
 getTopicSpaceSet());
+        
org.apache.ws.notification.topics.util.TopicUtils.addResourcePropertyValueChangeTopics(
+                getResourcePropertySet(), getTopicSpaceSet() );
 
-        org.apache.ws.resource.properties.ResourcePropertySet 
resourcePropertySet = getResourcePropertySet();
+        org.apache.ws.resource.properties.ResourcePropertySet propSet = 
getResourcePropertySet();
 
-        /** Capabilities **/
+        /*===== Capabilities =====*/
         //Management Characteristics
-        ResourceProperty resourceProperty = 
resourcePropertySet.get(IpmiserverPropertyQNames.MANAGEABILITYCAPABILITY);
+        ResourceProperty prop = propSet.get( 
IpmiserverPropertyQNames.MANAGEABILITYCAPABILITY );
 
-        //Identity Capability
+        //muws:Identity Capability
         ManageabilityCapabilityDocument manageabilityCapabilityDocument = 
ManageabilityCapabilityDocument.Factory.newInstance();
-        
manageabilityCapabilityDocument.setManageabilityCapability(IdentityCapability.URI);
-        resourceProperty.add(manageabilityCapabilityDocument);
+        manageabilityCapabilityDocument.setManageabilityCapability( 
IdentityCapability.URI );
+        prop.add( manageabilityCapabilityDocument );
 
-        //Status Capability
+        //muws:OperationalStatus Capability
         manageabilityCapabilityDocument = 
ManageabilityCapabilityDocument.Factory.newInstance();
-        
manageabilityCapabilityDocument.setManageabilityCapability(OperationalStatusCapability.URI);
-        resourceProperty.add(manageabilityCapabilityDocument);
+        manageabilityCapabilityDocument.setManageabilityCapability( 
OperationalStatusCapability.URI );
+        prop.add( manageabilityCapabilityDocument );
+
+        //muws:Configuration Capability
+        manageabilityCapabilityDocument = 
ManageabilityCapabilityDocument.Factory.newInstance();
+        manageabilityCapabilityDocument.setManageabilityCapability( 
ConfigurationCapability.URI );
+        prop.add( manageabilityCapabilityDocument );
 
         //Server Configuration
         manageabilityCapabilityDocument = 
ManageabilityCapabilityDocument.Factory.newInstance();
-        
manageabilityCapabilityDocument.setManageabilityCapability(IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI()+"/ServerConfiguration");
-        resourceProperty.add(manageabilityCapabilityDocument);
+        manageabilityCapabilityDocument.setManageabilityCapability(
+                IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI() + 
"/ServerConfiguration" );
+        prop.add( manageabilityCapabilityDocument );
 
         //Server Chassis Configuration
         manageabilityCapabilityDocument = 
ManageabilityCapabilityDocument.Factory.newInstance();
-        
manageabilityCapabilityDocument.setManageabilityCapability(IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI()+"/ServerChassisConfiguration");
-        resourceProperty.add(manageabilityCapabilityDocument);
+        manageabilityCapabilityDocument.setManageabilityCapability(
+                IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI() + 
"/ServerChassisConfiguration" );
+        prop.add( manageabilityCapabilityDocument );
 
         //Server Alert Status
         manageabilityCapabilityDocument = 
ManageabilityCapabilityDocument.Factory.newInstance();
-        
manageabilityCapabilityDocument.setManageabilityCapability(IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI()+"/ServerAlertStatus");
-        resourceProperty.add(manageabilityCapabilityDocument);
+        manageabilityCapabilityDocument.setManageabilityCapability(
+                IpmiserverPropertyQNames.ATTENTIONLEDON.getNamespaceURI() + 
"/ServerAlertStatus" );
+        prop.add( manageabilityCapabilityDocument );
 
-        //Server Reset Capability
-        manageabilityCapabilityDocument = 
ManageabilityCapabilityDocument.Factory.newInstance();
-        
manageabilityCapabilityDocument.setManageabilityCapability("http://.../ServerReset";);
-        resourceProperty.add(manageabilityCapabilityDocument);
-
-        /** Properties **/
-        resourceProperty = 
resourcePropertySet.get(IpmiserverPropertyQNames.RESOURCEID);
+        /*===== Properties =====*/
+        prop = propSet.get( IpmiserverPropertyQNames.RESOURCEID );
         ResourceIdDocument resourceIdDocument = 
ResourceIdDocument.Factory.newInstance();
-        resourceIdDocument.setResourceId( "urn:" +(String)getID());
-        resourceProperty.add(resourceIdDocument);
-
-        resourceProperty = 
resourcePropertySet.get(IpmiserverPropertyQNames.ATTENTIONLEDON);
-        CpuUsageDocument cpuUsageDocument = 
CpuUsageDocument.Factory.newInstance();
-        XmlObject xmlObject = cpuUsageDocument.addNewCpuUsage();
-        //todo this should be some sort of metric..not sure if defined 
correctly
-        resourceProperty.add(cpuUsageDocument);
+        resourceIdDocument.setResourceId( "urn:" + (String) getID() );
+        prop.add( resourceIdDocument );
 
-        //current time is done like in Apollo
-        resourceProperty = 
resourcePropertySet.get(IpmiserverPropertyQNames.CURRENTTIME);
+        // CurrentTime is done like in Apollo
+        prop = propSet.get( IpmiserverPropertyQNames.CURRENTTIME );
         CurrentTimeDocument currentTimeDocument = 
CurrentTimeDocument.Factory.newInstance();
-        currentTimeDocument.setCurrentTime(Calendar.getInstance());
-        resourceProperty.add(currentTimeDocument);
-        resourceProperty.setCallback( new 
org.apache.ws.resource.lifetime.callback.CurrentTimeCallback(  ) );
+        currentTimeDocument.setCurrentTime( Calendar.getInstance() );
+        prop.add( currentTimeDocument );
+        prop.setCallback( new 
org.apache.ws.resource.lifetime.callback.CurrentTimeCallback() );
 
-
-        resourceProperty = 
resourcePropertySet.get(IpmiserverPropertyQNames.OPERATIONALSTATUS);
+        prop = propSet.get( IpmiserverPropertyQNames.OPERATIONALSTATUS );
         OperationalStatusDocument operationalStatusDocument = 
OperationalStatusDocument.Factory.newInstance();
-        
operationalStatusDocument.setOperationalStatus(OperationalStatusDocument.OperationalStatus.AVAILABLE);
-        resourceProperty.add(operationalStatusDocument);
+        operationalStatusDocument.setOperationalStatus( 
OperationalStatusDocument.OperationalStatus.AVAILABLE );
+        prop.add( operationalStatusDocument );
+
+        /*============= Custom props =============*/
+        prop = propSet.get( IpmiserverPropertyQNames.ATTENTIONLEDON );
+        AttentionLedOnDocument attentionLedOnDoc = 
AttentionLedOnDocument.Factory.newInstance();
+        attentionLedOnDoc.setAttentionLedOn( false );  // NOTE: in an ideal 
world, we would make an IPMI API call to get the value for this prop
+        prop.add( attentionLedOnDoc );
+
+        prop = propSet.get( IpmiserverPropertyQNames.COVEROPEN );
+        CoverOpenDocument coverOpenDoc = 
CoverOpenDocument.Factory.newInstance();
+        coverOpenDoc.setCoverOpen( false );  // NOTE: in an ideal world, we 
would make an IPMI API call to get the value for this prop
+        prop.add( coverOpenDoc );
+
+        prop = propSet.get( IpmiserverPropertyQNames.IPNAME );
+        IpNameDocument ipNameDoc = IpNameDocument.Factory.newInstance();
+        ipNameDoc.setIpName( "MuwsMama" );
+        prop.add( ipNameDoc );
+
+        prop = propSet.get( IpmiserverPropertyQNames.MODELNAME );
+        ModelNameDocument modelNameDoc = 
ModelNameDocument.Factory.newInstance();
+        modelNameDoc.setModelName( "PowerEdge 2850");
+        prop.add( modelNameDoc );
+
+        prop = propSet.get( IpmiserverPropertyQNames.SERIALNUMBER );
+        SerialNumberDocument serialNumberDoc = 
SerialNumberDocument.Factory.newInstance();
+        serialNumberDoc.setSerialNumber( "Z10007986D" );
+        prop.add( serialNumberDoc );
+
+        prop = propSet.get( IpmiserverPropertyQNames.SYSCONTACT );
+        SysContactDocument sysContactDoc = 
SysContactDocument.Factory.newInstance();
+        sysContactDoc.setSysContact( "Eric Cartman" );
+        prop.add( sysContactDoc );
 
     }
 

Modified: 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ResourceStub.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ResourceStub.java?view=diff&r1=160217&r2=160218
==============================================================================
--- 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ResourceStub.java
 (original)
+++ 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ResourceStub.java
 Tue Apr  5 13:56:08 2005
@@ -127,6 +127,7 @@
         {
             URL endpointURL = new URL( m_epr.getAddress() );
             URI actionURI = new URI( action );
+            //System.out.println( "Sending request: \n" + envelopeDoc );
             String response = SoapClient.sendRequest( endpointURL, 
envelopeDoc.newInputStream(), actionURI );
             EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) 
XmlObject.Factory.parse( response );
             Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();

Added: 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ServiceStub.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ServiceStub.java?view=auto&rev=160218
==============================================================================
--- 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ServiceStub.java
 (added)
+++ 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/ServiceStub.java
 Tue Apr  5 13:56:08 2005
@@ -0,0 +1,106 @@
+/*=============================================================================*
+ *  Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ 
*=============================================================================*/
+package org.apache.ws.muws.interop.client;
+
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.soap.SoapClient;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlDouble;
+import 
org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.GetManageabilityReferencesDocument;
+import 
org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.GetManageabilityReferencesResponseDocument;
+import org.xmlsoap.schemas.soap.envelope.Envelope;
+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+import org.everest.GetCurrentTemperatureDocument;
+
+import java.net.URI;
+import java.net.URL;
+
+/**
+ * TODO
+ */
+public class ServiceStub
+{
+
+    private URL m_url;
+
+    public ServiceStub( URL url )
+    {
+        m_url = url;
+    }
+
+    public EndpointReferenceType[] getManageabilityReferences() throws 
FaultException
+    {
+        GetManageabilityReferencesDocument requestDoc = 
GetManageabilityReferencesDocument.Factory.newInstance();
+        requestDoc.addNewGetManageabilityReferences();
+        XmlObject response = sendRequest( requestDoc, 
"http://xyz.com/action/GetManageabilityReferences"; );
+        if ( ! ( response instanceof 
GetManageabilityReferencesResponseDocument.GetManageabilityReferencesResponse ) 
)
+        {
+            throw new FaultException( response.toString() );
+        }
+        return 
((GetManageabilityReferencesResponseDocument.GetManageabilityReferencesResponse)response).getManageabilityEndpointReferenceArray();
+    }
+
+    public double getCurrentTemperature() throws FaultException
+    {
+        GetCurrentTemperatureDocument requestDoc = 
GetCurrentTemperatureDocument.Factory.newInstance();
+        requestDoc.addNewGetCurrentTemperature();
+        XmlObject response = sendRequest( requestDoc, 
"http://xyz.com/action/GetCurrentTemperature"; );
+        if ( ! ( response instanceof XmlDouble ) )
+        {
+            throw new FaultException( response.toString() );
+        }
+        return ((XmlDouble)response).getDoubleValue();
+    }
+
+    private EnvelopeDocument createEnvelope()
+    {
+        EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
+        Envelope envelope = envelopeDoc.addNewEnvelope();
+        envelope.addNewHeader();
+        envelope.addNewBody();
+        return envelopeDoc;
+    }
+
+    private XmlObject sendRequest( XmlObject requestDoc, String action )
+    {
+        EnvelopeDocument envelopeDoc = createEnvelope();
+        Envelope envelope = envelopeDoc.getEnvelope();
+        XmlBeanUtils.addChildElement( envelope.getBody(), requestDoc );
+        try
+        {
+            URI actionURI = new URI( action );
+            //System.out.println( "Sending request: \n" + envelopeDoc );
+            String response = SoapClient.sendRequest( m_url, 
envelopeDoc.newInputStream(), actionURI );
+            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) 
XmlObject.Factory.parse( response );
+            Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
+            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( 
responseEnvelope.getBody() );
+            if ( responseBodyElems.length == 0 )
+            {
+                return null;
+            }
+            else
+            {
+                return responseBodyElems[0];
+            }
+        }
+        catch ( Exception e )
+        {
+            throw new RuntimeException( e );
+        }
+    }
+
+}

Modified: 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java?view=diff&r1=160217&r2=160218
==============================================================================
--- 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
 (original)
+++ 
incubator/muse/trunk/src/site/content/interop/src/test/org/apache/ws/muws/interop/client/WebServicesMgmtTestCase.java
 Tue Apr  5 13:56:08 2005
@@ -61,15 +61,19 @@
 public class WebServicesMgmtTestCase extends AbstractWsdmInteropTestCase
 {
 
-    public static final String SYSPROP_WEATHER_STATION_URL = "TODO"; // this 
is the Weather Station business Web service
+    public static final String SYSPROP_WEATHER_STATION_URL = 
"weather_station.url"; // this is the Weather Station business Web service
     public static final String SYSPROP_WEATHER_STATION_EPR_URL = 
"weather_station.epr";
     public static final String SYSPROP_WEATHER_STATION_2_EPR_URL = 
"weather_station_2.epr";
 
     private static final String DEFAULT_WEATHER_STATION_EPR_URL = 
"http://people.apache.org/~ips/interop/weather_station-epr.xml";;
     private static final String DEFAULT_WEATHER_STATION_2_EPR_URL = 
"http://people.apache.org/~ips/interop/weather_station_2-epr.xml";;
+    private static final String DEFAULT_WEATHER_STATION_URL = 
"http://localhost:8080/muse/services/WeatherStationSoap";;
+
     private static final String WEATHER_STATION_EPR_URL = System.getProperty( 
SYSPROP_WEATHER_STATION_EPR_URL, DEFAULT_WEATHER_STATION_EPR_URL );
     private static final String WEATHER_STATION_2_EPR_URL = 
System.getProperty( SYSPROP_WEATHER_STATION_2_EPR_URL, 
DEFAULT_WEATHER_STATION_2_EPR_URL );
+    private static final String WEATHER_STATION_URL = System.getProperty( 
SYSPROP_WEATHER_STATION_URL, DEFAULT_WEATHER_STATION_URL );
 
+    private ServiceStub m_service;
     private ResourceStub m_resource;
 
     protected void setUp() throws Exception
@@ -77,7 +81,8 @@
         super.setUp();
         EndpointReferenceDocument weatherStationEprDoc = getEndpointReference( 
new URL( WEATHER_STATION_EPR_URL ) );
         //System.out.println( "*** Using Weather Station EPR:\n" + 
weatherStationEprDoc );
-        m_resource = new ResourceStub( new 
XmlBeansEndpointReference(weatherStationEprDoc.getEndpointReference()) );
+        m_service = new ServiceStub( new URL( WEATHER_STATION_URL ) );
+        m_resource = new ResourceStub( new XmlBeansEndpointReference( 
weatherStationEprDoc.getEndpointReference() ) );
     }
 
     public void testMuwsIdentityCharacteristics() throws FaultException
@@ -114,10 +119,19 @@
         }
     }
 
-    public void testMowsManageabilityReferences()
+    public void testMowsManageabilityReferences() throws FaultException
     {
-        // TODO: invoke GetManageabilityReferences operation and validate 
response
-        //the interop doc should be more precise...says WSDL description of or 
an EPR...should be more concrete to avoid compatibility issues
+        EndpointReferenceType[] mgmtEPRs = 
m_service.getManageabilityReferences();
+        assertTrue( "Response to GetManageabilityReferences operation did not 
contain any EPRs.", mgmtEPRs.length != 0 );
+        for ( int i = 0; i < mgmtEPRs.length; i++ )
+        {
+            ResourceStub mgmtResource = new ResourceStub( new 
XmlBeansEndpointReference( mgmtEPRs[i] ) );
+            XmlObject idPropElem = getSingleProperty( mgmtResource, 
IdentityCapability.PROP_NAME_RESOURCE_ID );
+            assertTrue( idPropElem instanceof XmlAnyURI );
+            XmlObject[] capabilityElems = mgmtResource.getResourceProperty(
+                    
ManageabilityCharacteristicsCapability.PROP_NAME_MANAGEABILITY_CAPABILITY );
+            assertContainsURI( capabilityElems, 
EndpointIdentificationCapability.URI );
+        }
     }
 
     public void testMowsMetrics() throws FaultException



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to