cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r524010 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/management/annotation/ rt/core/src/main/java/org/apache/cxf/bus/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/management/src/main/java/org/apache/cxf/managem...
Date Fri, 30 Mar 2007 09:47:01 GMT
Author: eglynn
Date: Fri Mar 30 02:46:54 2007
New Revision: 524010

URL: http://svn.apache.org/viewvc?view=rev&rev=524010
Log:
Path for CXF-505 "Expose Bus and Server via JMX", committed on behalf of Seumas Soltysik.
  

Added:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java
  (with props)
Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/management/annotation/ManagedResource.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java
    incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
    incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/JMXManagedComponentManagerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/management/annotation/ManagedResource.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/management/annotation/ManagedResource.java?view=diff&rev=524010&r1=524009&r2=524010
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/management/annotation/ManagedResource.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/management/annotation/ManagedResource.java
Fri Mar 30 02:46:54 2007
@@ -41,7 +41,7 @@
 
     String logFile() default "";
 
-    String persistPolicy() default "";
+    String persistPolicy() default "Never";
 
     int persistPeriod() default -1;
 

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java?view=auto&rev=524010
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java Fri Mar 30
02:46:54 2007
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.bus;
+
+import javax.management.JMException;
+import javax.management.ObjectName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.management.ManagedComponent;
+import org.apache.cxf.management.ManagementConstants;
+import org.apache.cxf.management.annotation.ManagedOperation;
+import org.apache.cxf.management.annotation.ManagedResource;
+
+@ManagedResource(componentName = "Bus", 
+                 description = "Responsible for managing services.")
+                 
+public class ManagedBus implements ManagedComponent {
+    private static final String TYPE_VALUE = "Bus";
+    private final Bus bus;
+    
+    public ManagedBus(Bus b) {
+        bus = b;
+    }
+        
+    @ManagedOperation       
+    public void shutdown(boolean wait) {
+        bus.shutdown(wait);
+    }
+    
+    public ObjectName getObjectName() throws JMException {
+        String busId = bus.getId() == null ? Integer.toString(bus.hashCode()) : bus.getId();
+        StringBuffer buffer = new StringBuffer(ManagementConstants.DEFAULT_DOMAIN_NAME +
":");
+        buffer.append(ManagementConstants.TYPE_PROP + "="  + TYPE_VALUE + ",");
+        buffer.append(ManagementConstants.NAME_PROP + "=" + "Bus.ID." + busId);
+
+        return new ObjectName(buffer.toString());
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java?view=auto&rev=524010
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
Fri Mar 30 02:46:54 2007
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.endpoint;
+
+import javax.management.JMException;
+import javax.management.ObjectName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.management.ManagedComponent;
+import org.apache.cxf.management.ManagementConstants;
+import org.apache.cxf.management.annotation.ManagedAttribute;
+import org.apache.cxf.management.annotation.ManagedOperation;
+import org.apache.cxf.management.annotation.ManagedResource;
+
+@ManagedResource(componentName = "Endpoint", 
+                 description = "Responsible for managing server instances.")
+
+public class ManagedEndpoint implements ManagedComponent, ServerLifeCycleListener {
+
+    private Bus bus;
+    private Endpoint endpoint;
+    private Server server;
+    private enum State { CREATED, STARTED, STOPPED };
+    private State state = State.CREATED;
+    
+    public ManagedEndpoint(Bus b, Endpoint ep, Server s) {
+        bus = b;
+        endpoint = ep;
+        server = s;
+    }
+
+    @ManagedOperation        
+    public void start() {
+        server.start();
+    }
+    
+    @ManagedOperation
+    public void stop() {
+        server.stop();
+    }
+
+    @ManagedAttribute(description = "Address Attribute", currencyTimeLimit = 60)
+    public String getAddress() {
+        return endpoint.getEndpointInfo().getAddress();
+    }
+    
+    @ManagedAttribute(description = "TransportId Attribute", currencyTimeLimit = 60)
+    public String getTransportId() {
+        return endpoint.getEndpointInfo().getAddress();
+    }
+    
+    @ManagedAttribute(description = "Server State")
+    public String getState() {
+        return state.toString();
+    }
+        
+    public ObjectName getObjectName() throws JMException {
+        String busId = bus.getId() == null ? Integer.toString(bus.hashCode()) : bus.getId();
+        StringBuffer buffer = new StringBuffer();
+        buffer.append(ManagementConstants.DEFAULT_DOMAIN_NAME + ":");
+        buffer.append(ManagementConstants.TYPE_PROP + "=" + "Bus.Service.Endpoint,");
+        buffer.append("Bus.ID=" + "BUS.ID." + busId + ",");
+
+        String serviceName = ObjectName.quote(endpoint.getEndpointInfo().getService().getName().toString());
+        buffer.append("Service=" + serviceName + ",");
+        String endpointName = ObjectName.quote(endpoint.getEndpointInfo().getName().toString());
+        buffer.append(ManagementConstants.NAME_PROP + "=" + endpointName);
+
+        //Use default domain name of server
+        return new ObjectName(buffer.toString());
+    }
+
+    public void startServer(Server s) {
+        if (server.equals(s)) {
+            state = State.STARTED;            
+        }
+    }
+
+    public void stopServer(Server s) {
+        if (server.equals(s)) {
+            state = State.STOPPED;            
+        }
+    }    
+    
+    
+    
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java?view=diff&rev=524010&r1=524009&r2=524010
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java Fri
Mar 30 02:46:54 2007
@@ -20,10 +20,15 @@
 package org.apache.cxf.endpoint;
 
 import java.io.IOException;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.management.JMException;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.management.InstrumentationManager;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.DestinationFactory;
@@ -31,8 +36,7 @@
 import org.apache.cxf.transport.MessageObserver;
 
 public class ServerImpl implements Server {
-    
-    private static final Logger LOG = Logger.getLogger(ServerImpl.class.getName());
+    private static final Logger LOG = LogUtils.getL7dLogger(ServerImpl.class);    
     private Destination destination;
     private MessageObserver messageObserver;
     private Endpoint endpoint;
@@ -72,6 +76,19 @@
             
         destination = destinationFactory.getDestination(ei);
         serverRegistry = bus.getExtension(ServerRegistry.class);
+        InstrumentationManager manager = bus.getExtension(InstrumentationManager.class);
+        if (manager != null) {            
+            ManagedEndpoint mep = new ManagedEndpoint(bus, endpoint, this);
+            mgr = bus.getExtension(ServerLifeCycleManager.class);
+            if (mgr != null) {
+                mgr.registerListener(mep);
+            }            
+            try {
+                manager.register(mep);
+            } catch (JMException jmex) {
+                LOG.log(Level.WARNING, "Registering ManagedEndpoint failed.", jmex);
+            }
+        }
     }
 
     public Destination getDestination() {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java?view=diff&rev=524010&r1=524009&r2=524010
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerLifeCycleManagerImpl.java
Fri Mar 30 02:46:54 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.endpoint;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.annotation.PostConstruct;
@@ -28,7 +29,7 @@
 
 public class ServerLifeCycleManagerImpl implements ServerLifeCycleManager {
     
-    private List<ServerLifeCycleListener> listeners;
+    private List<ServerLifeCycleListener> listeners = new ArrayList<ServerLifeCycleListener>();
     private Bus bus;
 
     public void registerListener(ServerLifeCycleListener listener) {

Modified: incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java?view=diff&rev=524010&r1=524009&r2=524010
==============================================================================
--- incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
(original)
+++ incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
Fri Mar 30 02:46:54 2007
@@ -42,6 +42,7 @@
 import javax.management.modelmbean.RequiredModelMBean;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.bus.ManagedBus;
 import org.apache.cxf.buslifecycle.BusLifeCycleListener;
 import org.apache.cxf.buslifecycle.BusLifeCycleManager;
 import org.apache.cxf.common.logging.LogUtils;
@@ -64,8 +65,10 @@
     private MBeanServer mbs;
     private Set<ObjectName> busMBeans = new HashSet<ObjectName>();
     private ModelMBeanAssembler assembler;
+    private boolean connectFailed;
     
-    public InstrumentationManagerImpl() {        
+    public InstrumentationManagerImpl() {
+        super();
         assembler = new ModelMBeanAssembler();
     }
     
@@ -92,11 +95,7 @@
     
     @PostConstruct     
     public void init() {    
-        if (isEnabled()) {        
-            if (LOG.isLoggable(Level.INFO)) {
-                LOG.info("Setting up MBeanServer ");
-            }
-
+        if (isEnabled()) {            
             List servers = MBeanServerFactory.findMBeanServer(ManagementConstants.DEFAULT_DOMAIN_NAME);
             if (servers.size() <= 1) {
                 mbs = MBeanServerFactory.createMBeanServer(ManagementConstants.DEFAULT_DOMAIN_NAME);
@@ -109,10 +108,22 @@
             mcf.setDaemon(isDaemon());
             mcf.setServiceUrl(getJMXServiceURL());
             try {            
-                mcf.createConnector();
+                mcf.createConnector();                
             } catch (IOException ex) {
+                connectFailed = true;
                 LOG.log(Level.SEVERE, "START_CONNECTOR_FAILURE_MSG", new Object[]{ex});
-            }                
+            }              
+
+            if (!connectFailed && null != bus) {            
+                try {
+                    //Register Bus here since we can guarantee that Instrumentation 
+                    //infrastructure has been initialized.
+                    ManagedBus mbus = new ManagedBus(bus);
+                    register(mbus);
+                } catch (JMException jmex) {
+                    LOG.log(Level.SEVERE, "REGISTER_FAILURE_MSG", new Object[]{bus, jmex});
+                }
+            }
         }
     }
 
@@ -121,7 +132,7 @@
     }
     
     public void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException
{
-        if (!isEnabled()) {
+        if (!isEnabled() || connectFailed) {
             return;           
         }
         //Try to register as a Standard MBean
@@ -155,7 +166,7 @@
     }
     
     public void unregister(ObjectName name) throws JMException {  
-        if (!isEnabled()) {
+        if (!isEnabled() || connectFailed) {
             return;           
         }
         
@@ -191,7 +202,7 @@
         Iterator<ObjectName> it = busMBeans.iterator();
         while (it.hasNext()) {
             ObjectName name = it.next();
-            busMBeans.remove(name);
+            it.remove();
             try {
                 unregister(name);
             } catch (JMException jmex) {

Modified: incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/JMXManagedComponentManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/JMXManagedComponentManagerTest.java?view=diff&rev=524010&r1=524009&r2=524010
==============================================================================
--- incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/JMXManagedComponentManagerTest.java
(original)
+++ incubator/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/JMXManagedComponentManagerTest.java
Fri Mar 30 02:46:54 2007
@@ -47,10 +47,10 @@
     }
     
     public void testRegisterInstrumentation() throws Exception {
-        manager.setDaemon(false);
-        manager.setThreaded(false);
-        manager.setJMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi");
-        manager.init();
+        //manager.setDaemon(false);
+        //manager.setThreaded(false);
+        //manager.setJMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi");
+        //manager.init();
 
         AnnotationTestInstrumentation im = new AnnotationTestInstrumentation();
         ObjectName name = new ObjectName("org.apache.cxf:type=foo,name=bar");        

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java?view=diff&rev=524010&r1=524009&r2=524010
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedBusTest.java
Fri Mar 30 02:46:54 2007
@@ -81,6 +81,18 @@
             assertEquals(result, Long.valueOf(250));
         }
 
-        bus.shutdown(true);
+        name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME 
+                                         + ":type=Bus,*");
+        s = mbs.queryNames(name, null);
+        assertTrue(s.size() == 1);
+        it = s.iterator();
+        while (it.hasNext()) {
+            ObjectName n = (ObjectName)it.next();
+            Object[] params = {Boolean.FALSE};
+            String[] sig = {"boolean"};
+            mbs.invoke(n, "shutdown", params, sig);            
+        }        
+        
+        //bus.shutdown(true);
     }
 }

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java?view=auto&rev=524010
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java
Fri Mar 30 02:46:54 2007
@@ -0,0 +1,136 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.management;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.management.InstrumentationManager;
+import org.apache.cxf.management.ManagementConstants;
+import org.apache.cxf.management.jmx.InstrumentationManagerImpl;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.GreeterImpl;
+import org.apache.hello_world_soap_http.SOAPService;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class ManagedClientServerTest extends AbstractBusClientServerTestBase {
+    
+    private final QName portName = 
+        new QName("http://apache.org/hello_world_soap_http",
+                  "SoapPort");    
+    
+    public static class Server extends AbstractBusTestServerBase {        
+        
+        protected void run() {
+            SpringBusFactory bf = new SpringBusFactory();
+            Bus bus = bf.createBus("org/apache/cxf/systest/management/managed-spring.xml",
true);
+            BusFactory.setDefaultBus(bus);
+            Object implementor = new GreeterImpl();
+            Endpoint.publish(null, implementor);
+        }
+
+        public static void main(String[] args) {
+            try {
+                Server s = new Server();
+                s.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.exit(-1);
+            } finally {
+                System.out.println("done!");
+            }
+        }
+    }
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
+    }
+    
+    @Test
+    public void testManagedEndpoint() throws Exception {
+        Bus bus = BusFactory.getDefaultBus();
+        InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
+        assertNotNull(im);
+        InstrumentationManagerImpl impl = (InstrumentationManagerImpl)im;
+        assertTrue(impl.isEnabled());
+        assertNotNull(impl.getMBeanServer());
+        
+        MBeanServer mbs = im.getMBeanServer();        
+        ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME 
+                                         + ":type=Bus.Service.Endpoint,*");
+        Set s = mbs.queryNames(name, null);
+        //assertTrue(s.size() == 1);
+        Iterator it = s.iterator();
+        
+        while (it.hasNext()) {
+            name = (ObjectName)it.next();
+            System.out.println("ObjectName: " + name);           
+        }
+        
+        Object val = mbs.invoke(name, "getState", new Object[0], new String[0]);    
+        assertEquals("Service should have been started.", "STARTED", val);
+        
+        SOAPService service = new SOAPService();
+        assertNotNull(service);
+        
+        Greeter greeter = service.getPort(portName, Greeter.class);
+        
+        String response = new String("Bonjour");
+        String reply = greeter.sayHi();
+        assertNotNull("no response received from service", reply);
+        assertEquals(response, reply);        
+        
+        mbs.invoke(name, "stop", new Object[0], new String[0]);    
+
+        val = mbs.getAttribute(name, "State");
+        
+        assertEquals("Service should have been stopped.", "STOPPED", val);
+        
+        try {
+            reply = greeter.sayHi();
+            fail("Endpoint should not be active at this point.");
+        } catch (Exception ex) {
+            //Expected
+        }
+        
+        mbs.invoke(name, "start", new Object[0], new String[0]);    
+
+        val = mbs.invoke(name, "getState", new Object[0], new String[0]);    
+        assertEquals("Service should have been started.", "STARTED", val);
+        
+        reply = greeter.sayHi();
+        assertNotNull("no response received from service", reply);
+        assertEquals(response, reply);               
+    }
+    
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/management/ManagedClientServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message