db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r631685 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management: JMXConnectionGetter.java RemoteConnectionGetter.java
Date Wed, 27 Feb 2008 19:29:51 GMT
Author: djd
Date: Wed Feb 27 11:29:50 2008
New Revision: 631685

URL: http://svn.apache.org/viewvc?rev=631685&view=rev
Log:
DERBY-3385 Add some support classes (not used yet) to allow decorators that can change the
mechanism of how to get a JMX MBeanServerConnection object. Thus supporting local and remote
testing of MBeans and eventually tests with JMX authentication.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/JMXConnectionGetter.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/RemoteConnectionGetter.java
  (with props)

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/JMXConnectionGetter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/JMXConnectionGetter.java?rev=631685&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/JMXConnectionGetter.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/JMXConnectionGetter.java
Wed Feb 27 11:29:50 2008
@@ -0,0 +1,44 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.management.JMXConnectionGetter
+
+ 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.derbyTesting.functionTests.tests.management;
+
+import javax.management.MBeanServerConnection;
+
+/**
+ * Interface for MBeanTest to get a MBeanServerConnection connection
+ * from. A decorator will setup mbeanServerConnector to point to
+ * an implementation of this class to obtain JMX connections.
+ */
+interface JMXConnectionGetter {
+
+    /**
+     * Holds the implementation of JMXConnectionGetter for
+     * an MBeanTest to use, set up by a decorator.
+     */
+    static final ThreadLocal<JMXConnectionGetter> mbeanServerConnector =
+         new ThreadLocal<JMXConnectionGetter>();
+
+    /**
+     * Get a connection to the platform MBean Server.
+     */
+    MBeanServerConnection getMBeanServerConnection() throws Exception;
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/JMXConnectionGetter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/RemoteConnectionGetter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/RemoteConnectionGetter.java?rev=631685&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/RemoteConnectionGetter.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/RemoteConnectionGetter.java
Wed Feb 27 11:29:50 2008
@@ -0,0 +1,46 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.management.RemoteConnectionGetter
+
+ 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.derbyTesting.functionTests.tests.management;
+
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+/**
+ * JMXConnectionGetter using a JMXServiceURL, currently
+ * with no authentication and not using SSL.
+ *
+ */
+class RemoteConnectionGetter implements JMXConnectionGetter {
+
+    private final JMXServiceURL url;
+
+    RemoteConnectionGetter(JMXServiceURL url) {
+        this.url = url;
+    }
+
+    public MBeanServerConnection getMBeanServerConnection() throws Exception {
+        // assumes that JMX authentication and SSL is not required (hence null)
+        JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
+        return jmxc.getMBeanServerConnection();
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/RemoteConnectionGetter.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message