[jboss-cvs] JBossAS SVN: r86129 - in projects/jbossmx/trunk: j2se and 58 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 19 16:48:18 EDT 2009
Author: adrian at jboss.org
Date: 2009-03-19 16:48:17 -0400 (Thu, 19 Mar 2009)
New Revision: 86129
Added:
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/ClassToStringAction.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/LoaderRepository.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/LoaderRepositoryFactory.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/RepositoryClassLoader.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/JBossMXMBeanServerDelegate.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/ObjectInputStreamWithClassLoader.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/PropertyAccess.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/ServerConfig.java
projects/jbossmx/trunk/jmx/src/resources/test/test/
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/User.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/xmbean.dtd
projects/jbossmx/trunk/jmx/src/test/org/
projects/jbossmx/trunk/jmx/src/test/org/jboss/
projects/jbossmx/trunk/jmx/src/test/test/JBossMXTest.java
projects/jbossmx/trunk/jmx/src/test/test/JBossMXTestDelegate.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/capability/PropertyAccess.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/ModelMBeanConstants.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/PropertyAccess.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/RequiredModelMBeanInstantiator.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/server/ExceptionHandler.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/server/ServerConstants.java
Removed:
projects/jbossmx/trunk/j2se/build.bat
projects/jbossmx/trunk/j2se/build.sh
projects/jbossmx/trunk/j2se/build.xml
projects/jbossmx/trunk/j2se/component-info.xml
projects/jbossmx/trunk/j2se/src/assembly/
projects/jbossmx/trunk/j2se/src/etc/
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/loading/
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/modelmbean/
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/server/
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/standardmbean/
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/AgentID.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MBeanInstaller.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MonitorCallback.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MonitorRunnable.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/ObservedObject.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/QueryExpSupport.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/RunnableScheduler.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/SchedulableRunnable.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/Serialization.java
projects/jbossmx/trunk/j2se/src/tests/
projects/jbossmx/trunk/jmx/build.bat
projects/jbossmx/trunk/jmx/build.sh
projects/jbossmx/trunk/jmx/build.xml
projects/jbossmx/trunk/jmx/src/assembly/
projects/jbossmx/trunk/jmx/src/etc/
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/standardmbean/
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/timer/
projects/jbossmx/trunk/jmx/src/resources/test/implementation/
projects/jbossmx/trunk/jmx/src/resources/test/log4j/
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/User.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd
projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/xmbean.dtd
projects/jbossmx/trunk/jmx/src/test/org/jboss/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/FullComplianceSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/loading/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/metadata/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/DescriptorTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanInfoSupportTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/monitor/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/notification/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/objectname/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/openmbean/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/relation/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/security/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/timer/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/varia/
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/serialization/
projects/jbossmx/trunk/jmx/src/test/test/compliance/FullComplianceSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/InterceptorTEST.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/loading/
projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/
projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/InvocationTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/serialize/
projects/jbossmx/trunk/jmx/src/test/test/performance/standard/InvocationTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/standard/OptimizedInvocationTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/timer/
projects/jbossmx/trunk/jmx/src/test/test/serialization/
projects/jbossmx/trunk/jmx/src/test/test/stress/
projects/jbossmx/trunk/mbeans/build.bat
projects/jbossmx/trunk/mbeans/build.sh
projects/jbossmx/trunk/mbeans/build.xml
Modified:
projects/jbossmx/trunk/j2se/.classpath
projects/jbossmx/trunk/j2se/pom.xml
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/JMXInvocationHandler.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MBeanServerLocator.java
projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/PropertyAccess.java
projects/jbossmx/trunk/jmx/.classpath
projects/jbossmx/trunk/jmx/pom.xml
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/JBossMXServerConfig.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/MBeanServerBuilderImpl.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/MBeanServerImpl.java
projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/ComplianceSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/notcompliant/NCMBeanSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/notcompliant/NCMBeanTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QueryMBeansObjectNameOnlyTestCase.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QuerySUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QueryTestCase.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/registration/RegistrationSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/registration/RegistrationTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/DefaultDomainTestCase.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanDelegateTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerBuilderTestCase.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerFactoryTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/BabarError.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/MyScreamingException.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/Test.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/TestMBean.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InfoTortureSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InfoUtil.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InheritanceSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/StandardMBeanTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/StandardSUITE.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/TrivialTEST.java
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/support/MBeanRunnable.java
projects/jbossmx/trunk/jmx/src/test/test/compliance/ComplianceSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/ImplementationSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/InterceptorSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/SharedInterceptorTEST.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/AttributeCacheTEST.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/ModelMBeanSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/XMBeanTEST.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/Trivial.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/User.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/AsynchNotificationBroadcasterSupportTestCase.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/NotificationSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/support/Listener.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/persistence/OnTimerPersistenceTEST.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/persistence/PersistenceSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/RegistrySUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/ValuesTestCase.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/support/Trivial.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/server/ObjectInstanceTestCase.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/server/ServerSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/server/support/Trivial.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/util/AgentIDTEST.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/util/MBeanProxyTEST.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/util/UtilSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/ExtendedResource.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/Resource.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/ResourceOverride.java
projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/Trivial.java
projects/jbossmx/trunk/jmx/src/test/test/performance/PerformanceSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/DynamicSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/ThroughputTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/invocationhandler/InvocationHandlerSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/performance/invocationhandler/ThroughputTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/modelmbean/ModelMBeanSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/performance/modelmbean/ThroughputTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/registration/RegistrationSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/performance/registration/RegistrationTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/standard/OptimizedThroughputTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/standard/StandardMBeanThroughputTEST.java
projects/jbossmx/trunk/jmx/src/test/test/performance/standard/StandardSUITE.java
projects/jbossmx/trunk/jmx/src/test/test/performance/standard/ThroughputTEST.java
projects/jbossmx/trunk/mbeans/pom.xml
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/capability/DispatcherFactory.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/interceptor/AbstractSharedInterceptor.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/metadata/JBossXMBean10.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/mxbean/MXBeanUtils.java
projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/persistence/DelegatingPersistenceManager.java
projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/support/SimpleInterface.java
projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/AbstractMXBeanTest.java
projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/CompositeTypeMetaDataFactoryUnitTestCase.java
projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/MXBeanInvocationHandlerUnitTestCase.java
projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/MXBeanSupportUnitTestCase.java
projects/jbossmx/trunk/pom.xml
Log:
[JBMX-7][JBMX-9] - Fix the testsuite and remove redundant code/tests, i.e. those that test/implement what is now JDK api
Modified: projects/jbossmx/trunk/j2se/.classpath
===================================================================
--- projects/jbossmx/trunk/j2se/.classpath 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/.classpath 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,10 +1,8 @@
<classpath>
<classpathentry kind="src" path="src/main"/>
- <classpathentry kind="src" path="src/tests" output="target/test-classes"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/integration/jboss-classloading-spi/6.0.0.Alpha4/jboss-classloading-spi-6.0.0.Alpha4.jar" sourcepath="M2_REPO/org/jboss/integration/jboss-classloading-spi/6.0.0.Alpha4/jboss-classloading-spi-6.0.0.Alpha4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.10.GA/jboss-common-core-2.2.10.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.10.GA/jboss-common-core-2.2.10.GA-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
</classpath>
\ No newline at end of file
Deleted: projects/jbossmx/trunk/j2se/build.bat
===================================================================
--- projects/jbossmx/trunk/j2se/build.bat 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/build.bat 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,89 +0,0 @@
- at echo off
-REM ======================================================================
-REM
-REM This is the main entry point for the build system.
-REM
-REM Users should be sure to execute this file rather than 'ant' to ensure
-REM the correct version is being used with the correct configuration.
-REM
-REM ======================================================================
-REM
-REM $Id$
-REM
-REM Authors:
-REM Jason Dillon <jason at planet57.com>
-REM Sacha Labourey <sacha.labourey at cogito-info.ch>
-REM
-
-REM ******************************************************
-REM Ignore the ANT_HOME variable: we want to use *our*
-REM ANT version and associated JARs.
-REM ******************************************************
-REM Ignore the users classpath, cause it might mess
-REM things up
-REM ******************************************************
-
-SETLOCAL
-
-set CLASSPATH=
-set ANT_HOME=
-set ANT_OPTS=-Djava.protocol.handler.pkgs=org.jboss.net.protocol -Dbuild.script=build.bat
-
-REM ******************************************************
-REM - "for" loops have been unrolled for compatibility
-REM with some WIN32 systems.
-REM ******************************************************
-
-set NAMES=tools;tools\ant;tools\apache\ant
-set SUBFOLDERS=..;..\..;..\..\..;..\..\..\..
-
-REM ******************************************************
-REM ******************************************************
-
-SET EXECUTED=FALSE
-for %%i in (%NAMES%) do call :subLoop %%i %1 %2 %3 %4 %5 %6
-
-goto :EOF
-
-
-REM ******************************************************
-REM ********* Search for names in the subfolders *********
-REM ******************************************************
-
-:subLoop
-for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%1\bin\ant.bat %2 %3 %4 %5 %6 %7
-
-goto :EOF
-
-
-REM ******************************************************
-REM ************ Test if ANT Batch file exists ***********
-REM ******************************************************
-
-:testIfExists
-if exist %1 call :BatchFound %1 %2 %3 %4 %5 %6 %7 %8
-
-goto :EOF
-
-
-REM ******************************************************
-REM ************** Batch file has been found *************
-REM ******************************************************
-
-:BatchFound
-if (%EXECUTED%)==(FALSE) call :ExecuteBatch %1 %2 %3 %4 %5 %6 %7 %8
-set EXECUTED=TRUE
-
-goto :EOF
-
-REM ******************************************************
-REM ************* Execute Batch file only once ***********
-REM ******************************************************
-
-:ExecuteBatch
-echo Calling %1 %2 %3 %4 %5 %6 %7 %8
-call %1 %2 %3 %4 %5 %6 %7 %8
-
-:end
-
-if "%NOPAUSE%" == "" pause
Deleted: projects/jbossmx/trunk/j2se/build.sh
===================================================================
--- projects/jbossmx/trunk/j2se/build.sh 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/build.sh 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,172 +0,0 @@
-#!/bin/sh
-### ====================================================================== ###
-## ##
-## This is the main entry point for the build system. ##
-## ##
-## Users should be sure to execute this file rather than 'ant' to ensure ##
-## the correct version is being used with the correct configuration. ##
-## ##
-### ====================================================================== ###
-
-# $Id$
-
-PROGNAME=`basename $0`
-DIRNAME=`dirname $0`
-GREP="grep"
-ROOT="/"
-
-# Ignore user's ANT_HOME if it is set
-ANT_HOME=""
-
-# the default search path for ant
-ANT_SEARCH_PATH="\
- tools
- tools/ant \
- tools/apache/ant \
- ant"
-
-# the default build file name
-ANT_BUILD_FILE="build.xml"
-
-# the default arguments
-ANT_OPTIONS="--noconfig -find $ANT_BUILD_FILE"
-
-# Use the maximum available, or set MAX_FD != -1 to use that
-MAX_FD="maximum"
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false;
-darwin=false;
-case "`uname`" in
- CYGWIN*)
- cygwin=true
- ;;
-
- Darwin*)
- darwin=true
- ;;
-esac
-
-#
-# Helper to complain.
-#
-die() {
- echo "${PROGNAME}: $*"
- exit 1
-}
-
-#
-# Helper to complain.
-#
-warn() {
- echo "${PROGNAME}: $*"
-}
-
-#
-# Helper to source a file if it exists.
-#
-maybe_source() {
- for file in $*; do
- if [ -f "$file" ]; then
- . $file
- fi
- done
-}
-
-search() {
- search="$*"
- for d in $search; do
- ANT_HOME="`pwd`/$d"
- ANT="$ANT_HOME/bin/ant"
- if [ -x "$ANT" ]; then
- # found one
- echo $ANT_HOME
- break
- fi
- done
-}
-
-#
-# Main function.
-#
-main() {
- # if there is a build config file. then source it
- maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"
-
- # Increase the maximum file descriptors if we can
- if [ $cygwin = "false" ]; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ]; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
- # use the system max
- MAX_FD="$MAX_FD_LIMIT"
- fi
-
- ulimit -n $MAX_FD
- if [ $? -ne 0 ]; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
- fi
-
- # try the search path
- ANT_HOME=`search $ANT_SEARCH_PATH`
-
- # try looking up to root
- if [ "x$ANT_HOME" = "x" ]; then
- target="build"
- _cwd=`pwd`
-
- while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
- cd ..
- cwd=`pwd`
- ANT_HOME=`search $ANT_SEARCH_PATH`
- done
-
- # make sure we get back
- cd $_cwd
-
- if [ "$cwd" != "$ROOT" ]; then
- found="true"
- fi
-
- # complain if we did not find anything
- if [ "$found" != "true" ]; then
- die "Could not locate Ant; check \$ANT or \$ANT_HOME."
- fi
- fi
-
- # make sure we have one
- ANT=$ANT_HOME/bin/ant
- if [ ! -x "$ANT" ]; then
- die "Ant file is not executable: $ANT"
- fi
-
- # need to specify planet57/buildmagic protocol handler package
- ANT_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"
-
- # setup some build properties
- ANT_OPTS="$ANT_OPTS -Dbuild.script=$0"
-
- # change to the directory where the script lives so users are not forced
- # to be in the same directory as build.xml
- cd $DIRNAME
-
- # export some stuff for ant
- export ANT ANT_HOME ANT_OPTS
-
- # execute in debug mode, or simply execute
- if [ "x$ANT_DEBUG" != "x" ]; then
- /bin/sh -x $ANT $ANT_OPTIONS "$@"
- else
- exec $ANT $ANT_OPTIONS "$@"
- fi
-}
-
-##
-## Bootstrap
-##
-
-main "$@"
Deleted: projects/jbossmx/trunk/j2se/build.xml
===================================================================
--- projects/jbossmx/trunk/j2se/build.xml 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/build.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,208 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE project [
- <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
- <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
- <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
- <!ENTITY targets SYSTEM "../tools/etc/buildmagic/targets.ent">
-]>
-
-<!-- ====================================================================== -->
-<!-- -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- -->
-<!-- Distributable under LGPL license. -->
-<!-- See terms of license at http://www.gnu.org. -->
-<!-- -->
-<!-- ====================================================================== -->
-
-<!-- $Id$ -->
-
-<project default="main" name="JBoss/J2SE">
-
- <!-- ================================================================== -->
- <!-- Setup -->
- <!-- ================================================================== -->
-
- <!--
- | Include the common Buildmagic elements.
- |
- | This defines several different targets, properties and paths.
- | It also sets up the basic extention tasks amoung other things.
- -->
-
- &buildmagic;
-
- <!--
- | Include the normal targets.
- -->
- &targets;
-
- <!-- ================================================================== -->
- <!-- Configuration -->
- <!-- ================================================================== -->
-
- <!--
- | Configure the build system.
- |
- | This target is invoked by the Buildmagic initialization logic and
- | should contain module specific configuration elements.
- -->
-
- <target name="configure" unless="configure.disable">
-
- <!-- =================== -->
- <!-- Basic Configuration -->
- <!-- =================== -->
-
- <!-- Module name(s) & version -->
- <property name="module.name" value="j2se"/>
- <property name="module.Name" value="JBoss/J2SE"/>
- <property name="module.version" value="DEV"/>
-
- <!-- ========= -->
- <!-- Libraries -->
- <!-- ========= -->
- &libraries;
-
- <!-- The combined library classpath -->
- <path id="library.classpath">
- <path refid="oswego.concurrent.classpath"/>
- <path refid="dom4j.dom4j.classpath"/>
- <path refid="junit.junit.classpath"/>
- <path refid="jboss.integration.classpath"/>
- </path>
-
- <!-- ======= -->
- <!-- Modules -->
- <!-- ======= -->
- &modules;
-
- <!-- The combined dependent module classpath -->
- <path id="dependentmodule.classpath">
- <path refid="jboss.common.core.classpath"/>
- <path refid="jboss.common.logging.spi.classpath"/>
- <path refid="jboss.common.logging.log4j.classpath"/>
- <path refid="jboss.common.logging.jdk.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
- </path>
-
- <!-- ===== -->
- <!-- Tasks -->
- <!-- ===== -->
- <property name="javac.target" value="1.5"/>
- <property name="javac.source" value="1.5"/>
- <property name="source.java" value="${module.source}/main"/>
- <property name="source.tests" value="${module.source}/tests"/>
- <call target="_default:task-init"/>
- </target>
-
- <!-- ================================================================== -->
- <!-- Compile -->
- <!-- ================================================================== -->
-
- <!--
- | Compile everything.
- |
- | This target should depend on other compile-* targets for each
- | different type of compile that needs to be performed, short of
- | documentation compiles.
- -->
-
- <target name="compile"
- description="Compile all source files."
- depends="compile-classes, _default:compile-etc"/>
-
- <!-- Compile all class files -->
- <target name="compile-classes" depends="init" unless="compile.disable">
- <mkdir dir="${build.classes}"/>
-
- <!-- Hack, required to avoid duplicate javac targets -->
- <mkdir dir="${build.gen-src}"/>
-
- <!-- Remove classes which depend on changed files, so they will rebuild. -->
- <depend srcdir="${source.java}:${source.tests}"
- destdir="${build.classes}"
- dump="${javac.depend.dump}"
- closure="${javac.depend.closure}">
- <include name="${javac.includes}"/>
- <exclude name="${javac.excludes}"/>
- </depend>
-
- <javac destdir="${build.classes}"
- optimize="${javac.optimize}"
- target="${javac.target}"
- source="${javac.source}"
- debug="${javac.debug}"
- depend="${javac.depend}"
- verbose="${javac.verbose}"
- deprecation="${javac.deprecation}"
- includeAntRuntime="${javac.include.ant.runtime}"
- includeJavaRuntime="${javac.include.java.runtime}"
- includes="${javac.includes}"
- excludes="${javac.excludes}"
- failonerror="${javac.fail.onerror}">
- <bootclasspath>
- <path refid="javac.bootclasspath"/>
- </bootclasspath>
- <src path="${source.java}:${source.tests}"/>
- <classpath refid="javac.classpath"/>
- </javac>
- </target>
-
- <!-- ================================================================== -->
- <!-- Archives -->
- <!-- ================================================================== -->
-
- <!--
- | Build all jar files.
- -->
- <target name="module-jars">
-
- <!-- Build jboss-j2se.jar -->
- <jar jarfile="${build.lib}/${jar.server.name}"
- manifest="${build.etc}/default.mf">
- <fileset dir="${build.classes}">
- <exclude name="org/jboss/test/**"/>
- </fileset>
- </jar>
-
- <!-- Build jboss-jmx-compliance.jar -->
- <jar jarfile="${build.lib}/jboss-jmx-compliance.jar"
- manifest="${build.etc}/default.mf">
- <fileset dir="${build.classes}">
- <include name="org/jboss/test/**"/>
- <exclude name="org/jboss/test/jmx/compliance/loading/support/*.class"/>
- <exclude name="org/jboss/test/jmx/compliance/server/support/AClass.*"/>
- </fileset>
- </jar>
-
- <jar jarfile="${build.lib}/jmxcompliance-MyMBeans.jar">
- <fileset dir="${build.classes}">
- <include name="org/jboss/test/jmx/compliance/loading/support/Trivial.class"/>
- <include name="org/jboss/test/jmx/compliance/loading/support/Trivial2.class"/>
- <include name="org/jboss/test/jmx/compliance/loading/support/TrivialMBean.class"/>
- <include name="org/jboss/test/jmx/compliance/loading/support/Trivial2MBean.class"/>
- <include name="org/jboss/test/jmx/compliance/loading/support/Another*.class"/>
- </fileset>
- </jar>
-
- <jar jarfile="${build.lib}/jmxcompliance-MyMBeans2.jar">
- <fileset dir="${build.classes}">
- <include name="org/jboss/test/jmx/compliance/loading/support/Trivial*.class"/>
- </fileset>
- </jar>
-
- <jar jarfile="${build.lib}/jmxcompliance-MoreMBeans.jar">
- <fileset dir="${build.classes}">
- <include name="org/jboss/test/jmx/compliance/loading/support/AClass.class"/>
- </fileset>
- </jar>
-
- <jar jarfile="${build.lib}/jmxcompliance-Test.jar">
- <fileset dir="${build.classes}">
- <include name="org/jboss/test/jmx/compliance/server/support/AClass.class"/>
- </fileset>
- </jar>
- </target>
-
-</project>
Deleted: projects/jbossmx/trunk/j2se/component-info.xml
===================================================================
--- projects/jbossmx/trunk/j2se/component-info.xml 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/component-info.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,25 +0,0 @@
-<project name="j2se-component-info">
-
- <!-- ============================================================ -->
- <!-- J2SE -->
- <!-- ============================================================ -->
-
- <component id="j2se"
- module="jboss-j2se"
- version="5.0-SNAPSHOT"
- >
- <artifact id="jboss-j2se.jar"/>
- <artifact id="jboss-jmx-compliance.jar"/>
- <artifact id="jmxcompliance-MyMBeans.jar"/>
- <artifact id="jmxcompliance-MyMBeans2.jar"/>
- <artifact id="jmxcompliance-MoreMBeans.jar"/>
- <artifact id="jmxcompliance-Test.jar"/>
- <export>
- <include input="jboss-j2se.jar"/>
- </export>
- </component>
-
- <includes id="j2se-jmx-compliance">
- <include input="jboss-jmx-compliance.jar"/>
- </includes>
-</project>
\ No newline at end of file
Modified: projects/jbossmx/trunk/j2se/pom.xml
===================================================================
--- projects/jbossmx/trunk/j2se/pom.xml 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/pom.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -28,87 +28,6 @@
<skip>true</skip>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>test-jar</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>assembly</id>
- <goals>
- <goal>attached</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- <configuration>
- <descriptorSourceDirectory>src/assembly</descriptorSourceDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>create-output</id>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <tasks>
-
- <mkdir dir="output/etc" />
- <copy todir="output/etc" filtering="yes">
- <fileset dir="src/etc">
- <include name="**" />
- </fileset>
- </copy>
-
- <mkdir dir="output/lib" />
- <copy file="target/${artifactId}.jar" tofile="output/lib/jboss-j2se.jar" />
- <copy file="target/${artifactId}-jboss-jmx-compliance.jar" tofile="output/lib/jboss-jmx-compliance.jar" />
- <copy file="target/${artifactId}-jmxcompliance-MoreMBeans.jar" tofile="output/lib/jmxcompliance-MoreMBeans.jar" />
- <copy file="target/${artifactId}-jmxcompliance-MyMBeans.jar" tofile="output/lib/jmxcompliance-MyMBeans.jar" />
- <copy file="target/${artifactId}-jmxcompliance-MyMBeans2.jar" tofile="output/lib/jmxcompliance-MyMBeans2.jar" />
- <copy file="target/${artifactId}-jmxcompliance-Test.jar" tofile="output/lib/jmxcompliance-Test.jar" />
-
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <executions>
- <execution>
- <id>clean-output</id>
- <goals>
- <goal>clean</goal>
- </goals>
- <phase>clean</phase>
- <configuration>
- <filesets>
- <fileset>
- <directory>output</directory>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
<dependencies>
@@ -125,12 +44,6 @@
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
</dependency>
- <!-- Test scope dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/AgentID.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/AgentID.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/AgentID.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-import java.net.InetAddress;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.mx.server.ServerConstants;
-
-/**
- * Utility class for creating JMX agent identifiers. Also contains the
- * helper method for retrieving the <tt>AgentID</tt> of an existing MBean server
- * instance.
- *
- * @see javax.management.MBeanServerDelegateMBean
- *
- * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
- * @version $Revision$
- *
- */
-public class AgentID
- implements ServerConstants
-{
- // Static ----------------------------------------------------
- private static AtomicLong id = new AtomicLong(0);
-
- private static final Random rand = new Random(System.currentTimeMillis());
-
- /**
- * Creates a new agent ID string. The identifier is of the form
- * <tt><ip.address>/<creation time in ms>/<VMID+(random int 0-100)>/<sequence #></tt>.<P>
- *
- * This AgentID string is globally unique.
- *
- * @return Agent ID string
- */
- public static String create()
- {
- String ipAddress = null;
-
- try
- {
- ipAddress = AccessController.doPrivileged(
- new PrivilegedExceptionAction<String>()
- {
- public String run() throws Exception
- {
- return InetAddress.getLocalHost().getHostAddress();
- }
- }
- );
- }
- catch(PrivilegedActionException e)
- {
- ipAddress = "127.0.0.1";
- }
- // use the VMID to create a more unique ID that can be used to guarantee that this
- // MBeanServerID is unique across multiple JVMs, even on the same host
- String vmid = new java.rmi.dgc.VMID().toString().replace(':','x').replace('-','X') + rand.nextInt(100);
-
- return ipAddress + "/" + System.currentTimeMillis() + "/" + vmid + "/"+ (id.incrementAndGet());
- }
- /**
- * test
- *
- * @param args
- */
- public static void main (String args[])
- {
- for (int c=0;c<10;c++)
- System.out.println(AgentID.create());
- }
-
- /**
- * Returns the agent identifier string of a given MBean server instance.
- *
- * @param server the MBeanServer
- * @return <tt>MBeanServerId</tt> attribute of the MBean server delegate.
- */
- public static String get(MBeanServer server)
- {
- try
- {
- ObjectName name = new ObjectName(MBEAN_SERVER_DELEGATE);
- String agentID = (String)server.getAttribute(name, "MBeanServerId");
-
- return agentID;
- }
- catch (Throwable t)
- {
- throw new Error("Cannot find the MBean server delegate: " + t.toString());
- }
- }
-}
-
-
-
-
Modified: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/JMXInvocationHandler.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/JMXInvocationHandler.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/JMXInvocationHandler.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -353,7 +353,7 @@
public String toString()
{
- return "MBeanProxy for " + objectName + " (Agent ID: " + AgentID.get(server) + ")";
+ return "MBeanProxy for " + objectName;
}
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MBeanInstaller.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MBeanInstaller.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MBeanInstaller.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,493 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
-import java.io.InputStream;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.loading.MBeanElement;
-import org.jboss.mx.server.ObjectInputStreamWithClassLoader;
-import org.jboss.mx.server.ServerConstants;
-import org.jboss.util.UnreachableStatementException;
-
-/**
- * MBean installer utility<p>
- *
- * This installer allows MLet to install or upgrade a mbean based on the version
- * specified in the MLet conf file. If the mbean version is newer than the
- * registered in the server, the installer unregisters the old mbean and then
- * registers the new one. This management needs to store the mbean version into
- * the MBeanRegistry in the server.
- *
- * When we register mbeans, however, we can't pass the metadata to MBeanServer
- * through the standard JMX api because Both of createMBean() and registerMBean()
- * have no extra arguments to attach the metadata. Thus we call
- * MBeanServer.invoke() directly to set/get the internal MBean metadata.
- *
- * Currently version and date are stored in the mbean registry as mbean metadata.
- * The date will be used for preparing presentaionString for this mbean info.
- * For managment purpose, we can add any extra data to the matadata if you need.
- *
- * @author <a href="mailto:Fusayuki.Minamoto at fujixerox.co.jp">Fusayuki Minamoto</a>.
- * @author <a href="mailto:jplindfo at helsinki.fi">Juha Lindfors</a>.
- *
- * @version $Revision$
- *
- * <p><b>Revisions:</b>
- *
- * <p><b>20020219 Juha Lindfors:</b>
- * <ul>
- * <li>Clarified the use of classloaders in the code, renaming loader to a more
- * explicit ctxClassLoader
- * </li>
- * <li>Fixed some irregularities with the install/update code -- original
- * implementatio was cause IndexOutOfBoundsExceptions which prevented
- * some replacements in valid cases. Fixing this uncovered update logic
- * that would replace MBeans that were not associated with versioning
- * information at all.
- * <p>
- * The current semantics should be:
- * <ol>
- * <li>If an MBean is registered without versioning information it can
- * never be automatically replaced by another MBean (regardless of
- * the versioning information in the new MBean).
- * </li>
- * <li>An MBean that has a higher version number (as determined by the
- * MLetVersion Comparable interface) can automatically replace an
- * MBean that was registered with a lower version number.
- * </li>
- * <li>An MBean without versioning info can never automatically replace
- * an MBean that was registered with version.
- * </li>
- * </ol>
- * </li>
- * </ul>
- */
-public class MBeanInstaller
-{
- // Constants -----------------------------------------------------
-
- public static final String VERSIONS = "versions";
- public static final String DATE = "date";
-
-
- // Static --------------------------------------------------------
-
- /**
- * Logger instance.
- */
- private static final Logger log = Logger.getLogger(MBeanInstaller.class);
-
- /** Augment the PropertyEditorManager search path to incorporate the JBoss
- specific editors. This simply references the PropertyEditors.class to
- invoke its static initialization block.
- */
- static
- {
- Class<?> c = org.jboss.util.propertyeditor.PropertyEditors.class;
- if (c == null)
- throw new UnreachableStatementException();
- }
-
-
- // Attributes ----------------------------------------------------
-
- /**
- * Reference to the MBean server the installed MBeans will get registered to.
- */
- private MBeanServer server;
-
- /**
- * Reference to the context classloader of the MLet MBean that is installing
- * the new MBeans.
- */
- private ClassLoader ctxClassLoader;
-
- /**
- * Object name of the MLet MBean installing new MBeans to the server. This
- * object name is used as the explicit classloader object name when
- * instantiating new MBeans. This is to ensure the MLet's classloader is the
- * first one to be consulted when loading classes. This is implicitly
- * guaranteed by the UnifiedLoaderRepository but is not necessarily the case
- * with other loader repository implementations.
- */
- private ObjectName loaderName;
-
- /**
- * Object name of the MBeanServer registry MBean.
- */
- private ObjectName registryName;
-
-
- // Constructors --------------------------------------------------
-
- /**
- * Create a new MBean installer instance.
- *
- * @param server reference to the MBean server where the new MBeans will
- * be registered to
- * @param ctxClassLoader Context class loader reference which will be
- * stored in the registry for the new MBeans. This
- * classloader will be set as the thread context
- * classloader when the MBean is invoked.
- * @param loaderName Object name of the classloader that should be
- * used to instantiate the newly registered MBeans.
- * This should normally be the object name of the
- * MLet MBean that is installing the new MBeans.
- * @throws Exception for any error
- */
- public MBeanInstaller(MBeanServer server, ClassLoader ctxClassLoader, ObjectName loaderName)
- throws Exception
- {
- this.server = server;
- this.ctxClassLoader = ctxClassLoader;
- this.loaderName = loaderName;
- this.registryName = new ObjectName(ServerConstants.MBEAN_REGISTRY);
- }
-
-
- // Public --------------------------------------------------------
-
- /**
- * Install a mbean with mbean metadata<p>
- *
- * @param element the data parsed from the Mlet file
- *
- * @return mbean instance
- * @throws MBeanException
- * @throws ReflectionException
- * @throws InstanceNotFoundException
- * @throws MalformedObjectNameException
- */
- public ObjectInstance installMBean(MBeanElement element)
- throws MBeanException,
- ReflectionException,
- InstanceNotFoundException,
- MalformedObjectNameException
- {
- log.debug("Installing MBean: " + element);
-
- ObjectInstance instance = null;
- ObjectName elementName = getElementName(element);
-
- if (element.getVersions().isEmpty() || !server.isRegistered(elementName))
- {
- if (element.getCode() != null)
- instance = createMBean(element);
- else if (element.getObject() != null)
- instance = deserialize(element);
- else
- throw new MBeanException(new IllegalArgumentException("No code or object tag"));
- }
- else
- instance = updateMBean(element);
-
- return instance;
- }
-
- public ObjectInstance createMBean(MBeanElement element)
- throws MBeanException,
- ReflectionException,
- InstanceNotFoundException,
- MalformedObjectNameException
- {
- log.debug("Creating MBean.. ");
-
- ObjectName elementName = getElementName(element);
-
- // Set up the valueMap passing to the registry.
- // This valueMap contains mbean meta data and update time.
- Map<String, Object> valueMap = createValueMap(element);
-
- // Create the mbean instance
-
- // TODO:
- // check the delegateToCLR attribute in the MLetElement here to determine
- // the loading behavior in case of CNFE
-
- String[] classes = element.getConstructorTypes();
- String[] paramStrings = element.getConstructorValues();
- Object[] params = new Object[paramStrings.length];
- for (int i = 0; i < paramStrings.length; ++i)
- {
- try
- {
- Class<?> typeClass = server.getClassLoaderRepository().loadClass(classes[i]);
- PropertyEditor editor = PropertyEditorManager.findEditor(typeClass);
- if (editor == null)
- throw new IllegalArgumentException("No property editor for type=" + typeClass);
-
- editor.setAsText(paramStrings[i]);
- params[i] = editor.getValue();
- }
- catch (Exception e)
- {
- throw new MBeanException(e);
- }
- }
- Object instance = server.instantiate(
- element.getCode(),
- loaderName,
- params,
- classes);
-
- // Call MBeanRegistry.invoke("registerMBean") instead of server.registerMBean() to pass
- // the valueMap that contains management values including mbean metadata and update time.
- return registerMBean(instance, elementName, valueMap);
- }
-
- public ObjectInstance deserialize(MBeanElement element) throws MBeanException,
- ReflectionException,
- InstanceNotFoundException,
- MalformedObjectNameException
- {
- InputStream is = null;
- Object instance = null;
- try
- {
- is = ctxClassLoader.getResourceAsStream(element.getObject());
- if (is == null)
- throw new IllegalArgumentException("Object not found " + element.getObject());
- ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(is, ctxClassLoader);
- instance = ois.readObject();
- }
- catch (Exception e)
- {
- throw new MBeanException(e);
- }
- finally
- {
- if (is != null)
- {
- try
- {
- is.close();
- }
- catch (Exception ignored)
- {
- }
- }
- }
- ObjectName elementName = getElementName(element);
-
- // Set up the valueMap passing to the registry.
- // This valueMap contains mbean meta data and update time.
- Map<String, Object> valueMap = createValueMap(element);
- return registerMBean(instance, elementName, valueMap);
- }
-
- public ObjectInstance updateMBean(MBeanElement element)
- throws MBeanException,
- ReflectionException,
- InstanceNotFoundException,
- MalformedObjectNameException
- {
- log.debug("updating MBean... ");
-
- ObjectName elementName = getElementName(element);
-
- // Compare versions to decide whether to skip installation of this mbean
- MLetVersion preVersion = new MLetVersion(getVersions(elementName));
- MLetVersion newVersion = new MLetVersion(element.getVersions());
-
- log.debug("Installed version : " + preVersion);
- log.debug("Loaded version : " + newVersion);
-
- // FIXME: this comparison works well only if both versions are specified
- // because jmx spec doesn't fully specify this behavior.
- if (!preVersion.isNull() && !newVersion.isNull() && preVersion.compareTo(newVersion) < 0)
- {
- // Unregister previous mbean
- if (server.isRegistered(elementName))
- {
- unregisterMBean(elementName);
-
- log.debug("Unregistering previous version " + preVersion);
- }
-
- log.debug("Installing newer version " + newVersion);
-
- // Create mbean with value map
- return createMBean(element);
- }
-
- return server.getObjectInstance(elementName);
- }
-
-
- // Private -------------------------------------------------------
-
- private ObjectName getElementName(MBeanElement element)
- throws MalformedObjectNameException
- {
- return (element.getName() != null) ? new ObjectName(element.getName()) : null;
- }
-
- private Map<String, Object> createValueMap(MBeanElement element)
- {
- HashMap<String, Object> valueMap = new HashMap<String, Object>();
-
- // We need to set versions here because we can't get the mbean entry
- // outside the server.
- if (element.getVersions() != null && !element.getVersions().isEmpty())
- valueMap.put(VERSIONS, element.getVersions());
-
- // The date would be used to make a presentationString for this mbean.
- valueMap.put(DATE, new Date(System.currentTimeMillis()));
-
- // Context class loader for the MBean.
- valueMap.put(ServerConstants.CLASSLOADER, ctxClassLoader);
-
- return valueMap;
- }
-
- @SuppressWarnings("unchecked")
- private List<String> getVersions(ObjectName name)
- throws MBeanException, ReflectionException, InstanceNotFoundException
- {
- if (!server.isRegistered(name))
- return null;
-
- return (List) getValue(name, VERSIONS);
- }
-
-
- private Object getValue(ObjectName name, String key)
- throws MBeanException, ReflectionException, InstanceNotFoundException
- {
- Object value =
- server.invoke(registryName, "getValue",
- new Object[]
- {
- name,
- key
- },
- new String[]
- {
- ObjectName.class.getName(),
- String.class.getName()
- }
- );
-
- return value;
- }
-
- private ObjectInstance registerMBean(Object object, ObjectName name, Map<String, Object> valueMap)
- throws MBeanException, ReflectionException, InstanceNotFoundException
- {
- if (object == null)
- {
- throw new ReflectionException(new IllegalArgumentException(
- "Attempting to register a null object"
- ));
- }
-
- return (ObjectInstance)
- server.invoke(registryName, "registerMBean",
- new Object[]
- {
- object,
- name,
- valueMap
- },
- new String[]
- {
- Object.class.getName(),
- ObjectName.class.getName(),
- Map.class.getName()
- }
- );
- }
-
- private void unregisterMBean(ObjectName name)
- throws MBeanException, ReflectionException, InstanceNotFoundException
- {
- server.invoke(registryName, "unregisterMBean",
- new Object[]
- {
- name,
- },
- new String[]
- {
- ObjectName.class.getName(),
- }
- );
- }
-}
-
-/**
- * MLetVersion for encapsulating the version representation<p>
- *
- * Because this class is comparable, you can elaborate the
- * version comparison algorithm if you need better one.
- */
-class MLetVersion implements Comparable<MLetVersion>
-{
- protected List<String> versions;
-
- public MLetVersion(List<String> versions)
- {
- this.versions = versions;
- }
-
- public List<String> getVersions()
- {
- return versions;
- }
-
- public boolean isNull()
- {
- return versions == null || versions.isEmpty();
- }
-
- public int compareTo(MLetVersion other)
- {
- if (isNull() || other.isNull())
- throw new IllegalArgumentException("MLet versions is null");
-
- // FIXME: this compares only first element of the versions.
- // do we really need multiple versions?
- String thisVersion = versions.get(0);
- String otherVersion = other.getVersions().get(0);
-
- return (thisVersion.compareTo(otherVersion));
- }
-
- public String toString()
- {
- return "Version " + versions.get(0);
- }
-}
Modified: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MBeanServerLocator.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MBeanServerLocator.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MBeanServerLocator.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -25,6 +25,7 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
/**
* A helper class to locate an MBeanServer.
@@ -122,4 +123,25 @@
}
throw new IllegalStateException("No 'jboss' MBeanServer found!");
}
+
+ /**
+ * Returns the agent identifier string of a given MBean server instance.
+ *
+ * @param server the MBeanServer
+ * @return <tt>MBeanServerId</tt> attribute of the MBean server delegate.
+ */
+ public static String getId(MBeanServer server)
+ {
+ try
+ {
+ ObjectName name = ObjectName.getInstance("JMImplementation:type=MBeanServerDelegate");
+ String agentID = (String)server.getAttribute(name, "MBeanServerId");
+
+ return agentID;
+ }
+ catch (Throwable t)
+ {
+ throw new Error("Cannot find the MBean server delegate: " + t.toString());
+ }
+ }
}
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MonitorCallback.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MonitorCallback.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MonitorCallback.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.ObjectName;
-import javax.management.monitor.MonitorNotification;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface MonitorCallback
-{
- /**
- * Perform the monitor specific processing.
- *
- * @param object the ObservedObject.
- * @param attributeInfo the MBean attribute information.
- * @param value the value to monitor.
- * @throws Exception for any error
- */
- public void monitorCallback(ObservedObject object, MBeanAttributeInfo attributeInfo,
- Object value) throws Exception;
-
- public MonitorNotification createNotification(String type, Object source,
- long timeStamp, String message, Object derivedGauge,
- String observedAttribute, ObjectName observedObject,
- Object trigger);
-}
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MonitorRunnable.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MonitorRunnable.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/MonitorRunnable.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,269 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-import java.util.Iterator;
-import java.util.Map;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.monitor.Monitor;
-import javax.management.monitor.MonitorNotification;
-
-import org.jboss.logging.Logger;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class MonitorRunnable
- extends SchedulableRunnable
-{
- private static final Logger log = Logger.getLogger(MonitorRunnable.class);
-
- /**
- * The scheduler.
- */
- static RunnableScheduler scheduler;
-
- /**
- * Start the scheduler
- */
- static
- {
- scheduler = new RunnableScheduler();
- scheduler.start();
- }
-
- // Attributes ----------------------------------------------------
-
- // The monitoring to perform
- private Monitor monitor;
- private ObjectName monitorName;
- private MonitorCallback callback;
- private Map<Object, ObservedObject> observedObjects;
- private MBeanServer server;
-
- // Constructors --------------------------------------------------
-
- /**
- * Create a monitor runnable to periodically perform monitoring.
- *
- * @param monitor the monitoring to perform.
- * @param monitorName
- * @param callback
- * @param observedObjects
- * @param server
- */
- public MonitorRunnable(Monitor monitor, ObjectName monitorName,
- MonitorCallback callback, Map<Object, ObservedObject> observedObjects, MBeanServer server)
- {
- this.monitor = monitor;
- this.monitorName = monitorName;
- this.callback = callback;
- this.observedObjects = observedObjects;
- this.server = server;
- setScheduler(scheduler);
- }
-
- // Public --------------------------------------------------------
-
- /**
- * Run the monitor.<p>
- *
- * Retrieves the monitored attribute and passes it to each service.<p>
- *
- * Peforms the common error processing.
- *
- * @param object the mbean to run the monitor on
- */
- void runMonitor(ObservedObject object)
- {
- // Monitor for uncaught errors
- try
- {
- MBeanInfo mbeanInfo = null;
- try
- {
- mbeanInfo = server.getMBeanInfo(object.getObjectName());
- }
- catch (InstanceNotFoundException e)
- {
- sendObjectErrorNotification(object, "The observed object is not registered.");
- return;
- }
-
- // Get the attribute information
- MBeanAttributeInfo[] mbeanAttributeInfo = mbeanInfo.getAttributes();
- MBeanAttributeInfo attributeInfo = null;
- for (int i = 0; i < mbeanAttributeInfo.length; i++)
- {
- if (mbeanAttributeInfo[i].getName().equals(monitor.getObservedAttribute()))
- {
- attributeInfo = mbeanAttributeInfo[i];
- break;
- }
- }
-
- // The attribute must exist
- if (attributeInfo == null)
- {
- sendAttributeErrorNotification(object,
- "The observed attribute does not exist");
- return;
- }
-
- // The attribute must exist
- if (!attributeInfo.isReadable())
- {
- sendAttributeErrorNotification(object, "Attribute not readable.");
- return;
- }
-
- // Get the value
- Object value = null;
- try
- {
- value = server.getAttribute(object.getObjectName(), monitor.getObservedAttribute());
- }
- catch (InstanceNotFoundException e)
- {
- sendObjectErrorNotification(object, "The observed object is not registered.");
- return;
- }
-
- // Check for null value
- if (value == null)
- {
- sendAttributeTypeErrorNotification(object, "Attribute is null");
- return;
- }
-
- // Now pass the value to the respective monitor.
- callback.monitorCallback(object, attributeInfo, value);
- }
- // Notify an unexcepted error
- catch (Throwable e)
- {
- log.debug("Error in monitor ", e);
- sendRuntimeErrorNotification(object, "General error: " + e.toString());
- }
- }
-
- /**
- * Run the montior
- */
- public void doRun()
- {
- // Perform the monitoring
- runMonitor();
-
- // Reschedule
- setNextRun(System.currentTimeMillis() + monitor.getGranularityPeriod());
- }
-
- /**
- * Run the monitor on each observed object
- */
- void runMonitor()
- {
- // Loop through each mbean
- boolean isActive = monitor.isActive();
- for (Iterator<ObservedObject> i = observedObjects.values().iterator(); i.hasNext() && isActive;)
- runMonitor(i.next());
- }
-
- /**
- * Sends the notification
- *
- * @param object the observedObject.
- * @param type the notification type.
- * @param timestamp the time of the notification.
- * @param message the human readable message to send.
- * @param attribute the attribute name.
- * @param gauge the derived gauge.
- * @param trigger the trigger value.
- */
- void sendNotification(ObservedObject object, String type, long timestamp, String message,
- String attribute, Object gauge, Object trigger)
- {
- MonitorNotification n = callback.createNotification(type,
- monitorName, timestamp, message, gauge, attribute,
- object.getObjectName(), trigger);
- monitor.sendNotification(n);
- }
-
- /**
- * Send a runtime error notification.
- *
- * @param object the observedObject.
- * @param message the human readable message to send.
- */
- void sendRuntimeErrorNotification(ObservedObject object, String message)
- {
- if (object.notAlreadyNotified(ObservedObject.RUNTIME_ERROR_NOTIFIED))
- sendNotification(object, MonitorNotification.RUNTIME_ERROR, 0,
- message, monitor.getObservedAttribute(), null, null);
- }
-
- /**
- * Send an object error notification.
- *
- * @param object the observedObject.
- * @param message the human readable message to send.
- */
- void sendObjectErrorNotification(ObservedObject object, String message)
- {
- if (object.notAlreadyNotified(ObservedObject.OBSERVED_OBJECT_ERROR_NOTIFIED))
- sendNotification(object, MonitorNotification.OBSERVED_OBJECT_ERROR, 0,
- message, monitor.getObservedAttribute(), null, null);
- }
-
- /**
- * Send an attribute error notification.
- *
- * @param object the observedObject.
- * @param message the human readable message to send.
- */
- void sendAttributeErrorNotification(ObservedObject object, String message)
- {
- if (object.notAlreadyNotified(ObservedObject.OBSERVED_ATTRIBUTE_ERROR_NOTIFIED))
- sendNotification(object, MonitorNotification.OBSERVED_ATTRIBUTE_ERROR, 0,
- message, monitor.getObservedAttribute(), null, null);
- }
-
- /**
- * Send an attribute type error notification.
- *
- * @param object the observedObject.
- * @param message the human readable message to send.
- */
- void sendAttributeTypeErrorNotification(ObservedObject object, String message)
- {
- if (object.notAlreadyNotified(ObservedObject.OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED))
- sendNotification(object, MonitorNotification.OBSERVED_ATTRIBUTE_TYPE_ERROR, 0,
- message, monitor.getObservedAttribute(), null, null);
- }
-
-}
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/ObservedObject.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/ObservedObject.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/ObservedObject.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,203 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-import javax.management.ObjectName;
-
-/**
- * An observed object
- */
-public class ObservedObject
-{
- // Constants -----------------------------------------------------
- /**
- * Used to reset errors in {@link #resetAlreadyNotified()}.
- */
- public static final int RESET_FLAGS_ALREADY_NOTIFIED = 0;
-
- /**
- * An observed attribute type error has been notified.
- */
- public static final int RUNTIME_ERROR_NOTIFIED = 8;
-
- /**
- * An observed object error has been notified.
- */
- public static final int OBSERVED_OBJECT_ERROR_NOTIFIED = 1;
-
- /**
- * An observed attribute error has been notified.
- */
- public static final int OBSERVED_ATTRIBUTE_ERROR_NOTIFIED = 2;
-
- /**
- * An observed attribute type error has been notified.
- */
- public static final int OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED = 4;
-
- // Attributes ----------------------------------------------------
-
- /**
- * The object name.
- */
- private ObjectName objectName;
-
- /**
- * The notified attribute.
- */
- private int alreadyNotified = RESET_FLAGS_ALREADY_NOTIFIED;
-
- /**
- * The derived gauge.
- */
- private Object derivedGauge;
-
- /**
- * The last value.
- */
- private Object lastValue;
-
- /**
- * The derived gauge timestamp.
- */
- private long derivedGaugeTimeStamp;
-
- /**
- * The threshold.
- */
- private Object threshold;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- /**
- * Construct a new observed object.
- *
- * @param objectName the object name.
- */
- public ObservedObject(ObjectName objectName)
- {
- if (objectName == null)
- throw new IllegalArgumentException("Null object name");
- this.objectName = objectName;
- }
-
- // Public --------------------------------------------------------
-
- public ObjectName getObjectName()
- {
- return objectName;
- }
-
- public int getAlreadyNotified()
- {
- return alreadyNotified;
- }
-
- public boolean isAlreadyNotified(int mask)
- {
- return (alreadyNotified & mask) != 0;
- }
-
- public boolean notAlreadyNotified(int mask)
- {
- if ((alreadyNotified & mask) == 0)
- {
- alreadyNotified |= mask;
- return true;
- }
- return false;
- }
-
- public void setNotAlreadyNotified(int mask)
- {
- alreadyNotified &= ~mask;
- }
-
- public void setAlreadyNotified(int mask)
- {
- alreadyNotified |= mask;
- }
-
- public void resetAlreadyNotified()
- {
- alreadyNotified = RESET_FLAGS_ALREADY_NOTIFIED;
- }
-
- public Object getDerivedGauge()
- {
- return derivedGauge;
- }
-
- public void setDerivedGauge(Object gauge)
- {
- derivedGauge = gauge;
- }
-
- public Object getLastValue()
- {
- return lastValue;
- }
-
- public void setLastValue(Object last)
- {
- lastValue = last;
- }
-
- public long getDerivedGaugeTimeStamp()
- {
- return derivedGaugeTimeStamp;
- }
-
- public void setDerivedGaugeTimeStamp(long ts)
- {
- derivedGaugeTimeStamp = ts;
- }
-
- public Object getThreshold()
- {
- return threshold;
- }
-
- public void setThreshold(Object threshold)
- {
- this.threshold = threshold;
- }
-
- /**
- * @return human readable string.
- */
- public String toString()
- {
- StringBuffer buffer = new StringBuffer(100);
- buffer.append(getClass().getName()).append("@").append(System.identityHashCode(this)).append("{");
- buffer.append(" objectName=").append(getObjectName());
- buffer.append(" alreadyNotified=").append(getAlreadyNotified());
- buffer.append(" threshold=").append(getThreshold());
- buffer.append(" derivedGauge=").append(getDerivedGauge());
- buffer.append(" derivedGaugeTS=").append(getDerivedGaugeTimeStamp());
- buffer.append(" lastValue=").append(getLastValue());
- return buffer.append("}").toString();
- }
-
-}
Modified: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/PropertyAccess.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/PropertyAccess.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/PropertyAccess.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -32,7 +32,7 @@
* @author Scott.Stark at jboss.org
* @version $Revision$
*/
-public class PropertyAccess
+class PropertyAccess
{
static class PropertyReadAction implements PrivilegedAction<String>
{
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/QueryExpSupport.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/QueryExpSupport.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/QueryExpSupport.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-import javax.management.MBeanServer;
-
-/**
- * A helper for query expressions
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- * @version $Revision$
- */
-public class QueryExpSupport
-{
- /**
- * The MBeanServer (one per thread)
- */
- public static ThreadLocal<MBeanServer> server = new ThreadLocal<MBeanServer>();
-
- public void setMBeanServer(MBeanServer mbeanServer)
- {
- server.set(mbeanServer);
- }
-
-}
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/RunnableScheduler.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/RunnableScheduler.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/RunnableScheduler.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-import org.jboss.util.threadpool.ThreadPool;
-import org.jboss.util.timeout.Timeout;
-import org.jboss.util.timeout.TimeoutFactory;
-
-/**
- * A runnable scheduler.<p>
- *
- * The scheduler needs to be started to do real work. To add work to the
- * scheduler, create a SchedulableRunnable and set the scheduler. When
- * the next run has passed the work is performed.
- *
- * @see SchedulableRunnable
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- * @version $Revision$
- */
-public class RunnableScheduler
-{
-
- // Attributes ----------------------------------------------------
-
- /**
- * The runnables to schedule
- */
- private TimeoutFactory factory;
-
- /**
- * Constructs a new runnable scheduler.
- */
- public RunnableScheduler()
- {
- this.factory = new TimeoutFactory();
- }
-
- /**
- * Constructs a new runnable scheduler.
- *
- * @param threadPool the thread pool
- */
- public RunnableScheduler(ThreadPool threadPool)
- {
- this.factory = new TimeoutFactory(threadPool);
- }
-
- /**
- * Starts the scheduler.
- */
- public void start()
- {
- }
-
- /**
- * Stops the scheduler, cancels all submitted jobs.
- */
- public synchronized void stop()
- {
- factory.cancel();
- }
-
- /**
- * Runs the scheduler.
- */
- public void run()
- {
- }
-
- // Public --------------------------------------------------------
-
- // X Implementation ----------------------------------------------
-
- // Y Overrides ---------------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Package -------------------------------------------------------
-
- /**
- * Add a schedulable runnable
- *
- * @param runnable the runnable to add
- */
- Timeout add(SchedulableRunnable runnable)
- {
- return factory.schedule(runnable.getNextRun(), runnable);
- }
-
- // Private -------------------------------------------------------
-
- // Inner Classes -------------------------------------------------
-}
-
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/SchedulableRunnable.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/SchedulableRunnable.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/SchedulableRunnable.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,219 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.jboss.util.timeout.Timeout;
-
-/**
- * A schedulable runnable.<p>
- *
- * Subclasses should implement doRun() to do some real work.<p>
- *
- * setScheduler(RunnableScheduler) has to be invoked with a RunnableScheduler
- * that has been started for the work to be performed. If the doRun() does
- * not invoke setNextRun(), the link to the scheduler is removed.
- *
- * @see RunnableScheduler
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public abstract class SchedulableRunnable
- implements Runnable
-{
- // Attributes ----------------------------------------------------
-
- /**
- * The next run timestamp
- */
- private AtomicLong nextRun = new AtomicLong(0);
-
- /**
- * The current scheduler
- */
- private RunnableScheduler scheduler;
-
- /**
- * Whether we are running
- */
- private boolean running;
-
- /**
- * Whether we should reschedule after the run
- */
- private boolean reschedule;
-
- /**
- * Handle for canceling ourselves.
- */
- private Timeout timeout;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- /**
- * Constructs a new schedulable runnable.
- */
- public SchedulableRunnable()
- {
- }
-
- // Public --------------------------------------------------------
-
- /**
- * Gets the next run timestamp
- *
- * @return the next run
- */
- public long getNextRun()
- {
- return nextRun.get();
- }
-
- /**
- * Sets the next run date<p>
- *
- * If it is linked to a scheduler, it is temporarily removed while the date
- * is modified.
- *
- * @param nextRun the next run date
- */
- public synchronized void setNextRun(long nextRun)
- {
- // Remove from scheduler
- if (timeout != null)
- timeout.cancel();
-
- // Set the new run time
- this.nextRun.set(nextRun);
-
- // If we are not running, add it to the scheduler otherwise
- // remember we want adding back
- if (running == false && scheduler != null)
- {
- //log.debug("add to scheduler: " + this);
- timeout = scheduler.add(this);
- }
- else
- {
- //log.debug("reschedule: " + this);
- reschedule = true;
- }
- }
-
- /**
- * Set the scheduler for this runnable
- *
- * @param scheduler pass null to remove the runnable from any scheduler
- * @return the previous scheduler or null if there was no previous scheduler
- */
- public synchronized RunnableScheduler setScheduler(RunnableScheduler scheduler)
- {
- // Null operation
- if (this.scheduler == scheduler)
- return this.scheduler;
-
- // Remember the result
- RunnableScheduler result = this.scheduler;
-
- // Remove from previous scheduler
- if (this.timeout != null)
- timeout.cancel();
-
- // Set the new state
- this.scheduler = scheduler;
-
- // This is a remove operation
- if (scheduler == null)
- reschedule = false;
-
- // If we are not running, add it to the scheduler otherwise
- // remember we want adding
- else if (running == false)
- timeout = scheduler.add(this);
- else
- reschedule = true;
-
- // We are done
- return result;
- }
-
- /**
- * Do the work, the scheduled runnable should do its work here
- */
- public abstract void doRun();
-
- // Runnable Implementation ---------------------------------------
-
- /**
- * Runs doRun()<p>
- *
- * If setNextRun() is not invoked during the doRun(), the link to the
- * scheduler is removed
- */
- public final void run()
- {
- startRun();
- try
- {
- doRun();
- }
- finally
- {
- endRun();
- }
- }
-
- // Object Overrides ----------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Package -------------------------------------------------------
-
- // Private -------------------------------------------------------
-
- /**
- * Start the run
- */
- private synchronized void startRun()
- {
- running = true;
- }
-
- /**
- * Check whether the work got rescheduled
- */
- private synchronized void endRun()
- {
- running = false;
- if (reschedule == true)
- timeout = scheduler.add(this);
- reschedule = false;
- }
-
- // Inner Classes -------------------------------------------------
-}
-
Deleted: projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/Serialization.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/Serialization.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/util/Serialization.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.mx.util;
-
-/**
- * Serialization Helper.<p>
- *
- * Contains static constants and attributes to help is serialization
- * versioning.
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- * @version $Revision$
- */
-public class Serialization
-{
- // Static --------------------------------------------------------
-
- /**
- * The latest version of serialization
- */
- public static final int LATEST = 0;
-
- /**
- * The serialization for the 1.0 specified in the spec 1.1
- */
- public static final int V1R0 = 10;
-
- /**
- * The serialization version to use
- */
- public static int version = LATEST;
-
- /**
- * Determine the serialization version
- */
- static
- {
- try
- {
- String property = PropertyAccess.getProperty("jmx.serial.form");
- if (property != null && property.equals("1.0"))
- version = V1R0;
- }
- catch (java.security.AccessControlException ace)
- {
- // required for applets
- }
- }
-}
-
Modified: projects/jbossmx/trunk/jmx/.classpath
===================================================================
--- projects/jbossmx/trunk/jmx/.classpath 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/.classpath 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,7 +1,7 @@
<classpath>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="src" path="src/test"/>
- <classpathentry kind="src" path="src/resources/test" output="target/test-classes" excluding="**/*.java"/>
+ <classpathentry kind="src" path="src/resources/test"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
@@ -16,6 +16,7 @@
<classpathentry kind="src" path="/jboss-mbeans"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.GA/jboss-reflect-2.0.0.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.GA/jboss-reflect-2.0.0.GA-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.GA/jbossxb-2.0.0.GA.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.GA/jbossxb-2.0.0.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
<classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
Deleted: projects/jbossmx/trunk/jmx/build.bat
===================================================================
--- projects/jbossmx/trunk/jmx/build.bat 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/build.bat 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,98 +0,0 @@
- at echo off
-
-REM ======================================================================
-REM
-REM This is the main entry point for the build system.
-REM
-REM ======================================================================
-REM
-REM $Id$
-REM
-REM Authors:
-REM Jason Dillon <jason at planet57.com>
-REM Sacha Labourey <sacha.labourey at cogito-info.ch>
-REM
-
-REM ******************************************************
-REM Ignore the ANT_HOME variable: we want to use *our*
-REM ANT version and associated JARs.
-REM ******************************************************
-REM Ignore the users classpath, cause it might mess
-REM things up
-REM ******************************************************
-
-SETLOCAL
-
-set CLASSPATH=
-set ANT_HOME=
-set ANT_OPTS=
-
-REM ******************************************************
-REM - "for" loops have been unrolled for compatibility
-REM with some WIN32 systems.
-REM ******************************************************
-
-set NAMES=tools;
-set SUBFOLDERS=..;..\..;..\..\..;..\..\..\..
-
-REM ******************************************************
-REM ******************************************************
-
-SET EXECUTED=FALSE
-for %%i in (%NAMES%) do call :subLoop %%i %*
-
-goto :EOF
-
-
-REM ******************************************************
-REM ********* Search for names in the subfolders *********
-REM ******************************************************
-
-:subLoop
-SET SUBDIR=%1
-SHIFT
-
-set OTHER_ARGS=
-:setupArgs
-if %1a==a goto doneSetupArgs
-set OTHER_ARGS=%OTHER_ARGS% %1
-shift
-goto setupArgs
-:doneSetupArgs
-
-for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%SUBDIR%\bin\ant.bat -logger org.apache.tools.ant.NoBannerLogger %OTHER_ARGS%
-
-goto :EOF
-
-
-REM ******************************************************
-REM ************ Test if ANT Batch file exists ***********
-REM ******************************************************
-
-:testIfExists
-if exist %1 call :BatchFound %*
-
-goto :EOF
-
-
-REM ******************************************************
-REM ************** Batch file has been found *************
-REM ******************************************************
-
-:BatchFound
-if (%EXECUTED%)==(FALSE) call :ExecuteBatch %*
-set EXECUTED=TRUE
-
-goto :EOF
-
-REM ******************************************************
-REM ************* Execute Batch file only once ***********
-REM ******************************************************
-
-:ExecuteBatch
-echo Calling %*
-call %*
-
-:end
-
-pause
Deleted: projects/jbossmx/trunk/jmx/build.sh
===================================================================
--- projects/jbossmx/trunk/jmx/build.sh 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/build.sh 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,172 +0,0 @@
-#!/bin/sh
-### ====================================================================== ###
-## ##
-## This is the main entry point for the build system. ##
-## ##
-## Users should be sure to execute this file rather than 'ant' to ensure ##
-## the correct version is being used with the correct configuration. ##
-## ##
-### ====================================================================== ###
-
-# $Id$
-
-PROGNAME=`basename $0`
-DIRNAME=`dirname $0`
-GREP="grep"
-ROOT="/"
-
-# Ignore user's ANT_HOME if it is set
-ANT_HOME=""
-
-# the default search path for ant
-ANT_SEARCH_PATH="\
- tools
- tools/ant \
- tools/apache/ant \
- ant"
-
-# the default build file name
-ANT_BUILD_FILE="build.xml"
-
-# the default arguments
-ANT_OPTIONS="--noconfig -find $ANT_BUILD_FILE"
-
-# Use the maximum available, or set MAX_FD != -1 to use that
-MAX_FD="maximum"
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false;
-darwin=false;
-case "`uname`" in
- CYGWIN*)
- cygwin=true
- ;;
-
- Darwin*)
- darwin=true
- ;;
-esac
-
-#
-# Helper to complain.
-#
-die() {
- echo "${PROGNAME}: $*"
- exit 1
-}
-
-#
-# Helper to complain.
-#
-warn() {
- echo "${PROGNAME}: $*"
-}
-
-#
-# Helper to source a file if it exists.
-#
-maybe_source() {
- for file in $*; do
- if [ -f "$file" ]; then
- . $file
- fi
- done
-}
-
-search() {
- search="$*"
- for d in $search; do
- ANT_HOME="`pwd`/$d"
- ANT="$ANT_HOME/bin/ant"
- if [ -x "$ANT" ]; then
- # found one
- echo $ANT_HOME
- break
- fi
- done
-}
-
-#
-# Main function.
-#
-main() {
- # if there is a build config file. then source it
- maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"
-
- # Increase the maximum file descriptors if we can
- if [ $cygwin = "false" ]; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ]; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
- # use the system max
- MAX_FD="$MAX_FD_LIMIT"
- fi
-
- ulimit -n $MAX_FD
- if [ $? -ne 0 ]; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
- fi
-
- # try the search path
- ANT_HOME=`search $ANT_SEARCH_PATH`
-
- # try looking up to root
- if [ "x$ANT_HOME" = "x" ]; then
- target="build"
- _cwd=`pwd`
-
- while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
- cd ..
- cwd=`pwd`
- ANT_HOME=`search $ANT_SEARCH_PATH`
- done
-
- # make sure we get back
- cd $_cwd
-
- if [ "$cwd" != "$ROOT" ]; then
- found="true"
- fi
-
- # complain if we did not find anything
- if [ "$found" != "true" ]; then
- die "Could not locate Ant; check \$ANT or \$ANT_HOME."
- fi
- fi
-
- # make sure we have one
- ANT=$ANT_HOME/bin/ant
- if [ ! -x "$ANT" ]; then
- die "Ant file is not executable: $ANT"
- fi
-
- # need to specify planet57/buildmagic protocol handler package
- ANT_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"
-
- # setup some build properties
- ANT_OPTS="$ANT_OPTS -Dbuild.script=$0"
-
- # change to the directory where the script lives so users are not forced
- # to be in the same directory as build.xml
- cd $DIRNAME
-
- # export some stuff for ant
- export ANT ANT_HOME ANT_OPTS
-
- # execute in debug mode, or simply execute
- if [ "x$ANT_DEBUG" != "x" ]; then
- /bin/sh -x $ANT $ANT_OPTIONS "$@"
- else
- exec $ANT $ANT_OPTIONS "$@"
- fi
-}
-
-##
-## Bootstrap
-##
-
-main "$@"
Deleted: projects/jbossmx/trunk/jmx/build.xml
===================================================================
--- projects/jbossmx/trunk/jmx/build.xml 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/build.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,692 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE project [
- <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
- <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
- <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
-]>
-
-<!-- $Id$ -->
-
-<!--+======================================================================+-->
-<!--| JBoss (The OpenSource J2EE WebOS) Build File |-->
-<!--| |-->
-<!--| Distributable under LGPL license. |-->
-<!--| See terms of license at http://www.gnu.org. |-->
-<!--| |-->
-<!--| This file has been designed to work with the 'tools' module and |-->
-<!--| Buildmagic extentions. |-->
-<!--+======================================================================+-->
-
-<project default="main" name="JBoss/JMX">
-
- <!--+====================================================================+-->
- <!--| Setup |-->
- <!--| |-->
- <!--| Include the common build elements. |-->
- <!--| |-->
- <!--| This defines several different targets, properties and paths. |-->
- <!--| It also sets up the basic extention tasks amoung other things. |-->
- <!--+====================================================================+-->
-
- &buildmagic;
-
- <!--+====================================================================+-->
- <!--| Initialization |-->
- <!--| |-->
- <!--| Initialize the build system. Other targets should depend on |-->
- <!--| 'init'. |-->
- <!--+====================================================================+-->
-
- <target name="init" unless="init.disable" depends="_buildmagic:init">
- </target>
-
- <!-- Added since in target.ent, but can not include since duplicate _default:init
- in buildmagic.ent -->
- <target name="_default:most"
- description="Builds almost everything."
- depends="output"/>
-
- <target name="_default:help"
- description="Show this help message."
- depends="_buildmagic:help:standard"/>
-
- <target name="_default:all"
- description="Builds everything."
- depends="most,docs"/>
-
-
- <!--+====================================================================+-->
- <!--| Configuration |-->
- <!--| |-->
- <!--| This target is invoked by the Buildmagic initialization logic |-->
- <!--| and should contain module specific configuration elements. |-->
- <!--+====================================================================+-->
-
- <target name="configure" unless="configure.disable">
-
- &libraries;
- &modules;
-
- <property name="source.classes" value="${module.source}/main"/>
- <property name="source.java" value="${source.classes}"/>
-
- <!-- Configure modules -->
- <path id="dependentmodule.classpath">
- <!-- Add dependent module classpath elements here. -->
- <path refid="jboss.common.core.classpath"/>
- <path refid="jboss.common.logging.spi.classpath"/>
- <path refid="jboss.common.logging.log4j.classpath"/>
- <path refid="jboss.common.logging.jdk.classpath"/>
- <path refid="jboss.j2se.classpath"/>
- <path refid="jboss.mbeans.classpath"/>
- <path refid="jboss.jmxcompliance.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
- </path>
-
- <!-- Configure thirdparty libraries -->
- <path id="library.classpath">
- <path refid="apache.log4j.classpath"/>
- <path refid="oswego.concurrent.classpath"/>
- <path refid="dom4j.dom4j.classpath"/>
- <path refid="junit.junit.classpath"/>
- <path refid="apache.bcel.classpath"/>
- <path refid="apache.commons.classpath"/>
- <path refid="jboss.integration.classpath"/>
- </path>
-
- <!-- The combined thirdparty classpath -->
- <path id="thirdparty.classpath">
- <path refid="library.classpath"/>
- <path refid="dependentmodule.classpath"/>
- </path>
-
- <!-- The classpath required to build classes. -->
- <path id="javac.classpath">
- <pathelement path="${classpath}"/>
- <pathelement path="${local.classpath}"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <!-- Where source files live -->
- <property name="source.classes" value="${module.source}/main"/>
- <property name="source.docs" value="${module.source}/docs"/>
- <property name="source.etc" value="${module.source}/etc"/>
- <property name="source.examples" value="${module.source}/examples"/>
- <property name="source.bin" value="${module.source}/bin"/>
- <property name="source.resources" value="${module.source}/resources"/>
- <property name="source.stylesheets" value="${module.source}/stylesheets"/>
- <property name="source.web" value="${module.source}/web"/>
- <property name="source.test" value="${module.source}/test"/>
- <property name="source.java" value="${module.source}/main"/>
-
- <!-- Where build generated files will go -->
- <property name="build.api" value="${module.output}/api"/>
- <property name="build.bin" value="${module.output}/bin"/>
- <property name="build.classes" value="${module.output}/classes"/>
- <property name="build.docs" value="${module.output}/docs"/>
- <property name="build.stylesheets" value="${module.output}/stylesheets"/>
- <property name="build.etc" value="${module.output}/etc"/>
- <property name="build.examples" value="${module.output}/examples"/>
- <property name="build.gen" value="${module.output}/gen"/>
- <property name="build.gen.classes" value="${build.gen}/classes"/>
- <property name="build.jmx-api" value="${module.output}/jmx-api"/>
- <property name="build.jmx-doc" value="${module.output}/jmx-doc"/>
- <property name="build.lib" value="${module.output}/lib"/>
- <property name="build.deploy" value="${module.output}/deploy"/>
- <property name="build.reports" value="${module.output}/reports"/>
- <property name="build.resources" value="${module.output}/resources"/>
- <property name="build.todo" value="${module.output}/todo"/>
- <property name="build.web" value="${module.output}/web"/>
- <property name="build.log" value="${module.output}/log"/>
- <property name="build.cache" value="${module.output}/cache"/>
- <property name="build.test" value="${module.output}/test"/>
- <property name="build.gen.test" value="${build.gen}/test"/>
-
- <!-- Module name & version -->
- <property name="module.name" value="jbossmx"/>
- <property name="module.Name" value="JBoss/JMX"/>
-
- <property name="javac.target" value="1.5"/>
- <property name="javac.source" value="1.5"/>
- <!-- Where build generated files will go -->
- <property name="build.reports" value="${module.output}/reports"/>
- <property name="build.classes" value="${module.output}/classes"/>
- <property name="build.lib" value="${module.output}/lib"/>
- <property name="build.api" value="${module.output}/api"/>
- <property name="build.etc" value="${module.output}/etc"/>
- <property name="build.gen-src" value="${module.output}/gen-src"/>
- <property name="build.gen" value="${module.output}/gen"/>
-
-
- <!--+=======================================+-->
- <!--| Override any default properties here. |-->
- <!--+=======================================+-->
-
- <property name="javadoc.packages" value="javax.management.*, org.jboss.*"/>
-
- <!--+=======================================+-->
- <!--| Define module specific elements here. |-->
- <!--+=======================================+-->
-
- <property name="com.sun.jmx.trace.file"
- location="${module.output}/ri-testsuite.log"/>
- <property name="com.sun.jmx.trace.level" value="1"/>
-
- <!-- Properties used in serialization tests -->
- <property name="jboss.test.location.jmxri"
- location="${project.thirdparty}/sun-jmx/lib/jmxri.jar"/>
- <property name="jboss.test.location.jbossmx"
- location="${build.lib}/jboss-jmx.jar"/>
-
- <path id="serialization.classpath">
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- </target>
-
-
- <!--+====================================================================+-->
- <!--| Compile |-->
- <!--| |-->
- <!--| This target should depend on other compile-* targets for each |-->
- <!--| different type of compile that needs to be performed, short of |-->
- <!--| documentation compiles. |-->
- <!--+====================================================================+-->
-
- <target name="compile"
- description="Compile all source files."
- depends="init, _default:compile-classes, _default:compile-etc, compile-resources">
- <!-- Add module specific elements here. -->
- </target>
-
- <!-- Compile resource files (dtds) -->
- <target name="compile-resources" depends="init">
- <mkdir dir="${build.resources}"/>
- <copy todir="${build.resources}">
- <fileset dir="${source.resources}">
- <include name="dtd/*.dtd"/>
- <include name="*.xml"/>
- </fileset>
- </copy>
- </target>
-
-
- <!-- ================================================================== -->
- <!-- Tests -->
- <!-- ================================================================== -->
-
- <target name="tests" depends="test-all"/>
-
- <!--+====================================================================+-->
- <!--| Generate Output |-->
- <!--| |-->
- <!--| Generates the target output for this module. Target output is |-->
- <!--| the output which is ment to be released or used by external |-->
- <!--| modules. |-->
- <!--+====================================================================+-->
-
- <target name="output"
- description="Generate all target output."
- depends="_buildmagic:build-bypass-check"
- unless="build-bypass.on">
-
- <call target="compile"/>
-
- <mkdir dir="${build.lib}"/>
-
- <!-- Build the jboss-jmx.jar -->
- <jar jarfile="${build.lib}/jboss-jmx.jar" manifest="${build.etc}/default.mf">
- <fileset dir="${build.classes}">
- <include name="**"/>
- <exclude name="test/**"/>
- </fileset>
- <!-- include dtds for xmbeans -->
- <fileset dir="${build.resources}">
- <include name="dtd/*.dtd"/>
- <!-- include descriptor for MBean Info DB service -->
- <include name="*-xmbeandd.xml"/>
- </fileset>
- </jar>
-
- <!-- Build the jboss-jmx-testsuite.jar -->
- <jar jarfile="${build.lib}/jboss-jmx-testsuite.jar">
- <fileset dir="${build.classes}">
- <include name="test/**"/>
- <exclude name="test/implementation/loading/support/*.class"/>
- </fileset>
- <fileset dir="${source.resources}/test/log4j">
- <include name="log4j.properties"/>
- </fileset>
- </jar>
-
- <mkdir dir="${build.etc}/test/implementation/loading"/>
-
- <jar jarfile="${build.etc}/test/implementation/loading/MyMBeans.jar">
- <fileset dir="${build.classes}">
- <include name="test/implementation/loading/support/Trivial*.class"/>
- </fileset>
- </jar>
-
- <copy todir="${build.etc}">
- <fileset dir="${source.resources}">
- <include name="test/compliance/loading/*.mlet"/>
- <include name="test/implementation/loading/*.mlet"/>
- </fileset>
- </copy>
-
- <mkdir dir="${build.etc}/test/implementation/loading"/>
-
- <jar jarfile="${build.etc}/test/implementation/loading/Start.jar">
- <fileset dir="${build.classes}">
- <include name="test/implementation/loading/support/Start*.class"/>
- <include name="test/implementation/loading/support/AClass.class"/>
- </fileset>
- </jar>
-
- <jar jarfile="${build.etc}/test/implementation/loading/Target.jar">
- <fileset dir="${build.classes}">
- <include name="test/implementation/loading/support/Target*.class"/>
- <include name="test/implementation/loading/support/AClass.class"/>
- </fileset>
- </jar>
-
- <!-- added for MBean info persistence -->
- <!-- @todo: someone familiar with the build system might want to find a better way to do this. -->
- <!-- copy service to the lib folder -->
- <copy todir="${build.lib}">
- <fileset dir="${build.resources}">
- <include name="*-service.xml"/>
- </fileset>
- </copy>
-
- <!-- Update the build marker to allow bypassing -->
- <touch file="${build-bypass.marker}"/>
-
- </target>
-
-
- <!--+====================================================================+-->
- <!--| Documents |-->
- <!--| |-->
- <!--| Generate all documentation for this module. |-->
- <!--+====================================================================+-->
-
-<!-- <target name="docs" depends="_default:docs">
- </target> -->
-
-
- <!--+====================================================================+-->
- <!--| Misc. |-->
- <!--| |-->
- <!--| Standard targets and psuedo-targets. |-->
- <!--+====================================================================+-->
-
- <target name="clean" depends="_default:clean">
- <!-- Add module specific elements here. -->
- </target>
-
- <target name="clobber" depends="_default:clobber">
- <!-- Add module specific elements here. -->
- </target>
-
- <!-- main, all, most and help are primary psuedo-targets -->
- <target name="main" depends="most"/>
- <target name="all" depends="_default:all"/>
- <target name="most" depends="_default:most"/>
- <target name="help" depends="_default:help"/>
-
-
- <!--+====================================================================+-->
- <!--| Custom |-->
- <!--| |-->
- <!--| Custom module targets. |-->
- <!--+====================================================================+-->
-
- <!-- ================================================================== -->
- <!-- Run ALL the test suites -->
- <!-- ================================================================== -->
-
- <target name="test-all"
- depends="test-compliance,test-implementation,test-performance,test-serialization,test-stress"
- description="Run ALL test suites"/>
-
- <!-- ================================================================== -->
- <!-- FULL Compliance - Run the complicance suite including long test -->
- <!-- ================================================================== -->
-
- <!--
- | There are three targets, one for the RI, one for JBossMX and one for both.
- | WARNING, everthing is compiled over JBossMX
- -->
-
-
- <!-- IBM Tivoli FULL Implementation compliance -->
- <!--
- <target name="test-compliance-full-Tivoli" depends="jars"
- description="Run FULL compliance test against IBM Tivoli">
-
- <path id="compliance.Tivoli.classpath">
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/jmxx.jar"/>
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/jmxc.jar"/>
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/log.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.compliance.FullComplianceSUITE" fork="true">
- <classpath refid="compliance.Tivoli.classpath"/>
- </java>
- </target>
- -->
-
- <!-- Reference FULL Implementation compliance -->
- <target name="test-compliance-full-RI" depends="output"
- description="Run FULL compliance test against RI">
-
- <path id="compliance.RI.classpath">
- <pathelement path="${project.thirdparty}/sun-jmx/lib/jmxri.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.compliance.FullComplianceSUITE" fork="true">
- <classpath refid="compliance.RI.classpath"/>
- </java>
-
- </target>
-
- <!-- JBossMX FULL Implementation compliance -->
- <target name="test-compliance-full-JBossMX" depends="output"
- description="Run FULL compliance test against JBossMX">
-
- <path id="compliance.JBossMX.classpath">
- <pathelement path="${build.lib}/jboss-jmx.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.compliance.FullComplianceSUITE" fork="true">
- <classpath refid="compliance.JBossMX.classpath"/>
- </java>
-
- </target>
-
- <!-- Run both FULL compliance tests -->
- <target name="test-compliance-full" depends="test-compliance-full-RI, test-compliance-full-JBossMX"
- description="Run FULL compliance test against RI and JBossMX">
- </target>
-
-
- <!-- ================================================================== -->
- <!-- Compliance - Run the complicance suite -->
- <!-- ================================================================== -->
-
- <!--
- | There are three targets, one for the RI, one for JBossMX and one for both.
- | WARNING, everthing is compiled over JBossMX
- -->
-
-
- <!-- IBM Tivoli Implementation compliance -->
- <!--
- <target name="test-compliance-Tivoli" depends="output"
- description="Run compliance test against IBM Tivoli">
-
- <path id="compliance.Tivoli.classpath">
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/jmxx.jar"/>
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/jmxc.jar"/>
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/log.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.compliance.ComplianceSUITE" fork="true">
- <classpath refid="compliance.Tivoli.classpath"/>
- </java>
- </target>
- -->
-
- <!-- Reference Implementation compliance -->
- <target name="test-compliance-RI" depends="output"
- description="Run compliance test against RI">
-
- <path id="compliance.RI.classpath">
- <pathelement path="${project.thirdparty}/sun-jmx/lib/jmxri.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.compliance.ComplianceSUITE" fork="true">
- <classpath refid="compliance.RI.classpath"/>
- <sysproperty key="com.sun.jmx.trace.file"
- value="${com.sun.jmx.trace.file}"/>
- <sysproperty key="com.sun.jmx.trace.level"
- value="${com.sun.jmx.trace.level}"/>
- </java>
-
- </target>
-
- <!-- JBossMX Implementation compliance -->
- <target name="test-compliance-JBossMX" depends="output"
- description="Run compliance test against JBossMX">
-
- <path id="compliance.JBossMX.classpath">
- <pathelement path="${build.lib}/jboss-jmx.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.compliance.ComplianceSUITE" fork="true">
- <classpath refid="compliance.JBossMX.classpath"/>
- </java>
-
- <!--
- <java classname="test.compliance.ComplianceSUITE" fork="true">
- <classpath refid="compliance.JBossMX.classpath"/>
- <sysproperty key="jbossmx.optimized.dispatcher" value="true"/>
- </java>
- -->
-
- </target>
-
- <!-- JBossMX Implementation compliance -->
- <target name="test-compliance-JBossMX-RI" depends="output"
- description="Run compliance test against JBossMX on top of the RI">
-
- <path id="compliance.JBossMX.RI.classpath">
- <pathelement path="${project.thirdparty}/sun-jmx/lib/jmxri.jar"/>
- <pathelement path="${build.lib}/jboss-jmx.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.compliance.ComplianceSUITE" fork="true">
- <classpath refid="compliance.JBossMX.RI.classpath"/>
- <sysproperty key="javax.management.builder.initial"
- value="org.jboss.mx.server.MBeanServerBuilderImpl"/>
- <sysproperty key="com.sun.jmx.trace.file"
- value="${com.sun.jmx.trace.file}"/>
- <sysproperty key="com.sun.jmx.trace.level"
- value="${com.sun.jmx.trace.level}"/>
- </java>
-
- </target>
-
- <!-- Run both compliance tests -->
- <target name="test-compliance" depends="test-compliance-RI, test-compliance-JBossMX"
- description="Run compliance test against RI and JBossMX">
- </target>
-
- <!-- ================================================================== -->
- <!-- Performance - Runs the performance test suite -->
- <!-- ================================================================== -->
-
- <!--
- | There are three targets, one for the RI, one for JBossMX and one for both.
- | WARNING, everthing is compiled over JBossMX
- -->
-
- <!-- IBM Tivoli Implementation performance -->
- <!--
- <target name="test-performance-Tivoli" depends="output"
- description="Run performance test against IBM Tivoli">
-
- <path id="performance.Tivoli.classpath">
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/jmxx.jar"/>
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/jmxc.jar"/>
- <pathelement path="${project.thirdparty}/ibm/tivoli/jmx/lib/log.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.performance.PerformanceSUITE" fork="true">
- <classpath refid="performance.Tivoli.classpath"/>
- </java>
- </target>
- -->
-
- <!-- Reference Implementation performance -->
- <target name="test-performance-RI" depends="output"
- description="Run performance test against RI">
-
- <path id="performance.RI.classpath">
- <pathelement path="${project.thirdparty}/sun-jmx/lib/jmxri.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.performance.PerformanceSUITE" fork="true">
- <classpath refid="performance.RI.classpath"/>
- </java>
- </target>
-
- <!-- JBossMX Implementation performance -->
- <target name="test-performance-JBossMX" depends="output"
- description="Run performance test against JBossMX">
-
- <path id="performance.JBossMX.classpath">
- <pathelement path="${build.lib}/jboss-jmx.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.performance.PerformanceSUITE" fork="true">
- <classpath refid="performance.JBossMX.classpath"/>
- </java>
- </target>
-
- <!-- Run both performance tests -->
- <target name="test-performance" depends="test-performance-RI, test-performance-JBossMX"
- description="Run performance test against RI and JBossMX">
- </target>
-
- <!-- ================================================================== -->
- <!-- Implementation - tests the JBossMX implementation classes. -->
- <!-- ================================================================== -->
- <target name="test-implementation" depends="output"
- description="Tests JBossMX implementation classes">
-
- <path id="implementation.JBossMX.classpath">
- <pathelement path="${build.lib}/jboss-jmx.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.implementation.ImplementationSUITE" fork="true">
- <classpath refid="implementation.JBossMX.classpath"/>
- <sysproperty key="force.jvm.exit" value="true"/>
- </java>
-
- <!--
- <java classname="test.implementation.ImplementationSUITE" fork="true">
- <classpath refid="implementation.JBossMX.classpath"/>
- <sysproperty key="jbossmx.optimized.dispatcher" value="true"/>
- <sysproperty key="force.jvm.exit" value="true"/>
- </java>
- -->
-
- </target>
-
- <!-- ================================================================== -->
- <!-- Serialization - tests the JBossMX serialization compatibility -->
- <!-- with the RI -->
- <!-- ================================================================== -->
- <target name="test-serialization-1.0" depends="output"
- description="Tests JBossMX serialization with jmx 1.0">
-
- <java classname="test.serialization.SerializationSUITE" fork="true">
- <classpath refid="serialization.classpath"/>
- <sysproperty key="jboss.test.location.jmxri"
- value="${jboss.test.location.jmxri}"/>
- <sysproperty key="jboss.test.location.jbossmx"
- value="${jboss.test.location.jbossmx}"/>
- <sysproperty key="jmx.serial.form" value="1.0"/>
- </java>
- </target>
-
- <target name="test-serialization-latest" depends="output"
- description="Tests JBossMX serialization with latest RI">
-
- <java classname="test.serialization.SerializationSUITE" fork="true">
- <classpath refid="serialization.classpath"/>
- <sysproperty key="jboss.test.location.jmxri"
- value="${jboss.test.location.jmxri}"/>
- <sysproperty key="jboss.test.location.jbossmx"
- value="${jboss.test.location.jbossmx}"/>
- <sysproperty key="jboss.test.location.jbossmx"
- value="${jboss.test.location.jbossmx}"/>
- </java>
- </target>
-
- <target name="test-serialization"
- depends="test-serialization-1.0, test-serialization-latest"
- description="Tests all JBossMX serialization with latest RI">
- </target>
-
- <!-- ================================================================== -->
- <!-- Stress - tests under stress conditions -->
- <!-- ================================================================== -->
-
- <!--
- | There are three targets, one for the RI, one for JBossMX and one for both.
- | WARNING, everthing is compiled over JBossMX
- -->
-
- <!-- Reference Implementation stress -->
- <target name="test-stress-RI" depends="output"
- description="Run stress test against RI">
-
- <path id="stress.RI.classpath">
- <pathelement path="${project.thirdparty}/sun-jmx/lib/jmxri.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.stress.StressSUITE" fork="true">
- <classpath refid="stress.RI.classpath"/>
- </java>
- </target>
-
- <!-- JBossMX stress -->
- <target name="test-stress-JBossMX" depends="output"
- description="Tests JBossMX under stress">
-
- <path id="stress.JBossMX.classpath">
- <pathelement path="${build.lib}/jboss-jmx.jar"/>
- <pathelement path="${build.lib}/jboss-jmx-testsuite.jar"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <java classname="test.stress.StressSUITE" fork="true">
- <classpath refid="stress.JBossMX.classpath"/>
- </java>
- </target>
-
- <!-- Run both stress tests -->
- <target name="test-stress" depends="test-stress-RI, test-stress-JBossMX"
- description="Run stress test against RI and JBossMX">
- </target>
-
-
-</project>
Modified: projects/jbossmx/trunk/jmx/pom.xml
===================================================================
--- projects/jbossmx/trunk/jmx/pom.xml 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/pom.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -12,93 +12,13 @@
<url>http://www.jboss.org/jbossmx</url>
<description>JBosMX (jmx module)</description>
<build>
- <!-- TODO: There should be a way to run tests in build.xml -->
<sourceDirectory>src/main</sourceDirectory>
+ <testSourceDirectory>src/test</testSourceDirectory>
<testResources>
- <testResource>
- <directory>src/resources/test</directory>
- </testResource>
+ <testResource>
+ <directory>src/resources/test</directory>
+ </testResource>
</testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>test/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>assembly</id>
- <goals>
- <goal>attached</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- <configuration>
- <descriptorSourceDirectory>src/assembly</descriptorSourceDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>create-output</id>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <tasks>
-
- <mkdir dir="output/etc" />
- <copy todir="output/etc" filtering="yes">
- <fileset dir="src/resources">
- <include name="test/**" />
- </fileset>
- </copy>
-
- <mkdir dir="output/lib" />
- <copy file="target/${artifactId}.jar" tofile="output/lib/jboss-jmx.jar" />
- <copy file="target/${artifactId}-jboss-jmx-testsuite.jar" tofile="output/lib/jboss-jmx-testsuite.jar" />
-
- <mkdir dir="output/etc/test/implementation/loading" />
- <copy file="target/${artifactId}-MyMBeans.jar" tofile="output/etc/test/implementation/loading/MyMBeans.jar" />
- <copy file="target/${artifactId}-Start.jar" tofile="output/etc/test/implementation/loading/Start.jar" />
- <copy file="target/${artifactId}-Target.jar" tofile="output/etc/test/implementation/loading/Target.jar" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <executions>
- <execution>
- <id>clean-output</id>
- <goals>
- <goal>clean</goal>
- </goals>
- <phase>clean</phase>
- <configuration>
- <filesets>
- <fileset>
- <directory>output</directory>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
</build>
<dependencies>
<!-- Compile (global dependencies) -->
@@ -120,18 +40,15 @@
</dependency>
<dependency>
<groupId>org.jboss.mx</groupId>
- <artifactId>jboss-j2se</artifactId>
- <type>test-jar</type>
- <scope>compile</scope>
+ <artifactId>jboss-mbeans</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.mx</groupId>
- <artifactId>jboss-mbeans</artifactId>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <scope>compile</scope>
</dependency>
</dependencies>
</project>
Copied: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/ClassToStringAction.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/loading/ClassToStringAction.java)
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/ClassToStringAction.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/ClassToStringAction.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.loading;
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+import java.security.CodeSource;
+
+/** An encapsulation creating a to string rep for a class using a
+ * PrivilegedAction for getting the ProtectionDomain.
+ *
+ * @version $Revision$
+ * @author Scott.Stark at jboss.org
+ */
+class ClassToStringAction implements PrivilegedAction<Object>
+{
+ private StringBuffer buffer;
+ private Class<?> clazz;
+ ClassToStringAction(Class<?> clazz, StringBuffer buffer)
+ {
+ this.clazz = clazz;
+ this.buffer = buffer;
+ }
+ public Object run()
+ {
+ if( clazz != null )
+ {
+ buffer.append(clazz.getName());
+ buffer.append("@"+Integer.toHexString(clazz.hashCode()));
+ CodeSource cs = clazz.getProtectionDomain().getCodeSource();
+ buffer.append("<CodeSource: "+cs+">");
+ }
+ else
+ {
+ buffer.append("null");
+ }
+ return null;
+ }
+
+ static void toString(Class<?> clazz, StringBuffer buffer)
+ {
+ ClassToStringAction action = new ClassToStringAction(clazz, buffer);
+ AccessController.doPrivileged(action);
+ }
+
+ static class SysPropertyAction implements PrivilegedAction<String>
+ {
+ private String key;
+ private String def;
+ SysPropertyAction(String key, String def)
+ {
+ this.key = key;
+ this.def = def;
+ }
+ public String run()
+ {
+ return System.getProperty(key, def);
+ }
+ }
+ static String getProperty(String key, String def)
+ {
+ SysPropertyAction action = new SysPropertyAction(key, def);
+ String value = AccessController.doPrivileged(action);
+ return value;
+ }
+}
Copied: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/LoaderRepository.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/loading/LoaderRepository.java)
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/LoaderRepository.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/LoaderRepository.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,295 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.loading;
+
+import org.jboss.logging.Logger;
+import org.jboss.mx.server.ServerConstants;
+import org.jboss.util.loading.Translator;
+
+import javax.management.loading.ClassLoaderRepository;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Abstract base class of all loader repository implementations
+ *
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
+ * @version $Revision$
+ */
+public abstract class LoaderRepository
+ implements ServerConstants, ClassLoaderRepository
+{
+
+ // Attributes ----------------------------------------------------
+ protected static Vector<ClassLoader> loaders = new Vector<ClassLoader>();
+ protected static LoaderRepository instance = null;
+ protected Translator translator = null;
+
+ /** The loaded classes cache, HashMap<String, Class>.
+ * Access synchronized via this.classes monitor.
+ */
+ private ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<String, Class<?>>();
+
+
+ /**
+ * Native signature to class map
+ */
+ private static HashMap<String, Class<?>> nativeClassBySignature;
+
+ // Static --------------------------------------------------------
+ private static final Logger log = Logger.getLogger(LoaderRepository.class);
+
+ /**
+ * Construct the native class map
+ */
+ static
+ {
+ nativeClassBySignature = new HashMap<String, Class<?>>();
+ nativeClassBySignature.put("boolean", boolean.class);
+ nativeClassBySignature.put("byte", byte.class);
+ nativeClassBySignature.put("char", char.class);
+ nativeClassBySignature.put("double", double.class);
+ nativeClassBySignature.put("float", float.class);
+ nativeClassBySignature.put("int", int.class);
+ nativeClassBySignature.put("long", long.class);
+ nativeClassBySignature.put("short", short.class);
+ nativeClassBySignature.put("void", void.class);
+
+ nativeClassBySignature.put("boolean[]", boolean[].class);
+ nativeClassBySignature.put("byte[]", byte[].class);
+ nativeClassBySignature.put("char[]", char[].class);
+ nativeClassBySignature.put("double[]", double[].class);
+ nativeClassBySignature.put("float[]", float[].class);
+ nativeClassBySignature.put("int[]", int[].class);
+ nativeClassBySignature.put("long[]", long[].class);
+ nativeClassBySignature.put("short[]", short[].class);
+ }
+
+ // Public --------------------------------------------------------
+ public Vector<ClassLoader> getLoaders()
+ {
+ return loaders;
+ }
+
+ public URL[] getURLs()
+ {
+ return null;
+ }
+
+ public Class<?> getCachedClass(String classname)
+ {
+ return classes.get(classname);
+ }
+
+ public Translator getTranslator()
+ {
+ return translator;
+ }
+
+ public void setTranslator(Translator t)
+ {
+ translator = t;
+ }
+
+ /**
+ * Compare two loader repository, by default we do no special ordering
+ *
+ * @param lr the loader repository
+ * @return -1, 0, 1 depending upon the order
+ */
+ public int compare(LoaderRepository lr)
+ {
+ if (lr == this)
+ return 0;
+ else
+ return -lr.reverseCompare(this);
+ }
+
+ // BEGIN ClassLoaderRepository **************************************************************************************
+
+ /**
+ * Loads a class from the repository. This method attempts to load the class
+ * using all the classloader registered to the repository.
+ *
+ * @param className the class to load
+ * @return the found class
+ * @exception ClassNotFoundException when there is no such class
+ */
+ public abstract Class<?> loadClass(String className) throws ClassNotFoundException;
+
+ /**
+ * Loads a class from the repository, excluding the given
+ * classloader.
+ *
+ * @param loader the classloader to exclude
+ * @param className the class to load
+ * @return the found class
+ * @exception ClassNotFoundException when there is no such class
+ */
+ public abstract Class<?> loadClassWithout(ClassLoader loader, String className) throws ClassNotFoundException;
+
+ /**
+ * Loads a class from the repository, using the classloaders that were
+ * registered before the given classloader.
+ *
+ * @param stop consult all the classloaders registered before this one
+ * in an attempt to load a class
+ * @param className name of the class to load
+ *
+ * @return loaded class instance
+ *
+ * @throws ClassNotFoundException if none of the consulted classloaders were
+ * able to load the requested class
+ */
+ public abstract Class<?> loadClassBefore(ClassLoader stop, String className) throws ClassNotFoundException;
+
+ // END ClassLoaderRepository ****************************************************************************************
+
+ /** Create RepositoryClassLoader and optionally add it to the repository
+ * @param url the URL to use for class loading
+ * @param addToRepository a flag indicating if the CL should be added to
+ * the repository
+ * @return the UCL instance
+ * @throws Exception
+ */
+ public abstract RepositoryClassLoader newClassLoader(final URL url, boolean addToRepository)
+ throws Exception;
+ /** Create RepositoryClassLoader and optionally add it to the repository
+ * @param url the URL to use for class loading
+ * @param origURL an orignal URL to use as the URL for the CL CodeSource.
+ * This is useful when the url is a local copy that is difficult to use for
+ * security policy writing.
+ * @param addToRepository a flag indicating if the CL should be added to
+ * the repository
+ * @return the CL instance
+ * @throws Exception
+ */
+ public abstract RepositoryClassLoader newClassLoader(final URL url, final URL origURL,
+ boolean addToRepository)
+ throws Exception;
+
+ /** Load the given class from the repository
+ * @param name
+ * @param resolve
+ * @param cl
+ * @return the class
+ * @throws ClassNotFoundException
+ */
+ public abstract Class<?> loadClass(String name, boolean resolve, ClassLoader cl)
+ throws ClassNotFoundException;
+
+ /** Find a resource URL for the given name
+ *
+ * @param name the resource name
+ * @param cl the requesting class loader
+ * @return The resource URL if found, null otherwise
+ */
+ public abstract URL getResource(String name, ClassLoader cl);
+ /** Find all resource URLs for the given name. Since this typically
+ * entails an exhuastive search of the repository it can be a relatively
+ * slow operation.
+ *
+ * @param name the resource name
+ * @param cl the requesting class loader
+ * @param urls a list into which the located resource URLs will be placed
+ */
+ public abstract void getResources(String name, ClassLoader cl, List<URL> urls);
+
+ /** Add a class loader to the repository
+ *
+ * @param cl the classloader
+ */
+ public abstract void addClassLoader(ClassLoader cl);
+ /** Update the set of URLs known to be associated with a previously added
+ * class loader.
+ *
+ * @param cl
+ * @param url
+ * @return true if added
+ */
+ public abstract boolean addClassLoaderURL(ClassLoader cl, URL url);
+ /** Remove a cladd loader from the repository.
+ * @param cl
+ */
+ public abstract void removeClassLoader(ClassLoader cl);
+
+ /**
+ * Return the class of a java native type
+ *
+ * @param className the className
+ * @return the class, or null if className is not a native class name
+ */
+ public static final Class<?> getNativeClassForName(String className)
+ {
+ // Check for native classes
+ return nativeClassBySignature.get(className);
+ }
+
+ /**
+ * Allow subclasses to override the ordering
+ *
+ * @param lr the loader repository
+ * @return -1, 0, 1 depending upon the order
+ */
+ protected int reverseCompare(LoaderRepository lr)
+ {
+ return 0;
+ }
+
+ /**
+ * Add a class to the the cache
+ *
+ * @param name the class name
+ * @param cls the class
+ * @param cl the classloader
+ */
+ void cacheLoadedClass(String name, Class<?> cls, ClassLoader cl)
+ {
+ synchronized( classes )
+ {
+ // Update the global cache
+ classes.put(name, cls);
+ if( log.isTraceEnabled() )
+ {
+ log.trace("cacheLoadedClass, classname: "+name+", class: "+cls
+ +", cl: "+cl);
+ }
+
+ /**
+ * TODO: Adding this implementation is a hack for jmx 1.2 checkin.
+ * Had to add this because need getCachedClass() to work.
+ * However, this method does not add loaded classes to collection
+ * to be unloaded when called to remove classloader.
+ * Hopefully this will be a short term workaround.
+ * Contact telrod at e2technologies.net if you have questions. -TME
+ */
+ }
+ }
+
+ void clear()
+ {
+ classes.clear();
+ }
+}
Copied: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/LoaderRepositoryFactory.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/loading/LoaderRepositoryFactory.java)
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/LoaderRepositoryFactory.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/LoaderRepositoryFactory.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,301 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.loading;
+
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import javax.management.InstanceNotFoundException;
+import javax.management.JMException;
+import javax.management.MalformedObjectNameException;
+import javax.management.MBeanServer;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+import org.jboss.logging.Logger;
+import org.jboss.mx.server.ServerConstants;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+
+/** A factory for LoaderRepository instances. This is used to obtain repository
+ * instances for scoped class loading.
+ *
+ * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class LoaderRepositoryFactory
+{
+ /** The JMX name of the parent LoaderRepository */
+ public static ObjectName DEFAULT_LOADER_REPOSITORY;
+ private static Logger log = Logger.getLogger(LoaderRepositoryFactory.class);
+ /** A HashMap<ObjectName, Integer> for the active references to LoaderRepositorys */
+ private static HashMap<ObjectName, Integer> referenceCountMap = new HashMap<ObjectName, Integer>();
+
+ static
+ {
+ try
+ {
+ // Initialize the default LoaderRepository name
+ DEFAULT_LOADER_REPOSITORY = new ObjectName(ServerConstants.DEFAULT_LOADER_NAME);
+ }
+ catch(Exception e)
+ {
+ log.error("Failed to init DEFAULT_LOADER_REPOSITORY name", e);
+ }
+ }
+
+ /** A class that represents the configuration of the a LoaderRepository.
+ * This defines the JMX ObjectName, the LoaderRepository implementation
+ * class, the repository config parser and a string representation of
+ * the repository config.
+ */
+ public static class LoaderRepositoryConfig implements Serializable
+ {
+ static final long serialVersionUID = 4226952985429700362L;
+
+ /** The ObjectName of the loader repository for this deployment */
+ public ObjectName repositoryName = DEFAULT_LOADER_REPOSITORY;
+ public String repositoryClassName;
+ public String configParserClassName;
+ public String repositoryConfig;
+
+ public String toString()
+ {
+ StringBuffer tmp = new StringBuffer("LoaderRepositoryConfig(");
+ tmp.append("repositoryName: ");
+ tmp.append(repositoryName);
+ tmp.append(", repositoryClassName: ");
+ tmp.append(repositoryClassName);
+ tmp.append(", configParserClassName: ");
+ tmp.append(configParserClassName);
+ tmp.append(", repositoryConfig: ");
+ tmp.append(repositoryConfig);
+ tmp.append(")");
+ return tmp.toString();
+ }
+ }
+
+ /** The interface representing a LoaderRepository configuration parser. A
+ * LoaderRepositoryConfigParser knows how to take a string representation of
+ * a config and map that onto a LoaderRepository implementation.
+ */
+ static public interface LoaderRepositoryConfigParser
+ {
+ public void configure(LoaderRepository repository, String config)
+ throws Exception;
+ }
+
+ /** Given a loader-repository element fragment like:
+ <loader-repository loaderRepositoryClass='...'>
+ jboss.test.cts:loader=cts-cmp2v2.ear
+ <loader-repository-config configParserClass='...'>
+ ...
+ </loader-repository-config>
+ </loader-repository>
+ create a LoaderRepositoryConfig representation.
+ @param config the xml loader-repository element
+ @return a LoaderRepositoryConfig representation of the config
+ @throws MalformedObjectNameException for a bad object name
+ */
+ public static LoaderRepositoryConfig parseRepositoryConfig(Element config)
+ throws MalformedObjectNameException
+ {
+ LoaderRepositoryConfig repositoryConfig = new LoaderRepositoryConfig();
+ repositoryConfig.repositoryClassName = config.getAttribute("loaderRepositoryClass");
+ if( repositoryConfig.repositoryClassName.length() == 0 )
+ repositoryConfig.repositoryClassName = ServerConstants.DEFAULT_SCOPED_REPOSITORY_CLASS;
+
+ // Get the object name of the repository
+ NodeList children = config.getChildNodes();
+ int count = children.getLength();
+ if( count > 0 )
+ {
+ for(int n = 0; n < count; n ++)
+ {
+ Node node = children.item(n);
+ int type = node.getNodeType();
+ // Get the ObjectName string
+ if( type == Node.TEXT_NODE || type == Node.CDATA_SECTION_NODE )
+ {
+ String objectName = node.getNodeValue().trim();
+ repositoryConfig.repositoryName = new ObjectName(objectName);
+ break;
+ }
+ }
+
+ // Next load any repository config
+ children = config.getElementsByTagName("loader-repository-config");
+ count = children.getLength();
+ if( count > 0 )
+ {
+ Element loaderRepositoryConfig = (Element) children.item(0);
+ children = loaderRepositoryConfig.getChildNodes();
+ count = children.getLength();
+ repositoryConfig.configParserClassName = loaderRepositoryConfig.getAttribute("configParserClass");
+ if( repositoryConfig.configParserClassName.length() == 0 )
+ repositoryConfig.configParserClassName = ServerConstants.DEFAULT_SCOPED_REPOSITORY_PARSER_CLASS;
+ StringBuffer configData = new StringBuffer();
+ for(int n = 0; n < count; n ++)
+ {
+ Node node = children.item(n);
+ int type = node.getNodeType();
+ if( type == Node.TEXT_NODE || type == Node.CDATA_SECTION_NODE )
+ {
+ configData.append(node.getNodeValue());
+ }
+ }
+ repositoryConfig.repositoryConfig = configData.toString().trim();
+ }
+ }
+ return repositoryConfig;
+ }
+
+ /** Create a LoaderRepository instance of type repositoryClassName and
+ * register it under repositoryName if there is not already an instance
+ * registered.
+ *
+ * @param server the MBeanServer to register with
+ * @param repositoryClassName the class which implements LoaderRepository
+ * @param repositoryName the JMX name to register under
+ * @throws JMException thrown on any failure to create or register the repository
+ */
+ public static synchronized void createLoaderRepository(MBeanServer server,
+ String repositoryClassName,
+ ObjectName repositoryName) throws JMException
+ {
+ LoaderRepositoryConfig config = new LoaderRepositoryConfig();
+ config.repositoryClassName = repositoryClassName;
+ config.repositoryName = repositoryName;
+ createLoaderRepository(server, config);
+ }
+ /** Create and configure a LoaderRepository instance using the given config
+ * if there is not already an instance registered.
+ *
+ * @param server the MBeanServer to register with
+ * @param config the configuration information which will be used to create
+ * register and configure the LoaderRepository instance.
+ * @throws JMException thrown on any failure to create or register the repository
+ */
+ public static synchronized void createLoaderRepository(MBeanServer server,
+ LoaderRepositoryConfig config) throws JMException
+ {
+ if( config == null )
+ config = new LoaderRepositoryConfig();
+ String repositoryClassName = config.repositoryClassName;
+ ObjectName repositoryName = config.repositoryName;
+
+ try
+ {
+ ObjectInstance oi = server.getObjectInstance(repositoryName);
+ if ( (repositoryClassName != null) &&
+ !oi.getClassName().equals(repositoryClassName) )
+ {
+ throw new JMException("Inconsistent LoaderRepository class specification in repository: " + repositoryName);
+ } // end of if ()
+ }
+ catch (InstanceNotFoundException e)
+ {
+ //we are the first, make the repository.
+ if( repositoryClassName == null )
+ repositoryClassName = ServerConstants.DEFAULT_SCOPED_REPOSITORY_CLASS;
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ LoaderRepository repository = null;
+ try
+ {
+ // Create the repository loader
+ Class<?> repositoryClass = loader.loadClass(repositoryClassName);
+ Class<?>[] ctorSig = {MBeanServer.class, ObjectName.class};
+ Constructor<?> ctor = repositoryClass.getConstructor(ctorSig);
+ Object[] args = {server, DEFAULT_LOADER_REPOSITORY};
+ repository = (LoaderRepository) ctor.newInstance(args);
+ server.registerMBean(repository, repositoryName);
+ }
+ catch(Exception e2)
+ {
+ log.debug("Failed to create loader repository: ", e2);
+ throw new JMException("Failed to create loader repository:" + e2);
+ }
+
+ try
+ {
+ // Configure the repository
+ if( config.configParserClassName != null && config.repositoryConfig != null )
+ {
+ Class<?> parserClass = loader.loadClass(config.configParserClassName);
+ LoaderRepositoryConfigParser parser = (LoaderRepositoryConfigParser)
+ parserClass.newInstance();
+ parser.configure(repository, config.repositoryConfig);
+ }
+ }
+ catch(Exception e2)
+ {
+ log.debug("Failed to configure loader repository: ", e2);
+ throw new JMException("Failed to configure loader repository: "+e2);
+ }
+ } // end of try-catch
+
+ Integer activeCount = referenceCountMap.get(repositoryName);
+ if( activeCount == null )
+ activeCount = new Integer(1);
+ else
+ activeCount = new Integer(activeCount.intValue() + 1);
+ referenceCountMap.put(repositoryName, activeCount);
+ }
+
+ public static synchronized void destroyLoaderRepository(MBeanServer server,
+ ObjectName repositoryName)
+ {
+ if( repositoryName.equals(DEFAULT_LOADER_REPOSITORY) == false )
+ {
+ try
+ {
+ Integer activeCount = referenceCountMap.get(repositoryName);
+ if( activeCount != null )
+ {
+ if( activeCount.intValue() == 1 )
+ {
+ server.unregisterMBean(repositoryName);
+ referenceCountMap.remove(repositoryName);
+ log.debug("Unregistered repository: "+repositoryName);
+ }
+ else
+ {
+ activeCount = new Integer(activeCount.intValue() - 1);
+ referenceCountMap.put(repositoryName, activeCount);
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ log.warn("Failed to unregister ear loader repository", e);
+ }
+ }
+ }
+
+ private LoaderRepositoryFactory()
+ {
+ }
+}// LoaderRepositoryFactory
Copied: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/RepositoryClassLoader.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/loading/RepositoryClassLoader.java)
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/RepositoryClassLoader.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/loading/RepositoryClassLoader.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,907 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.loading;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.CodeSource;
+import java.security.PermissionCollection;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.security.cert.Certificate;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Vector;
+import java.util.Collections;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.management.ObjectName;
+
+import org.jboss.classloading.spi.RealClassLoader;
+import org.jboss.logging.Logger;
+import org.jboss.util.loading.Translator;
+import org.jboss.util.collection.SoftSet;
+
+/**
+ * A RepositoryClassLoader.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public abstract class RepositoryClassLoader extends URLClassLoader implements RealClassLoader
+{
+ // Constants -----------------------------------------------------
+
+ /** The log */
+ private static final Logger log = Logger.getLogger(RepositoryClassLoader.class);
+
+ /** The value returned by {@link #getURLs}. */
+ private static final URL[] EMPTY_URL_ARRAY = {};
+
+ // Attributes -----------------------------------------------------
+
+ /** Reference to the repository. */
+ protected LoaderRepository repository = null;
+ /** The location where unregister is called from */
+ protected Exception unregisterTrace;
+
+ /** The relative order in which this class loader was added to the respository */
+ private int addedOrder;
+
+ /** The parent classloader */
+ protected ClassLoader parent = null;
+
+ /** Names of classes which have resulted in CNFEs in loadClassLocally */
+ @SuppressWarnings("unchecked")
+ private Set<String> classBlackList = Collections.synchronizedSet(new SoftSet());
+ /** Names of resources that were not found in loadResourceLocally */
+ private Set<String> resourceBlackList = Collections.synchronizedSet(new HashSet<String>());
+ /** A HashMap<String, URL> for resource found in loadResourceLocally */
+ private ConcurrentHashMap<String, URL> resourceCache = new ConcurrentHashMap<String, URL>();
+
+ /** Lock */
+ protected ReentrantLock loadLock = new ReentrantLock();
+
+ /** A debugging variable used to track the recursive depth of loadClass() */
+ protected int loadClassDepth;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ /**
+ * Create a new LoaderRepositoryClassLoader
+ *
+ * @param urls the urls
+ * @param parent the parent classloader
+ */
+ @SuppressWarnings("unchecked")
+ protected RepositoryClassLoader(URL[] urls, ClassLoader parent)
+ {
+ super(urls, parent);
+ this.parent = parent;
+ // Check the blacklist mode
+ String mode = ClassToStringAction.getProperty("org.jboss.mx.loading.blacklistMode", null);
+ if( mode == null || mode.equalsIgnoreCase("HashSet") )
+ {
+ classBlackList = Collections.synchronizedSet(new HashSet<String>());
+ resourceBlackList = Collections.synchronizedSet(new HashSet<String>());
+ }
+ else if( mode.equalsIgnoreCase("SoftSet") )
+ {
+ classBlackList = Collections.synchronizedSet(new SoftSet());
+ resourceBlackList = Collections.synchronizedSet(new SoftSet());
+ }
+ }
+
+ // Public --------------------------------------------------------
+
+ /**
+ * Get the ObjectName
+ *
+ * @return the object name
+ */
+ public abstract ObjectName getObjectName();
+
+ public boolean isValid()
+ {
+ return getLoaderRepository() != null;
+ }
+
+ /**
+ * Get the loader repository for this classloader
+ *
+ * @return the loader repository
+ */
+ public LoaderRepository getLoaderRepository()
+ {
+ return repository;
+ }
+
+ /**
+ * Set the loader repository
+ *
+ * @param repository the repository
+ */
+ public void setRepository(LoaderRepository repository)
+ {
+ log.debug("setRepository, repository="+repository+", cl=" + this);
+ this.repository = repository;
+ }
+
+ public Class<?> getCachedClass(String name)
+ {
+ LoaderRepository repository = this.repository;
+ if (repository == null)
+ return null;
+ return repository.getCachedClass(name);
+ }
+
+ public URL getCachedResource(String name)
+ {
+ // Not Implemented
+ return null;
+ }
+
+ public void clearBlackList(String name)
+ {
+ //Not Implemented yet
+ }
+
+ /**
+ * Get the order this classloader was added to the repository
+ *
+ * @return the order
+ */
+ public int getAddedOrder()
+ {
+ return addedOrder;
+ }
+
+ /**
+ * Set the order this classloader was added to the repository
+ *
+ * @param addedOrder the added order
+ */
+ public void setAddedOrder(int addedOrder)
+ {
+ this.addedOrder = addedOrder;
+ }
+
+ public Class<?> loadClassLocally(String name, boolean resolve)
+ throws ClassNotFoundException
+ {
+ boolean trace = log.isTraceEnabled();
+ if( trace )
+ log.trace("loadClassLocally, " + this + " name=" + name);
+ if( name == null || name.length() == 0 )
+ throw new ClassNotFoundException("Null or empty class name");
+
+ Class<?> result = null;
+ try
+ {
+ if (isClassBlackListed(name))
+ {
+ if( trace )
+ log.trace("Class in blacklist, name="+name);
+ throw new ClassNotFoundException("Class Not Found(blacklist): " + name);
+ }
+
+ // For java classes go straight to the system classloader
+ if (name.startsWith("java."))
+ {
+ ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+ return systemClassLoader.loadClass(name);
+ }
+
+ try
+ {
+ result = super.loadClass(name, resolve);
+ return result;
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ addToClassBlackList(name);
+ // If this is an array class, use Class.forName to resolve it
+ if( name.charAt(0) == '[' )
+ {
+ result = Class.forName(name, true, this);
+ removeFromClassBlackList(name);
+ return result;
+ }
+ if( trace )
+ log.trace("CFNE: Adding to blacklist: "+name);
+ throw cnfe;
+ }
+ }
+ finally
+ {
+ if (trace)
+ {
+ if (result != null)
+ log.trace("loadClassLocally, " + this + " name=" + name + " class=" + result + " cl=" + result.getClassLoader());
+ else
+ log.trace("loadClassLocally, " + this + " name=" + name + " not found");
+ }
+ }
+ }
+
+ /*
+ * Provides the same functionality as {@link java.net.URLClassLoader#getResource}.
+ */
+ public URL getResourceLocally(String name)
+ {
+ URL resURL = resourceCache.get(name);
+ if (resURL != null)
+ return resURL;
+ if (isResourceBlackListed(name))
+ return null;
+ resURL = super.getResource(name);
+ if( log.isTraceEnabled() == true )
+ log.trace("getResourceLocally("+this+"), name="+name+", resURL:"+resURL);
+ if (resURL == null)
+ addToResourceBlackList(name);
+ else
+ resourceCache.put(name, resURL);
+ return resURL;
+ }
+
+ /**
+ * Get the URL associated with the UCL.
+ *
+ * @return the url
+ */
+ public URL getURL()
+ {
+ URL[] urls = super.getURLs();
+ if (urls.length > 0)
+ return urls[0];
+ else
+ return null;
+ }
+
+ public void unregister()
+ {
+ log.debug("Unregistering cl=" + this);
+ if (repository != null)
+ repository.removeClassLoader(this);
+ clearBlacklists();
+ resourceCache.clear();
+ repository = null;
+ this.unregisterTrace = new Exception();
+ }
+
+ /**
+ * This method simply invokes the super.getURLs() method to access the
+ * list of URLs that make up the RepositoryClassLoader classpath.
+ *
+ * @return the urls that make up the classpath
+ */
+ public URL[] getClasspath()
+ {
+ return super.getURLs();
+ }
+
+ /**
+ * Return all library URLs associated with this RepositoryClassLoader
+ *
+ * <p>Do not remove this method without running the WebIntegrationTestSuite
+ * @return the urls
+ */
+ public URL[] getAllURLs()
+ {
+ return repository.getURLs();
+ }
+
+ /**
+ * Black list a class
+ *
+ * @param name the name of the class
+ */
+ public void addToClassBlackList(String name)
+ {
+ classBlackList.add(name);
+ }
+
+ /**
+ * Remove class from black list
+ *
+ * @param name the name of the class
+ */
+ public void removeFromClassBlackList(String name)
+ {
+ classBlackList.remove(name);
+ }
+
+ /**
+ * Is the class black listed?
+ *
+ * @param name the name of the class
+ * @return true when the class is black listed, false otherwise
+ */
+ public boolean isClassBlackListed(String name)
+ {
+ return classBlackList.contains(name);
+ }
+
+ /**
+ * Clear any class black list.
+ */
+ public void clearClassBlackList()
+ {
+ classBlackList.clear();
+ }
+
+ /**
+ * Black list a resource
+ *
+ * @param name the name of the resource
+ */
+ public void addToResourceBlackList(String name)
+ {
+ resourceBlackList.add(name);
+ }
+
+ /**
+ * Remove resource from black list
+ *
+ * @param name the name of the resource
+ */
+ public void removeFromResourceBlackList(String name)
+ {
+ resourceBlackList.remove(name);
+ }
+
+ /**
+ * Is the resource black listed?
+ *
+ * @param name the name of the resource
+ * @return true when the resource is black listed, false otherwise
+ */
+ public boolean isResourceBlackListed(String name)
+ {
+ return resourceBlackList.contains(name);
+ }
+
+ /**
+ * Clear any resource blacklist.
+ */
+ public void clearResourceBlackList()
+ {
+ resourceBlackList.clear();
+ }
+
+ /**
+ * Clear all blacklists
+ */
+ public void clearBlacklists()
+ {
+ clearClassBlackList();
+ clearResourceBlackList();
+ }
+
+
+ // URLClassLoader overrides --------------------------------------
+
+ /** The only caller of this method should be the VM initiated
+ * loadClassInternal() method. This method attempts to acquire the
+ * UnifiedLoaderRepository2 lock and then asks the repository to
+ * load the class.
+ *
+ * <p>Forwards request to {@link LoaderRepository}.
+ */
+ public Class<?> loadClass(String name, boolean resolve)
+ throws ClassNotFoundException
+ {
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace("loadClass " + this + " name=" + name+", loadClassDepth="+loadClassDepth);
+ Class<?> clazz = null;
+ try
+ {
+ if (repository != null)
+ {
+ clazz = repository.getCachedClass(name);
+ if (clazz != null)
+ {
+ if( log.isTraceEnabled() )
+ {
+ StringBuffer buffer = new StringBuffer("Loaded class from cache, ");
+ ClassToStringAction.toString(clazz, buffer);
+ log.trace(buffer.toString());
+ }
+ return clazz;
+ }
+ }
+ clazz = loadClassImpl(name, resolve, Integer.MAX_VALUE);
+ return clazz;
+ }
+ finally
+ {
+ if (trace)
+ {
+ if (clazz != null)
+ log.trace("loadClass " + this + " name=" + name + " class=" + clazz + " cl=" + clazz.getClassLoader());
+ else
+ log.trace("loadClass " + this + " name=" + name + " not found");
+ }
+ }
+ }
+
+ /** The only caller of this method should be the VM initiated
+ * loadClassInternal() method. This method attempts to acquire the
+ * UnifiedLoaderRepository2 lock and then asks the repository to
+ * load the class.
+ *
+ * <p>Forwards request to {@link LoaderRepository}.
+ * @param name the class name
+ * @return the class
+ * @throws ClassNotFoundException when the class is not found
+ */
+ public Class<?> loadClassBefore(String name)
+ throws ClassNotFoundException
+ {
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace("loadClassBefore " + this + " name=" + name);
+ Class<?> clazz = null;
+ try
+ {
+ clazz = loadClassImpl(name, false, addedOrder);
+ return clazz;
+ }
+ finally
+ {
+ if (trace)
+ {
+ if (clazz != null)
+ log.trace("loadClassBefore " + this + " name=" + name + " class=" + clazz + " cl=" + clazz.getClassLoader());
+ else
+ log.trace("loadClassBefore " + this + " name=" + name + " not found");
+ }
+ }
+ }
+
+ public abstract Class<?> loadClassImpl(String name, boolean resolve, int stopAt)
+ throws ClassNotFoundException;
+
+ /**
+ * Attempts to load the resource from its URL and if not found
+ * forwards to the request to {@link LoaderRepository}.
+ */
+ public URL getResource(String name)
+ {
+ if (repository != null)
+ return repository.getResource(name, this);
+ return null;
+ }
+
+ /** Find all resource URLs for the given name. This overrides the
+ * URLClassLoader version to look for resources in the repository.
+ *
+ * @param name the name of the resource
+ * @return Enumeration<URL>
+ * @throws java.io.IOException
+ */
+ public Enumeration<URL> findResources(String name) throws IOException
+ {
+ Vector<URL> resURLs = new Vector<URL>();
+ if( repository == null )
+ {
+ String msg = "Invalid use of destroyed classloader, UCL destroyed at:";
+ IOException e = new IOException(msg);
+ e.initCause(this.unregisterTrace);
+ throw e;
+ }
+ repository.getResources(name, this, resURLs);
+ return resURLs.elements();
+ }
+
+ /**
+ * Provides the same functionality as {@link java.net.URLClassLoader#findResources}.
+ *
+ * @param name the resource name
+ * @return the found resources
+ * @throws IOException for an error accessing the resources
+ */
+ public Enumeration<URL> findResourcesLocally(String name) throws IOException
+ {
+ return super.findResources(name);
+ }
+
+ /** Called by loadClassLocally to find the requested class within this
+ * class loaders class path.
+ *
+ * @param name the name of the class
+ * @return the resulting class
+ * @exception ClassNotFoundException if the class could not be found
+ */
+ protected Class<?> findClass(String name) throws ClassNotFoundException
+ {
+ boolean trace = log.isTraceEnabled();
+ if( trace )
+ log.trace("findClass, name="+name);
+ if (isClassBlackListed(name))
+ {
+ if( trace )
+ log.trace("Class in blacklist, name="+name);
+ throw new ClassNotFoundException("Class Not Found(blacklist): " + name);
+ }
+
+ if( repository == null )
+ {
+ String msg = "Invalid use of destroyed classloader, UCL destroyed at:";
+ ClassNotFoundException e = new ClassNotFoundException(msg);
+ e.initCause(this.unregisterTrace);
+ throw e;
+ }
+ Translator translator = repository.getTranslator();
+ if (translator != null)
+ {
+ // Obtain the transformed class bytecode
+ try
+ {
+ // Obtain the raw bytecode from the classpath
+ URL classUrl = getClassURL(name);
+ byte[] rawcode = loadByteCode(classUrl);
+ URL codeSourceUrl = getCodeSourceURL(name, classUrl);
+ ProtectionDomain pd = getProtectionDomain(codeSourceUrl);
+ byte[] bytecode = translator.transform(this, name, null, pd, rawcode);
+ // If there was no transform use the raw bytecode
+ if( bytecode == null )
+ bytecode = rawcode;
+ // Define the class package and instance
+ definePackage(name);
+ return defineClass(name, bytecode, 0, bytecode.length, pd);
+ }
+ catch(ClassNotFoundException e)
+ {
+ throw e;
+ }
+ catch (Throwable ex)
+ {
+ throw new ClassNotFoundException(name, ex);
+ }
+ }
+
+ Class<?> clazz = null;
+ try
+ {
+ clazz = findClassLocally(name);
+ }
+ catch(ClassNotFoundException e)
+ {
+ if( trace )
+ log.trace("CFNE: Adding to blacklist: "+name);
+ addToClassBlackList(name);
+ throw e;
+ }
+ return clazz;
+ }
+
+ /**
+ * Find the class
+ *
+ * @param name the name of the class
+ * @return the class
+ * @throws ClassNotFoundException when the class is not found
+ */
+ protected Class<?> findClassLocally(String name) throws ClassNotFoundException
+ {
+ return super.findClass(name);
+ }
+
+ /**
+ * Define the package for the class if not already done
+ *
+ * @todo this properly
+ * @param className the class name
+ */
+ protected void definePackage(String className)
+ {
+ int i = className.lastIndexOf('.');
+ if (i == -1)
+ return;
+
+ try
+ {
+ definePackage(className.substring(0, i), null, null, null, null, null, null, null);
+ }
+ catch (IllegalArgumentException alreadyDone)
+ {
+ }
+ }
+
+ /** Append the given url to the URLs used for class and resource loading
+ * @param url the URL to load from
+ */
+ public void addURL(URL url)
+ {
+ if( url == null )
+ throw new IllegalArgumentException("url cannot be null");
+
+ if( repository.addClassLoaderURL(this, url) == true )
+ {
+ log.debug("Added url: "+url+", to ucl: "+this);
+ // Strip any query parameters
+ String query = url.getQuery();
+ if( query != null )
+ {
+ String ext = url.toExternalForm();
+ String ext2 = ext.substring(0, ext.length() - query.length() - 1);
+ try
+ {
+ url = new URL (ext2);
+ }
+ catch(MalformedURLException e)
+ {
+ log.warn("Failed to strip query from: "+url, e);
+ }
+ }
+ super.addURL(url);
+ clearBlacklists();
+ }
+ else if( log.isTraceEnabled() )
+ {
+ log.trace("Ignoring duplicate url: "+url+", for ucl: "+this);
+ }
+ }
+
+ /**
+ * Return an empty URL array to force the RMI marshalling subsystem to
+ * use the <tt>java.server.codebase</tt> property as the annotated codebase.
+ *
+ * <p>Do not remove this method without discussing it on the dev list.
+ *
+ * @return Empty URL[]
+ */
+ public URL[] getURLs()
+ {
+ return EMPTY_URL_ARRAY;
+ }
+
+ public Package getPackage(String name)
+ {
+ return super.getPackage(name);
+ }
+
+ public Package[] getPackages()
+ {
+ return super.getPackages();
+ }
+
+ // Object overrides ----------------------------------------------
+
+ /**
+ * This is here to document that this must delegate to the
+ * super implementation to perform identity based equality. Using
+ * URL based equality caused conflicts with the Class.forName(String,
+ * boolean, ClassLoader).
+ */
+ public final boolean equals(Object other)
+ {
+ return super.equals(other);
+ }
+
+ /**
+ * This is here to document that this must delegate to the
+ * super implementation to perform identity based hashing. Using
+ * URL based hashing caused conflicts with the Class.forName(String,
+ * boolean, ClassLoader).
+ */
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Returns a string representation.
+ */
+ public String toString()
+ {
+ return super.toString() + "{ url=" + getURL() + " }";
+ }
+
+ // Protected -----------------------------------------------------
+
+ /** Attempt to acquire the class loading lock. This lock must be acquired
+ * before a thread enters the class loading task loop in loadClass. This
+ * method maintains any interrupted state of the calling thread.
+ *@see #loadClass(String, boolean)
+ *
+ * @param waitMS the length of time to wait in milliseconds
+ * @return true when the lock was obtained
+ */
+ protected boolean attempt(long waitMS)
+ {
+ boolean acquired = false;
+ boolean trace = log.isTraceEnabled();
+ // Save and clear the interrupted state of the incoming thread
+ boolean threadWasInterrupted = Thread.interrupted();
+ try
+ {
+ acquired = loadLock.tryLock(waitMS, TimeUnit.MILLISECONDS);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ finally
+ {
+ // Restore the interrupted state of the thread
+ if( threadWasInterrupted )
+ Thread.currentThread().interrupt();
+ }
+ if( trace )
+ log.trace("attempt("+loadLock.getHoldCount()+") was: "+acquired+" for :"+this);
+ return acquired;
+ }
+
+ /** Acquire the class loading lock. This lock must be acquired
+ * before a thread enters the class loading task loop in loadClass.
+ *@see #loadClass(String, boolean)
+ */
+ protected void acquire()
+ {
+ loadLock.lock();
+ if( log.isTraceEnabled() )
+ log.trace("acquired("+loadLock.getHoldCount()+") for :"+this);
+ }
+ /** Release the class loading lock previous acquired through the acquire
+ * method.
+ */
+ protected void release()
+ {
+ if( log.isTraceEnabled() )
+ log.trace("release("+loadLock.getHoldCount()+") for :"+this);
+ loadLock.unlock();
+ if( log.isTraceEnabled() )
+ log.trace("released, holds: "+loadLock.getHoldCount());
+ }
+
+ /** Obtain the bytecode for the indicated class from this class loaders
+ * classpath.
+ *
+ * @param classname
+ * @return the bytecode array if found
+ * @exception ClassNotFoundException - if the class resource could not
+ * be found
+ * @throws IOException when there is an error loading the class bytes
+ */
+ protected byte[] loadByteCode(String classname)
+ throws ClassNotFoundException, IOException
+ {
+ byte[] bytecode = null;
+ URL classURL = getClassURL(classname);
+
+ // Load the class bytecode
+ InputStream is = null;
+ try
+ {
+ is = classURL.openStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] tmp = new byte[1024];
+ int read = 0;
+ while( (read = is.read(tmp)) > 0 )
+ {
+ baos.write(tmp, 0, read);
+ }
+ bytecode = baos.toByteArray();
+ }
+ finally
+ {
+ if( is != null )
+ is.close();
+ }
+
+ return bytecode;
+ }
+
+ /** Obtain the bytecode for the indicated class from this class loaders
+ * classpath.
+ *
+ * @param classURL
+ * @return the bytecode array if found
+ * @exception ClassNotFoundException - if the class resource could not
+ * be found
+ * @throws IOException when there is an error loading the class bytes
+ */
+ protected byte[] loadByteCode(URL classURL)
+ throws ClassNotFoundException, IOException
+ {
+ byte[] bytecode = null;
+ // Load the class bytecode
+ InputStream is = null;
+ try
+ {
+ is = classURL.openStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] tmp = new byte[1024];
+ int read = 0;
+ while( (read = is.read(tmp)) > 0 )
+ {
+ baos.write(tmp, 0, read);
+ }
+ bytecode = baos.toByteArray();
+ }
+ finally
+ {
+ if( is != null )
+ is.close();
+ }
+
+ return bytecode;
+ }
+
+ /**
+ * Determine the protection domain. If we are a copy of the original
+ * deployment, use the original url as the codebase.
+ *
+ * @param codesourceUrl the codesource url
+ * @return the protection domain
+ * @todo certificates and principles?
+ */
+ protected ProtectionDomain getProtectionDomain(URL codesourceUrl)
+ {
+ Certificate certs[] = null;
+ CodeSource cs = new CodeSource(codesourceUrl, certs);
+ PermissionCollection permissions = Policy.getPolicy().getPermissions(cs);
+ if (log.isTraceEnabled())
+ log.trace("getProtectionDomain, url=" + codesourceUrl +
+ " codeSource=" + cs + " permissions=" + permissions);
+ return new ProtectionDomain(cs, permissions);
+ }
+
+ // Package Private -----------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private URL getCodeSourceURL(String classname, URL classURL) throws java.net.MalformedURLException
+ {
+ String classRsrcName = classname.replace('.', '/') + ".class";
+ String urlAsString = classURL.toString();
+ int idx = urlAsString.indexOf(classRsrcName);
+ if (idx == -1) return classURL;
+ urlAsString = urlAsString.substring(0, idx);
+ return new URL(urlAsString);
+ }
+
+ private URL getClassURL(String classname) throws ClassNotFoundException
+ {
+ String classRsrcName = classname.replace('.', '/') + ".class";
+ URL classURL = this.getResourceLocally(classRsrcName);
+ if( classURL == null )
+ {
+ String msg = "Failed to find: "+classname+" as resource: "+classRsrcName;
+ throw new ClassNotFoundException(msg);
+ }
+ return classURL;
+ }
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/JBossMXMBeanServerDelegate.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/JBossMXMBeanServerDelegate.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/JBossMXMBeanServerDelegate.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.mx.server;
+
+import javax.management.MBeanServerDelegate;
+
+/**
+ * JBossMXMBeanServerDelegate.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JBossMXMBeanServerDelegate extends MBeanServerDelegate
+{
+ public String getImplementationName()
+ {
+ return ServerConstants.IMPLEMENTATION_NAME;
+ }
+
+ public String getImplementationVendor()
+ {
+ return ServerConstants.IMPLEMENTATION_VENDOR;
+ }
+
+ public String getImplementationVersion()
+ {
+ return ServerConstants.IMPLEMENTATION_VERSION;
+ }
+}
Modified: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/JBossMXServerConfig.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/JBossMXServerConfig.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/JBossMXServerConfig.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -23,8 +23,6 @@
import javax.management.ObjectName;
-import org.jboss.mx.standardmbean.StandardMBeanDelegateFactory;
-import org.jboss.mx.standardmbean.StandardMBeanFactoryImpl;
import org.jboss.mx.util.ObjectNameFactory;
/**
@@ -60,11 +58,6 @@
return DEFAULT_MBEAN_SERVER_BUILDER_CLASS;
}
- public StandardMBeanDelegateFactory getStandardMBeanDelegateFactory()
- {
- return new StandardMBeanFactoryImpl();
- }
-
// Protected ---------------------------------------------------
// Private -----------------------------------------------------
Modified: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/MBeanServerBuilderImpl.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/MBeanServerBuilderImpl.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/MBeanServerBuilderImpl.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -40,14 +40,6 @@
public class MBeanServerBuilderImpl
extends MBeanServerBuilder
{
- // Constants ---------------------------------------------------
-
- // Attributes --------------------------------------------------
-
- // Static -----------------------------------------------------
-
- // Constructors ------------------------------------------------
-
/**
* Construct an MBeanServerBuilder
*/
@@ -76,20 +68,6 @@
*/
public MBeanServerDelegate newMBeanServerDelegate()
{
- return new MBeanServerDelegate();
+ return new JBossMXMBeanServerDelegate();
}
-
- // Public ------------------------------------------------------
-
- // X Implementation --------------------------------------------
-
- // Y Overrides -------------------------------------------------
-
- // Protected ---------------------------------------------------
-
- // Package Private ---------------------------------------------
-
- // Private -----------------------------------------------------
-
- // Inner Classes -----------------------------------------------
}
Modified: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/MBeanServerImpl.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/MBeanServerImpl.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/MBeanServerImpl.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -89,7 +89,6 @@
import org.jboss.mx.server.registry.MBeanRegistry;
import org.jboss.mx.service.ServiceConstants;
import org.jboss.mx.util.JMXExceptionDecoder;
-import org.jboss.mx.util.PropertyAccess;
import org.jboss.util.NestedRuntimeException;
/**
@@ -200,6 +199,8 @@
this.classLoaderRepository = getClassLoaderRepository();
// the second first thing to do is to create a registry instance
+ if (defaultDomain == null)
+ defaultDomain = DEFAULT_DOMAIN;
this.registry = createRegistry(defaultDomain);
// The first MBean to be registered should be the server delegate
Copied: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/ObjectInputStreamWithClassLoader.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/server/ObjectInputStreamWithClassLoader.java)
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/ObjectInputStreamWithClassLoader.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/ObjectInputStreamWithClassLoader.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.server;
+
+
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.io.IOException;
+
+import java.lang.reflect.Proxy;
+
+/**
+ * This replaces the EjbossInputStream in the storage package.
+ * The input stream will take a class loader in its constructor and look
+ * into it to retrieve the class definitions.
+ * It is used throughout the server to deserialize parameters and objects
+ * whose definition are in a jar and not the global classpath
+ * It also has better comments than the previous version.
+ *
+ * @author <a href="rickard at dreambean.com">Rickard Oberg</a>
+ * @since Ejboss 0.9
+ */
+
+
+public class ObjectInputStreamWithClassLoader
+ extends ObjectInputStream {
+
+ /**
+ * The classloader to use when the default classloader cannot find
+ * the classes in the stream.
+ */
+ ClassLoader cl;
+
+
+/******************************************************************************/
+/******************************************************************************/
+/*
+/* CONSTRUCTORS
+/*
+/******************************************************************************/
+/******************************************************************************/
+
+ /**
+ * Construct a new instance with the given classloader and input stream.
+ *
+ * @param cl classloader to use
+ * @param in stream to read objects from
+ * @throws IOException for any error
+ */
+ public ObjectInputStreamWithClassLoader(InputStream in, ClassLoader cl)
+ throws IOException {
+
+ super(in);
+
+ this.cl = cl;
+ }
+
+
+/******************************************************************************/
+/******************************************************************************/
+/*
+/* OVERWRITING <ObjectInputStream>
+/*
+/******************************************************************************/
+/******************************************************************************/
+
+ /**
+ * Resolve the class described in the osc parameter. First, try the
+ * default classloader (implemented by the super class). If it cannot
+ * load the class, try the classloader given to this instance.
+ *
+ * @param osc class description object
+ * @return the Class corresponding to class description
+ * @exception IOException if an I/O error occurs
+ * @exception ClassNotFoundException if the class cannot be found by the classloader
+ */
+ protected Class<?> resolveClass(ObjectStreamClass osc)
+ throws IOException, ClassNotFoundException {
+
+ return cl.loadClass(osc.getName());
+ }
+
+ protected Class<?> resolveProxyClass( String[] interfaces )
+ throws IOException, ClassNotFoundException {
+
+ Class<?>[] interfacesClass = new Class[interfaces.length];
+ for( int i=0; i< interfaces.length; i++ )
+ {
+ interfacesClass[i] = Class.forName(interfaces[i], false, cl);
+ }
+
+ return Proxy.getProxyClass(cl, interfacesClass);
+ }
+}
+
+
+
+
Added: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/PropertyAccess.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/PropertyAccess.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/PropertyAccess.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.server;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/** System property access utilties that encapsulate the
+ * AccessController.doPrivileged calls required when running with a
+ * security manager. Use to access system properties when the callers
+ * permissions should not dictate whether or not access is allowed.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 85671 $
+ */
+class PropertyAccess
+{
+ static class PropertyReadAction implements PrivilegedAction<String>
+ {
+ private String name;
+ private String defaultValue;
+ PropertyReadAction(String name, String defaultValue)
+ {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+ public String run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ }
+ static class PropertyWriteAction implements PrivilegedAction<String>
+ {
+ private String name;
+ private String value;
+ PropertyWriteAction(String name, String value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+ public String run()
+ {
+ return System.setProperty(name, value);
+ }
+ }
+
+ public static String getProperty(String name)
+ {
+ return getProperty(name, null);
+ }
+
+ public static String getProperty(String name, String defaultValue)
+ {
+ PropertyReadAction action = new PropertyReadAction(name, defaultValue);
+ String property = AccessController.doPrivileged(action);
+ return property;
+ }
+
+ public static String setProperty(String name, String value)
+ {
+ PropertyWriteAction action = new PropertyWriteAction(name, value);
+ String property = AccessController.doPrivileged(action);
+ return property;
+ }
+
+}
Copied: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/ServerConfig.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/server/ServerConfig.java)
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/ServerConfig.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/ServerConfig.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.server;
+
+import javax.management.MBeanServerBuilder;
+import javax.management.ObjectName;
+
+import org.jboss.mx.util.ObjectNameFactory;
+import org.jboss.util.Classes;
+
+/**
+ * Server configuration.
+ *
+ * @author <a href="mailto:adrian at jboss.com">Adrian Brock</a>.
+ * @version $Revision$
+ */
+public abstract class ServerConfig
+{
+ // Constants ---------------------------------------------------
+
+ /** The instance */
+ private static ServerConfig instance;
+
+ /**
+ * The name of the protected implementation domain
+ * Pass this object to the registry in the values map as the key and value
+ * to register in this domain
+ */
+ private final static String JMI_DOMAIN = "JMImplementation";
+
+ /** The default domain */
+ private final static String DEFAULT_DOMAIN = "DefaultDomain";
+
+ /** The MBeanServerDelegate ObjectName */
+ private static final ObjectName mbeanServerDelegateName = ObjectNameFactory.create(JMI_DOMAIN + ":type=MBeanServerDelegate");
+
+ /** The server config property */
+ public final static String SERVER_CONFIG_CLASS_PROPERTY = "jbossmx.server.config.class";
+
+ /** The default server config class */
+ public final static String DEFAULT_SERVER_CONFIG_CLASS = "org.jboss.mx.server.JBossMXServerConfig";
+
+ /** The mbean server builder property */
+ public final static String MBEAN_SERVER_BUILDER_CLASS_PROPERTY = "javax.management.builder.initial";
+
+ // Attributes --------------------------------------------------
+
+ // Static ------------------------------------------------------
+
+ public static synchronized ServerConfig getInstance()
+ {
+ if (instance != null)
+ return instance;
+ instance = (ServerConfig) Classes.instantiate(ServerConfig.class, SERVER_CONFIG_CLASS_PROPERTY, DEFAULT_SERVER_CONFIG_CLASS);
+ return instance;
+ }
+
+ // Constructors ------------------------------------------------
+
+ /**
+ * No external construction
+ */
+ protected ServerConfig()
+ {
+ }
+
+ // Public ------------------------------------------------------
+
+ /**
+ * Get the default domain
+ *
+ * @return the default domain
+ */
+ public String getDefaultDomain()
+ {
+ return DEFAULT_DOMAIN;
+ }
+
+ /**
+ * Get the implementation domain
+ *
+ * @return the implementation domain
+ */
+ public String getJMIDomain()
+ {
+ return JMI_DOMAIN;
+ }
+
+ /**
+ * Get the MBeanServer delegate name
+ *
+ * @return the ObjectName of the MBeanServerDelegate
+ */
+ public ObjectName getMBeanServerDelegateName()
+ {
+ return mbeanServerDelegateName;
+ }
+
+ /**
+ * Get the MBeanServer builder
+ *
+ * @return the mbeanserver builder
+ */
+ public MBeanServerBuilder getMBeanServerBuilder()
+ {
+ String defaultMBeanServerBuilder = getDefaultMBeanServerBuilderClassName();
+ return (MBeanServerBuilder) Classes.instantiate(MBeanServerBuilder.class, MBEAN_SERVER_BUILDER_CLASS_PROPERTY, defaultMBeanServerBuilder);
+
+ }
+
+ /**
+ * Get the default loader repository name
+ *
+ * @return the default loader repository name
+ */
+ public abstract ObjectName getLoaderRepositoryName();
+
+ // Protected ---------------------------------------------------
+
+ protected abstract String getDefaultMBeanServerBuilderClassName();
+
+ // Private -----------------------------------------------------
+
+ // Inner classes -----------------------------------------------
+}
Modified: projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -627,6 +627,19 @@
// Now we have to do a brute force, oh well.
else
{
+ // We need to preprocess any implied DefaultDomain in the pattern since the apply() doesn't understand it
+ if (pattern.getDomain().length() == 0)
+ {
+ try
+ {
+ pattern = new ObjectName(defaultDomain + pattern.toString());
+ }
+ catch (MalformedObjectNameException e)
+ {
+ log.warn("Unable to add default domain '" + defaultDomain + "' to " + pattern);
+ }
+ }
+
// Here we go, step through every domain and see if our pattern matches before optionally checking
// each ObjectName's properties for a match.
for (Iterator domainIter = domainMap.entrySet().iterator(); domainIter.hasNext();)
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml (from rev 85922, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml)
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mbean SYSTEM "file:./src/main/test/implementation/modelmbean/support/xml/xmbean.dtd">
-
-<mbean>
-
- <attribute setMethod="setFoo" getMethod="getBar">
- <name>Something</name>
- <type>java.lang.String</type>
- <access>read-write</access>
- </attribute>
-
- <operation>
- <name>setFoo</name>
- <parameter>
- <name>name</name>
- <type>java.lang.String</type>
- </parameter>
- <return-type>void</return-type>
- <impact>ACTION</impact>
- </operation>
-
- <operation>
- <name>getBar</name>
- <return-type>java.lang.String</return-type>
- <impact>INFO</impact>
- </operation>
-
-</mbean>
-
-
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.2//EN" "dtd/jboss_xmbean_1_2.dtd">
+
+<mbean>
+
+ <class>notused</class>
+
+ <attribute access="read-write" setMethod="setFoo" getMethod="getBar">
+ <name>Something</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ <operation impact="ACTION">
+ <name>setFoo</name>
+ <parameter>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ </operation>
+
+ <operation impact="INFO">
+ <name>getBar</name>
+ <return-type>java.lang.String</return-type>
+ </operation>
+
+</mbean>
+
+
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mbean SYSTEM "file:./src/main/test/implementation/modelmbean/support/xml/xmbean.dtd">
-
-<mbean>
-
- <attribute setMethod="setFoo" getMethod="getBar" currencyTimeLimit="0">
- <name>Something</name>
- <type>java.lang.String</type>
- <access>read-write</access>
- </attribute>
-
- <operation>
- <name>setFoo</name>
- <parameter>
- <name>name</name>
- <type>java.lang.String</type>
- </parameter>
- <return-type>void</return-type>
- <impact>ACTION</impact>
- </operation>
-
- <operation>
- <name>getBar</name>
- <return-type>java.lang.String</return-type>
- <impact>INFO</impact>
- </operation>
-
-</mbean>
-
-
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.2//EN" "dtd/jboss_xmbean_1_2.dtd">
+
+<mbean>
+
+ <class>notused</class>
+
+ <attribute access="read-write" setMethod="setFoo" getMethod="getBar">
+ <name>Something</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <descriptor name="currencyTimeLimit" value="-1"/>
+ </descriptors>
+ </attribute>
+
+ <operation impact="ACTION">
+ <name>setFoo</name>
+ <parameter>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ </operation>
+
+ <operation impact="INFO">
+ <name>getBar</name>
+ <return-type>java.lang.String</return-type>
+ </operation>
+
+</mbean>
+
+
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mbean SYSTEM "file:./src/main/test/implementation/modelmbean/support/xml/xmbean.dtd">
-
-<mbean>
-
- <attribute setMethod="setFoo" getMethod="getBar" currencyTimeLimit="-1">
- <name>Something</name>
- <type>java.lang.String</type>
- <access>read-write</access>
- </attribute>
-
- <operation>
- <name>setFoo</name>
- <parameter>
- <name>name</name>
- <type>java.lang.String</type>
- </parameter>
- <return-type>void</return-type>
- <impact>ACTION</impact>
- </operation>
-
- <operation>
- <name>getBar</name>
- <return-type>java.lang.String</return-type>
- <impact>INFO</impact>
- </operation>
-
-</mbean>
-
-
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.2//EN" "dtd/jboss_xmbean_1_2.dtd">
+
+<mbean>
+
+ <class>notused</class>
+
+ <attribute access="read-write" setMethod="setFoo" getMethod="getBar">
+ <name>Something</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <descriptor name="currencyTimeLimit" value="0"/>
+ </descriptors>
+ </attribute>
+
+ <operation impact="ACTION">
+ <name>setFoo</name>
+ <parameter>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ </operation>
+
+ <operation impact="INFO">
+ <name>getBar</name>
+ <return-type>java.lang.String</return-type>
+ </operation>
+
+</mbean>
+
+
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mbean SYSTEM "file:./src/main/test/implementation/modelmbean/support/xml/xmbean.dtd">
-
-<mbean>
-
- <attribute setMethod="setFoo" getMethod="getBar" currencyTimeLimit="10">
- <name>Something</name>
- <type>java.lang.String</type>
- <access>read-write</access>
- </attribute>
-
- <operation>
- <name>setFoo</name>
- <parameter>
- <name>name</name>
- <type>java.lang.String</type>
- </parameter>
- <return-type>void</return-type>
- <impact>ACTION</impact>
- </operation>
-
- <operation>
- <name>getBar</name>
- <return-type>java.lang.String</return-type>
- <impact>INFO</impact>
- </operation>
-
-</mbean>
-
-
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.2//EN" "dtd/jboss_xmbean_1_2.dtd">
+
+<mbean>
+
+ <class>notused</class>
+
+ <attribute access="read-write" setMethod="setFoo" getMethod="getBar">
+ <name>Something</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <descriptor name="currencyTimeLimit" value="10"/>
+ </descriptors>
+ </attribute>
+
+ <operation impact="ACTION">
+ <name>setFoo</name>
+ <parameter>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ </operation>
+
+ <operation impact="INFO">
+ <name>getBar</name>
+ <return-type>java.lang.String</return-type>
+ </operation>
+
+</mbean>
+
+
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mbean SYSTEM "file:./src/main/test/implementation/modelmbean/support/xml/xmbean.dtd">
-
-<mbean>
-
- <attribute setMethod="setFoo" getMethod="getBar" currencyTimeLimit="1">
- <name>Something</name>
- <type>java.lang.String</type>
- <access>read-write</access>
- </attribute>
-
- <operation>
- <name>setFoo</name>
- <parameter>
- <name>name</name>
- <type>java.lang.String</type>
- </parameter>
- <return-type>void</return-type>
- <impact>ACTION</impact>
- </operation>
-
- <operation>
- <name>getBar</name>
- <return-type>java.lang.String</return-type>
- <impact>INFO</impact>
- </operation>
-
-</mbean>
-
-
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.2//EN" "dtd/jboss_xmbean_1_2.dtd">
+
+<mbean>
+
+ <class>notused</class>
+
+ <attribute access="read-write" setMethod="setFoo" getMethod="getBar">
+ <name>Something</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <descriptor name="currencyTimeLimit" value="1"/>
+ </descriptors>
+ </attribute>
+
+ <operation impact="ACTION">
+ <name>setFoo</name>
+ <parameter>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ </operation>
+
+ <operation impact="INFO">
+ <name>getBar</name>
+ <return-type>java.lang.String</return-type>
+ </operation>
+
+</mbean>
+
+
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/User.xml
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/User.xml 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/User.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mbean SYSTEM "file:./src/main/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd">
-
-<mbean>
- <description><![CDATA[sample for jboss xmbean.dtd]]></description>
- <descriptors>
- <persistence persistPolicy="NEVER"
- persistPeriod="10"
- persistLocation="pl1"
- persistName="JBossXMLExample1"/>
- <state-action-on-update value="RESTART"/>
- <descriptor name="testdescriptor" value="testvalue"/>
- </descriptors>
- <class>test.implementation.modelmbean.support.User</class>
-
- <constructor>
- <description><![CDATA[Creates a new <code>User</code> instance using constructor with one argument.]]></description>
- <name>test.implementation.modelmbean.support.User</name>
- <parameter>
- <description><![CDATA[a <code>long</code> value]]></description>
- <name>id</name>
- <type>long</type>
- </parameter>
- </constructor>
- <constructor>
- <description><![CDATA[Creates a new <code>User</code> using constructor with no argument]]></description>
- <name>test.implementation.modelmbean.support.User</name>
- </constructor>
-
- <!--attributes-->
- <attribute access="READ_WRITE" getMethod="getID">
- <description><![CDATA[Describe <code>getID</code> method here.
- read-only attribute]]></description>
- <name>ID</name>
- <type>long</type>
- <descriptors>
- <persistence persistPolicy="NEVER"
- persistPeriod="30"/>
- </descriptors>
- </attribute>
- <attribute access="READ_WRITE" getMethod="getName" setMethod="setName">
- <description><![CDATA[Describe <code>getName</code> method here.
- read-write attribute]]></description>
- <name>Name</name>
- <type>java.lang.String</type>
- <descriptors>
- <persistence persistPolicy="NEVER"
- persistPeriod="30"/>
- </descriptors>
- </attribute>
- <attribute access="READ_WRITE" getMethod="getAddress" setMethod="setAddress">
- <description><![CDATA[Describe <code>getAddress</code> method here.
- read-write attribute]]></description>
- <name>Address</name>
- <type>java.lang.String</type>
- <descriptors>
- <persistence persistPolicy="NEVER"
- persistPeriod="30"/>
- </descriptors>
- </attribute>
- <attribute access="READ_WRITE" getMethod="getPhoneNumbers" setMethod="setPhoneNumbers">
- <description><![CDATA[Describe <code>getPhoneNumbers</code> method here.
- read-write attribute]]></description>
- <name>PhoneNumbers</name>
- <type>[Ljava.lang.String;</type>
- <descriptors>
- <persistence persistPolicy="NEVER"
- persistPeriod="30"/>
- </descriptors>
- </attribute>
- <attribute access="READ_WRITE" setMethod="setPassword">
- <description><![CDATA[Describe <code>setPassword</code> method here.
- write only attribute]]></description>
- <name>Password</name>
- <type>java.lang.String</type>
- <descriptors>
- <persistence persistPolicy="NEVER"
- persistPeriod="30"/>
- </descriptors>
- </attribute>
-
-<!--operations -->
- <operation>
- <description><![CDATA[Describe <code>printInfo</code> method here.
- prints info]]></description>
- <name>printInfo</name>
- <return-type>java.lang.String</return-type>
- </operation>
- <operation>
- <description><![CDATA[Describe <code>addPhoneNumber</code> method here.]]></description>
- <name>addPhoneNumber</name>
- <parameter>
- <description><![CDATA[a <code>String</code> value, the phone number to add]]></description>
- <name>number</name>
- <type>java.lang.String</type>
- </parameter>
- <return-type>void</return-type>
- </operation>
- <operation>
- <description><![CDATA[Describe <code>removePhoneNumber</code> method here.]]></description>
- <name>removePhoneNumber</name>
- <parameter>
- <description><![CDATA[an <code>int</code> value, the index of phone number to remove]]></description>
- <name>index</name>
- <type>int</type>
- </parameter>
- <return-type>void</return-type>
- </operation>
-
-<!--notifications -->
- <notification>
- <description><![CDATA[first notification]]></description>
- <name>javax.management.SomeEvent</name>
- <notification-type>xd.example.first</notification-type>
- <notification-type>xd.example.second</notification-type>
- <descriptors>
- <persistence persistPolicy="NEVER"
- persistPeriod="20"
- persistLocation="pl2"
- persistName="JBossXMLExample2"
-/>
- </descriptors>
- </notification>
-
-</mbean>
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/User.xml (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/User.xml)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/User.xml (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/User.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.0//EN" "jboss_xmbean_1_0.dtd">
+
+<mbean>
+ <description><![CDATA[sample for jboss xmbean.dtd]]></description>
+ <descriptors>
+ <persistence persistPolicy="Never"
+ persistPeriod="10"
+ persistLocation="pl1"
+ persistName="JBossXMLExample1"/>
+ <state-action-on-update value="restart"/>
+ <descriptor name="testdescriptor" value="testvalue"/>
+ </descriptors>
+ <class>test.implementation.modelmbean.support.User</class>
+
+ <constructor>
+ <description><![CDATA[Creates a new <code>User</code> instance using constructor with one argument.]]></description>
+ <name>test.implementation.modelmbean.support.User</name>
+ <parameter>
+ <description><![CDATA[a <code>long</code> value]]></description>
+ <name>id</name>
+ <type>long</type>
+ </parameter>
+ </constructor>
+ <constructor>
+ <description><![CDATA[Creates a new <code>User</code> using constructor with no argument]]></description>
+ <name>test.implementation.modelmbean.support.User</name>
+ </constructor>
+
+ <!--attributes-->
+ <attribute access="read-write" getMethod="getID">
+ <description><![CDATA[Describe <code>getID</code> method here.
+ read-only attribute]]></description>
+ <name>ID</name>
+ <type>long</type>
+ <descriptors>
+ <persistence persistPolicy="Never"
+ persistPeriod="30"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write" getMethod="getName" setMethod="setName">
+ <description><![CDATA[Describe <code>getName</code> method here.
+ read-write attribute]]></description>
+ <name>Name</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <persistence persistPolicy="Never"
+ persistPeriod="30"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write" getMethod="getAddress" setMethod="setAddress">
+ <description><![CDATA[Describe <code>getAddress</code> method here.
+ read-write attribute]]></description>
+ <name>Address</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <persistence persistPolicy="Never"
+ persistPeriod="30"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write" getMethod="getPhoneNumbers" setMethod="setPhoneNumbers">
+ <description><![CDATA[Describe <code>getPhoneNumbers</code> method here.
+ read-write attribute]]></description>
+ <name>PhoneNumbers</name>
+ <type>[Ljava.lang.String;</type>
+ <descriptors>
+ <persistence persistPolicy="Never"
+ persistPeriod="30"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write" setMethod="setPassword">
+ <description><![CDATA[Describe <code>setPassword</code> method here.
+ write only attribute]]></description>
+ <name>Password</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <persistence persistPolicy="Never"
+ persistPeriod="30"/>
+ </descriptors>
+ </attribute>
+
+<!--operations -->
+ <operation>
+ <description><![CDATA[Describe <code>printInfo</code> method here.
+ prints info]]></description>
+ <name>printInfo</name>
+ <return-type>java.lang.String</return-type>
+ </operation>
+ <operation>
+ <description><![CDATA[Describe <code>addPhoneNumber</code> method here.]]></description>
+ <name>addPhoneNumber</name>
+ <parameter>
+ <description><![CDATA[a <code>String</code> value, the phone number to add]]></description>
+ <name>number</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ </operation>
+ <operation>
+ <description><![CDATA[Describe <code>removePhoneNumber</code> method here.]]></description>
+ <name>removePhoneNumber</name>
+ <parameter>
+ <description><![CDATA[an <code>int</code> value, the index of phone number to remove]]></description>
+ <name>index</name>
+ <type>int</type>
+ </parameter>
+ <return-type>void</return-type>
+ </operation>
+
+<!--notifications -->
+ <notification>
+ <description><![CDATA[first notification]]></description>
+ <name>javax.management.SomeEvent</name>
+ <notification-type>xd.example.first</notification-type>
+ <notification-type>xd.example.second</notification-type>
+ <descriptors>
+ <persistence persistPolicy="Never"
+ persistPeriod="20"
+ persistLocation="pl2"
+ persistName="JBossXMLExample2"
+/>
+ </descriptors>
+ </notification>
+
+</mbean>
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mbean SYSTEM "file:./src/main/test/implementation/modelmbean/support/xml/xmbean.dtd">
-
-<mbean>
- <constructor>
- <name>DefaultConstructor</name>
- </constructor>
-
- <attribute>
- <name>ID</name>
- <type>java.lang.String</type>
- <access>read-only</access>
- </attribute>
-
- <attribute setMethod="setName" getMethod="getName">
- <name>Name</name>
- <type>java.lang.String</type>
- <access>read-write</access>
- </attribute>
-
- <attribute>
- <name>Address</name>
- <type>java.lang.String</type>
- <access>read-write</access>
- </attribute>
-
- <attribute>
- <name>PhoneNumbers</name>
- <type>[Ljava.lang.String;</type>
- <access>read-write</access>
- </attribute>
-
- <attribute>
- <name>Password</name>
- <type>java.lang.String</type>
- <access>write-only</access>
- </attribute>
-
- <operation>
- <name>printInfo</name>
- <return-type>java.lang.String</return-type>
- <impact>INFO</impact>
- </operation>
-
- <operation>
- <name>addPhoneNumber</name>
- <parameter>
- <name>number</name>
- <type>java.lang.String</type>
- </parameter>
- <return-type>void</return-type>
- <impact>ACTION</impact>
- </operation>
-
- <operation>
- <name>removePhoneNumber</name>
- <parameter>
- <name>index</name>
- <type>int</type>
- </parameter>
- <return-type>void</return-type>
- <impact>ACTION</impact>
- </operation>
-
- <operation>
- <name>setName</name>
- <parameter>
- <name>name</name>
- <type>java.lang.String</type>
- </parameter>
- <return-type>void</return-type>
- <impact>ACTION</impact>
- </operation>
-
- <operation>
- <name>getName</name>
- <return-type>java.lang.String</return-type>
- <impact>INFO</impact>
- </operation>
-
-</mbean>
-
-
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/UserManagementInterface.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.2//EN" "xmbean.dtd">
+
+<mbean>
+ <constructor>
+ <name>DefaultConstructor</name>
+ </constructor>
+
+ <attribute>
+ <name>ID</name>
+ <type>java.lang.String</type>
+ <access>read-only</access>
+ </attribute>
+
+ <attribute setMethod="setName" getMethod="getName">
+ <name>Name</name>
+ <type>java.lang.String</type>
+ <access>read-write</access>
+ </attribute>
+
+ <attribute setMethod="setAddress" getMethod="getAddress">
+ <name>Address</name>
+ <type>java.lang.String</type>
+ <access>read-write</access>
+ </attribute>
+
+ <attribute>
+ <name>PhoneNumbers</name>
+ <type>[Ljava.lang.String;</type>
+ <access>read-write</access>
+ </attribute>
+
+ <attribute>
+ <name>Password</name>
+ <type>java.lang.String</type>
+ <access>write-only</access>
+ </attribute>
+
+ <operation>
+ <name>printInfo</name>
+ <return-type>java.lang.String</return-type>
+ <impact>INFO</impact>
+ </operation>
+
+ <operation>
+ <name>addPhoneNumber</name>
+ <parameter>
+ <name>number</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ <impact>ACTION</impact>
+ </operation>
+
+ <operation>
+ <name>removePhoneNumber</name>
+ <parameter>
+ <name>index</name>
+ <type>int</type>
+ </parameter>
+ <return-type>void</return-type>
+ <impact>ACTION</impact>
+ </operation>
+
+ <operation>
+ <name>setName</name>
+ <parameter>
+ <name>name</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ <impact>ACTION</impact>
+ </operation>
+
+ <operation>
+ <name>getName</name>
+ <return-type>java.lang.String</return-type>
+ <impact>INFO</impact>
+ </operation>
+
+</mbean>
+
+
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,150 +0,0 @@
-<!-- -->
-<!-- DTD for externalizing the definition of the -->
-<!-- JMX management interfaces. -->
-<!-- -->
-<!-- Author: Juha Lindfors -->
-<!-- Author: David Jencks -->
-<!--This is the XML DTD for the JBoss 3.0 EJB deployment descriptor.
-The DOCTYPE is:
- <!DOCTYPE mbean PUBLIC
- "-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
- "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
--->
-<!-- -->
-
-<!--
- The <mbean> element is the root element of the document containing the
- required elements for describing the management interface of one
- MBean (constructors, attributes, operations and notifications). It
- also includes an optional description element that can be used to
- describe the purpose of the MBean and attributes for persistence
- policy and attribute caching.
--->
-<!ELEMENT mbean (description?, descriptors?, class, constructor*, attribute*, operation*,
- notification*)>
-
-<!--
- The constructor element describes the constructors of an MBean
- that are exposed to the management application. The optional
- description element can be used to to describe the use of the
- constructor.
--->
-<!ELEMENT constructor (description?, name, parameter*, descriptors?)>
-
-<!--
- The <attribute> element describes the management attributes of an
- MBean. The <name> element contains the attribute's name and the <type>
- element contains a fully qualified class name of the attribute's
- type.
-
--->
-<!ELEMENT attribute (description?, name, type, descriptors?)>
-<!-- access read/write access to attribute -->
-<!ATTLIST attribute access (READ | WRITE | READ_WRITE) "READ_WRITE"
- getMethod CDATA #IMPLIED
- setMethod CDATA #IMPLIED
- >
-
-<!--
- The <operation> element describes a management operation of an MBean.
- The <name> element contains the operation's name and the <parameter>
- elements describe the operation's signature. The <return-type> element
- must contain a fully qualified class name of the return type from
- this operation.
-
- If <return-type> is not specified, void is assumed.
-
--->
-<!ELEMENT operation (description?, name, parameter*, return-type?)>
-
-<!-- impact Impact of operation -->
-<!ATTLIST operation
- impact (ACTION | INFO | ACTION_INFO) "ACTION_INFO" >
-
-<!-- descriptors -->
-<!-- The <descriptors> element contains all the
- descriptors for a containing element, as
- subelements. The descriptors suggested in
- the jmx spec have predefined elements,
- whereas custom descriptors have a generic
- element. -->
-<!ELEMENT descriptors (persistence?, currencyTimeLimit?, state-action-on-update?, descriptor*)>
-
-<!-- persistence -->
-<!-- The <persistence> element contains
- descriptors for the persistPolicy,
- persistPeriod, persistLocation, and
- persistName properties suggested by the
- spec. -->
-<!ELEMENT persistence EMPTY >
-
-<!-- persistPolicy
- persistPolicy as suggested by jmx spec
- persistPeriod
- persistPeriod as suggested by jmx spec
- persistLocation
- location of persistence store.
- persistNameName of persistent data in datastore for this
- mbean -->
-<!ATTLIST persistence
- persistPolicy
- (NEVER | ONUPDATE | NOMOREOFTENTHAN | ONTIMER)
- #IMPLIED
- persistPeriod
- CDATA #IMPLIED
- persistLocation
- CDATA #IMPLIED
- persistName
- CDATA #IMPLIED >
-
-
-<!-- currency-time-limit -->
-<!-- Time that a cached value of an attribute
- remains valid. -->
-<!ELEMENT currency-time-limit
- EMPTY >
-
-<!-- value Value for currencyTimeLimit -->
-<!ATTLIST currency-time-limit
- value CDATA #IMPLIED >
-
-<!-- state-action-on-update -->
-<!-- When an attribute is updated, how much
- does the service need to be stopped? -->
-<!ELEMENT state-action-on-update
- EMPTY >
-
-
-<!-- value how much the service needs to be stopped when
- this attribute is updated -->
-<!ATTLIST state-action-on-update
- value (KEEP_RUNNING | RESTART | REINSTANTIATE) #IMPLIED>
-
-<!-- descriptor -->
-<!-- Custom descriptor element -->
-<!ELEMENT descriptor EMPTY >
-<!-- name Name of descriptor
- value value of descriptor -->
-<!ATTLIST descriptor
- name CDATA #REQUIRED
- value CDATA #REQUIRED >
-
-<!--
- The <notification> element describes a management notification. The <name>
- element contains the fully qualified name of the notification class and
- the <notification-type> element contains the dot-separated notification
- type string.
--->
-<!ELEMENT notification (description?, name, notification-type+, descriptors?)>
-
-<!ELEMENT parameter (description?, name, type)>
-
-<!ELEMENT class (#PCDATA)>
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT description (#PCDATA)>
-<!ELEMENT type (#PCDATA)>
-<!ELEMENT return-type (#PCDATA)>
-<!ELEMENT notification-type (#PCDATA)>
-
-
-
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/jboss_xmbean_1_0.dtd 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,150 @@
+<!-- -->
+<!-- DTD for externalizing the definition of the -->
+<!-- JMX management interfaces. -->
+<!-- -->
+<!-- Author: Juha Lindfors -->
+<!-- Author: David Jencks -->
+<!--This is the XML DTD for the JBoss 3.0 EJB deployment descriptor.
+The DOCTYPE is:
+ <!DOCTYPE mbean PUBLIC
+ "-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
+-->
+<!-- -->
+
+<!--
+ The <mbean> element is the root element of the document containing the
+ required elements for describing the management interface of one
+ MBean (constructors, attributes, operations and notifications). It
+ also includes an optional description element that can be used to
+ describe the purpose of the MBean and attributes for persistence
+ policy and attribute caching.
+-->
+<!ELEMENT mbean (description?, descriptors?, class, constructor*, attribute*, operation*,
+ notification*)>
+
+<!--
+ The constructor element describes the constructors of an MBean
+ that are exposed to the management application. The optional
+ description element can be used to to describe the use of the
+ constructor.
+-->
+<!ELEMENT constructor (description?, name, parameter*, descriptors?)>
+
+<!--
+ The <attribute> element describes the management attributes of an
+ MBean. The <name> element contains the attribute's name and the <type>
+ element contains a fully qualified class name of the attribute's
+ type.
+
+-->
+<!ELEMENT attribute (description?, name, type, descriptors?)>
+<!-- access read/write access to attribute -->
+<!ATTLIST attribute access (READ | WRITE | READ_WRITE) "READ_WRITE"
+ getMethod CDATA #IMPLIED
+ setMethod CDATA #IMPLIED
+ >
+
+<!--
+ The <operation> element describes a management operation of an MBean.
+ The <name> element contains the operation's name and the <parameter>
+ elements describe the operation's signature. The <return-type> element
+ must contain a fully qualified class name of the return type from
+ this operation.
+
+ If <return-type> is not specified, void is assumed.
+
+-->
+<!ELEMENT operation (description?, name, parameter*, return-type?)>
+
+<!-- impact Impact of operation -->
+<!ATTLIST operation
+ impact (ACTION | INFO | ACTION_INFO) "ACTION_INFO" >
+
+<!-- descriptors -->
+<!-- The <descriptors> element contains all the
+ descriptors for a containing element, as
+ subelements. The descriptors suggested in
+ the jmx spec have predefined elements,
+ whereas custom descriptors have a generic
+ element. -->
+<!ELEMENT descriptors (persistence?, currencyTimeLimit?, state-action-on-update?, descriptor*)>
+
+<!-- persistence -->
+<!-- The <persistence> element contains
+ descriptors for the persistPolicy,
+ persistPeriod, persistLocation, and
+ persistName properties suggested by the
+ spec. -->
+<!ELEMENT persistence EMPTY >
+
+<!-- persistPolicy
+ persistPolicy as suggested by jmx spec
+ persistPeriod
+ persistPeriod as suggested by jmx spec
+ persistLocation
+ location of persistence store.
+ persistNameName of persistent data in datastore for this
+ mbean -->
+<!ATTLIST persistence
+ persistPolicy
+ (NEVER | ONUPDATE | NOMOREOFTENTHAN | ONTIMER)
+ #IMPLIED
+ persistPeriod
+ CDATA #IMPLIED
+ persistLocation
+ CDATA #IMPLIED
+ persistName
+ CDATA #IMPLIED >
+
+
+<!-- currency-time-limit -->
+<!-- Time that a cached value of an attribute
+ remains valid. -->
+<!ELEMENT currency-time-limit
+ EMPTY >
+
+<!-- value Value for currencyTimeLimit -->
+<!ATTLIST currency-time-limit
+ value CDATA #IMPLIED >
+
+<!-- state-action-on-update -->
+<!-- When an attribute is updated, how much
+ does the service need to be stopped? -->
+<!ELEMENT state-action-on-update
+ EMPTY >
+
+
+<!-- value how much the service needs to be stopped when
+ this attribute is updated -->
+<!ATTLIST state-action-on-update
+ value (KEEP_RUNNING | RESTART | REINSTANTIATE) #IMPLIED>
+
+<!-- descriptor -->
+<!-- Custom descriptor element -->
+<!ELEMENT descriptor EMPTY >
+<!-- name Name of descriptor
+ value value of descriptor -->
+<!ATTLIST descriptor
+ name CDATA #REQUIRED
+ value CDATA #REQUIRED >
+
+<!--
+ The <notification> element describes a management notification. The <name>
+ element contains the fully qualified name of the notification class and
+ the <notification-type> element contains the dot-separated notification
+ type string.
+-->
+<!ELEMENT notification (description?, name, notification-type+, descriptors?)>
+
+<!ELEMENT parameter (description?, name, type)>
+
+<!ELEMENT class (#PCDATA)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT description (#PCDATA)>
+<!ELEMENT type (#PCDATA)>
+<!ELEMENT return-type (#PCDATA)>
+<!ELEMENT notification-type (#PCDATA)>
+
+
+
Deleted: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/xmbean.dtd
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/xmbean.dtd 2009-03-16 12:06:32 UTC (rev 85922)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/xmbean.dtd 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,93 +0,0 @@
-<!-- -->
-<!-- DTD for externalizing the definition of the -->
-<!-- JMX management interfaces. -->
-<!-- -->
-<!-- Author: Juha Lindfors -->
-<!-- -->
-
-<!--
- The <mbean> element is the root element of the document containing the
- required elements for describing the management interface of one
- MBean (constructors, attributes, operations and notifications). It
- also includes an optional description element that can be used to
- describe the purpose of the MBean and attributes for persistence
- policy and attribute caching.
--->
-<!ELEMENT mbean (description?, constructor*, attribute*, operation*,
- notification*)>
-<!ATTLIST mbean persistPolicy
- (Never | OnUpdate | NoMoreOftenThan | OnTimer) "Never"
- persistPeriod NMTOKEN #IMPLIED
- persistLocation CDATA #IMPLIED
- persistName CDATA #IMPLIED
- currencyTimeLimit NMTOKEN #IMPLIED>
-
-<!--
- The constructor element describes the constructors of an MBean
- that are exposed to the management application. The optional
- description element can be used to to describe the use of the
- constructor.
--->
-<!ELEMENT constructor (description?, name, parameter*)>
-
-<!--
- The <attribute> element describes the management attributes of an
- MBean. The <name> element contains the attribute's name and the <type>
- element contains a fully qualified class name of the attribute's
- type.
-
- The optional <access> element defines the access type (read-only,
- write-only, read-write) of this attribute. Valid values are:
- <access>read-only</access>
- <access>write-only</access>
- <access>read-write</access>
-
- If <access> element is not specified, read-write access is assumed.
--->
-<!ELEMENT attribute (description?, name, type, access?)>
-<!ATTLIST attribute persistPolicy CDATA #IMPLIED
- getMethod CDATA #IMPLIED
- setMethod CDATA #IMPLIED
- persistPeriod NMTOKEN #IMPLIED
- currencyTimeLimit NMTOKEN #IMPLIED >
-
-<!--
- The <operation> element describes a management operation of an MBean.
- The <name> element contains the operation's name and the <parameter>
- elements describe the operation's signature. The <return-type> element
- must contain a fully qualified class name of the return type from
- this operation.
-
- If <return-type> is not specified, void is assumed.
-
- The impact element describes the operation's impact on the MBean's
- state when invoked. The valid values are:
- <impact>ACTION</impact>
- <impact>INFO</impact>
- <impact>ACTION_INFO</impact>
-
- If <impact> is not specified, ACTION_INFO is assumed.
--->
-<!ELEMENT operation (description?, name, parameter*, return-type?,
- impact?)>
-
-<!--
- The <notification> element describes a management notification. The <name>
- element contains the fully qualified name of the notification class and
- the <notification-type> element contains the dot-separated notification
- type string.
--->
-<!ELEMENT notification (description?, name, notification-type+)>
-
-<!ELEMENT parameter (description?, name, type)>
-
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT description (#PCDATA)>
-<!ELEMENT type (#PCDATA)>
-<!ELEMENT access (#PCDATA)>
-<!ELEMENT impact (#PCDATA)>
-<!ELEMENT return-type (#PCDATA)>
-<!ELEMENT notification-type (#PCDATA)>
-
-
-
Copied: projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/xmbean.dtd (from rev 86127, projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/xml/xmbean.dtd)
===================================================================
--- projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/xmbean.dtd (rev 0)
+++ projects/jbossmx/trunk/jmx/src/resources/test/test/implementation/modelmbean/support/xml/xmbean.dtd 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,93 @@
+<!-- -->
+<!-- DTD for externalizing the definition of the -->
+<!-- JMX management interfaces. -->
+<!-- -->
+<!-- Author: Juha Lindfors -->
+<!-- -->
+
+<!--
+ The <mbean> element is the root element of the document containing the
+ required elements for describing the management interface of one
+ MBean (constructors, attributes, operations and notifications). It
+ also includes an optional description element that can be used to
+ describe the purpose of the MBean and attributes for persistence
+ policy and attribute caching.
+-->
+<!ELEMENT mbean (description?, constructor*, attribute*, operation*,
+ notification*)>
+<!ATTLIST mbean persistPolicy
+ (Never | OnUpdate | NoMoreOftenThan | OnTimer) "Never"
+ persistPeriod NMTOKEN #IMPLIED
+ persistLocation CDATA #IMPLIED
+ persistName CDATA #IMPLIED
+ currencyTimeLimit NMTOKEN #IMPLIED>
+
+<!--
+ The constructor element describes the constructors of an MBean
+ that are exposed to the management application. The optional
+ description element can be used to to describe the use of the
+ constructor.
+-->
+<!ELEMENT constructor (description?, name, parameter*)>
+
+<!--
+ The <attribute> element describes the management attributes of an
+ MBean. The <name> element contains the attribute's name and the <type>
+ element contains a fully qualified class name of the attribute's
+ type.
+
+ The optional <access> element defines the access type (read-only,
+ write-only, read-write) of this attribute. Valid values are:
+ <access>read-only</access>
+ <access>write-only</access>
+ <access>read-write</access>
+
+ If <access> element is not specified, read-write access is assumed.
+-->
+<!ELEMENT attribute (description?, name, type, access?)>
+<!ATTLIST attribute persistPolicy CDATA #IMPLIED
+ getMethod CDATA #IMPLIED
+ setMethod CDATA #IMPLIED
+ persistPeriod NMTOKEN #IMPLIED
+ currencyTimeLimit NMTOKEN #IMPLIED >
+
+<!--
+ The <operation> element describes a management operation of an MBean.
+ The <name> element contains the operation's name and the <parameter>
+ elements describe the operation's signature. The <return-type> element
+ must contain a fully qualified class name of the return type from
+ this operation.
+
+ If <return-type> is not specified, void is assumed.
+
+ The impact element describes the operation's impact on the MBean's
+ state when invoked. The valid values are:
+ <impact>ACTION</impact>
+ <impact>INFO</impact>
+ <impact>ACTION_INFO</impact>
+
+ If <impact> is not specified, ACTION_INFO is assumed.
+-->
+<!ELEMENT operation (description?, name, parameter*, return-type?,
+ impact?)>
+
+<!--
+ The <notification> element describes a management notification. The <name>
+ element contains the fully qualified name of the notification class and
+ the <notification-type> element contains the dot-separated notification
+ type string.
+-->
+<!ELEMENT notification (description?, name, notification-type+)>
+
+<!ELEMENT parameter (description?, name, type)>
+
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT description (#PCDATA)>
+<!ELEMENT type (#PCDATA)>
+<!ELEMENT access (#PCDATA)>
+<!ELEMENT impact (#PCDATA)>
+<!ELEMENT return-type (#PCDATA)>
+<!ELEMENT notification-type (#PCDATA)>
+
+
+
Copied: projects/jbossmx/trunk/jmx/src/test/org (from rev 85922, projects/jbossmx/trunk/j2se/src/tests/org)
Copied: projects/jbossmx/trunk/jmx/src/test/org/jboss (from rev 86127, projects/jbossmx/trunk/j2se/src/tests/org/jboss)
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/ComplianceSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/ComplianceSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/ComplianceSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -51,7 +51,7 @@
try
{
// Support for RI tracing, use -Dcom.sun.jmx.trace.level=x where x is one of 0, 1 or 2
- Class trace = Thread.currentThread().getContextClassLoader().loadClass("com.sun.jmx.trace.TraceImplementation");
+ Class<?> trace = Thread.currentThread().getContextClassLoader().loadClass("com.sun.jmx.trace.TraceImplementation");
java.lang.reflect.Method init = trace.getMethod("init", new Class[] { Integer.TYPE });
init.invoke(null, new Object[] { new Integer(System.getProperty("com.sun.jmx.trace.level")) });
}
@@ -66,19 +66,12 @@
{
TestSuite suite = new TestSuite("All Compliance Tests");
- suite.addTest(org.jboss.test.jmx.compliance.objectname.ObjectNameSUITE.suite());
suite.addTest(org.jboss.test.jmx.compliance.standard.StandardSUITE.suite());
suite.addTest(org.jboss.test.jmx.compliance.registration.RegistrationSUITE.suite());
suite.addTest(org.jboss.test.jmx.compliance.server.ServerSUITE.suite());
suite.addTest(org.jboss.test.jmx.compliance.modelmbean.ModelMBeanSUITE.suite());
suite.addTest(org.jboss.test.jmx.compliance.notcompliant.NCMBeanSUITE.suite());
- suite.addTest(org.jboss.test.jmx.compliance.loading.LoadingSUITE.suite());
- suite.addTest(org.jboss.test.jmx.compliance.varia.VariaSUITE.suite());
suite.addTest(org.jboss.test.jmx.compliance.query.QuerySUITE.suite());
- suite.addTest(org.jboss.test.jmx.compliance.metadata.MetaDataSUITE.suite());
- suite.addTest(org.jboss.test.jmx.compliance.relation.RelationSUITE.suite());
- suite.addTest(org.jboss.test.jmx.compliance.openmbean.OpenMBeanSUITE.suite());
- suite.addTest(org.jboss.test.jmx.compliance.notification.NotificationSUITE.suite());
return suite;
}
}
Deleted: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/FullComplianceSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/FullComplianceSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/FullComplianceSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jmx.compliance;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * This suite includes the timer and monitoring tests that take
- * a while to run.
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- */
-
-public class FullComplianceSUITE extends TestSuite
-{
- public static void main(String[] args)
- {
- junit.textui.TestRunner.run(suite());
- }
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite("All Compliance Tests");
-
- suite.addTest(org.jboss.test.jmx.compliance.ComplianceSUITE.suite());
- suite.addTest(org.jboss.test.jmx.compliance.monitor.MonitorSUITE.suite());
- suite.addTest(org.jboss.test.jmx.compliance.timer.TimerSUITE.suite());
-
- return suite;
- }
-}
Deleted: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/DescriptorTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/modelmbean/DescriptorTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/DescriptorTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,1103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jmx.compliance.modelmbean;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import javax.management.RuntimeOperationsException;
-import javax.management.modelmbean.DescriptorSupport;
-
-/**
- * Tests the standard required <tt>DescriptorSupport</tt> implementation.
- *
- * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- * @version $Revision$
- */
-public class DescriptorTEST
- extends TestCase
-{
- public DescriptorTEST(String s)
- {
- super(s);
- }
-
- // Tests ------------------------------------------------------------
-
- public void testDefaultConstructor()
- throws Exception
- {
- DescriptorSupport descriptor = new DescriptorSupport();
- assertTrue("Should be empty", descriptor.getFields().length == 0);
- assertFalse("Should not be valid", descriptor.isValid());
- }
-
- public void testSizeConstructor()
- throws Exception
- {
- DescriptorSupport descriptor = new DescriptorSupport(100);
- assertTrue("Should be empty", descriptor.getFields().length == 0);
- assertFalse("Should not be valid", descriptor.isValid());
-
- boolean caught = false;
- try
- {
- descriptor = new DescriptorSupport(-1);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for a negative size", caught);
- }
-
- public void testCopyConstructor()
- throws Exception
- {
- DescriptorSupport descriptor = new DescriptorSupport((DescriptorSupport) null);
- assertTrue("Should be empty", descriptor.getFields().length == 0);
- assertFalse("Should not be valid", descriptor.isValid());
-
- descriptor = new DescriptorSupport(descriptor);
- assertTrue("Should be empty", descriptor.getFields().length == 0);
- assertFalse("Should not be valid", descriptor.isValid());
-
- descriptor.setField("name", "testName");
- descriptor.setField("descriptorType", "testType");
- descriptor = new DescriptorSupport(descriptor);
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
- assertTrue("Should be valid", descriptor.isValid());
- }
-
- public void testNamesValuesConstructor()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType" };
- Object[] values = new Object[] { "testName", "testType" };
- DescriptorSupport descriptor = new DescriptorSupport(names, values);
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
- assertTrue("Should be valid", descriptor.isValid());
-
- descriptor = new DescriptorSupport(new String[0], new Object[0]);
- assertTrue("Should be empty", descriptor.getFields().length == 0);
- assertFalse("Should not be valid", descriptor.isValid());
-
- boolean caught = false;
- try
- {
- descriptor = new DescriptorSupport(null, null);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null names and values", caught);
-
- caught = false;
- try
- {
- descriptor = new DescriptorSupport(null, values);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null names", caught);
-
- caught = false;
- try
- {
- descriptor = new DescriptorSupport(names, null);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null values", caught);
-
- Object[] tooManyValues = new Object[] { "testName", "testType", "tooMany" };
- caught = false;
- try
- {
- descriptor = new DescriptorSupport(names, tooManyValues);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for too many values", caught);
-
- Object[] tooFewValues = new Object[] { "testName" };
- caught = false;
- try
- {
- descriptor = new DescriptorSupport(names, tooFewValues);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for too few values", caught);
-
- String[] nullName = new String[] { "name", null };
- caught = false;
- try
- {
- descriptor = new DescriptorSupport(nullName, values);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null name", caught);
-
- String[] emptyName = new String[] { "name", "" };
- caught = false;
- try
- {
- descriptor = new DescriptorSupport(emptyName, values);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for empty name ", caught);
-
- // This is legal?
- String[] notEmptyName = new String[] { "name", " " };
- descriptor = new DescriptorSupport(notEmptyName, values);
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue(" "));
- assertFalse("Should not be valid", descriptor.isValid());
-
- names = new String[] { "name", "descriptorType", "another" };
- values = new Object[] { "testName", "testType", null };
- descriptor = new DescriptorSupport(names, values);
- assertTrue("Should be three fields", descriptor.getFields().length == 3);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
- assertTrue("another should be null", descriptor.getFieldValue("another") == null);
- assertTrue("Should be valid", descriptor.isValid());
- }
-
- public void testNameEqualsValueConstructor()
- throws Exception
- {
- String[] fields = new String[] { "name=testName", "descriptorType=testType" };
- DescriptorSupport descriptor = new DescriptorSupport(fields);
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
- assertTrue("Should be valid", descriptor.isValid());
-
- descriptor = new DescriptorSupport((String[]) null);
- assertTrue("Should be empty", descriptor.getFields().length == 0);
- assertFalse("Should not be valid", descriptor.isValid());
-
- descriptor = new DescriptorSupport(new String[0]);
- assertTrue("Should be empty", descriptor.getFields().length == 0);
- assertFalse("Should not be valid", descriptor.isValid());
-
- String[] nullName = new String[] { "name=testName", "=rubbish" };
- boolean caught = false;
- try
- {
- descriptor = new DescriptorSupport(nullName);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for '=rubbish'", caught);
-
- // This is legal?
- String[] notEmptyName = new String[] { "name=testName", " =rubbish" };
- descriptor = new DescriptorSupport(notEmptyName);
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("rubbish", descriptor.getFieldValue(" "));
- assertFalse("Should not be valid", descriptor.isValid());
- }
-
- public void testNameEqualsValueConstructorError()
- throws Exception
- {
- try
- {
- String[] fields = new String[] { "name=testName", "descriptorType=testType", "another=" };
- DescriptorSupport descriptor = new DescriptorSupport(fields);
- assertTrue("Should be three fields", descriptor.getFields().length == 3);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
- assertTrue("another should be null", descriptor.getFieldValue("another") == null);
- assertTrue("Should be valid", descriptor.isValid());
- }
- catch (Exception e)
- {
- fail("FAILS IN RI: 'another=' should be valid according to the javadoc " + e.toString());
- }
- }
-
- public void testGetFieldValue()
- throws Exception
- {
- String[] fields = new String[] { "name=testName", "descriptorType=testType" };
- DescriptorSupport descriptor = new DescriptorSupport(fields);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertTrue("Field names are not case sensitive", "testName".equals(descriptor.getFieldValue("NAME")));
- assertTrue("Non existent field should be null", descriptor.getFieldValue("nonExistent") == null);
-
- boolean caught = false;
- try
- {
- descriptor.getFieldValue(null);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null name", caught);
-
- caught = false;
- try
- {
- descriptor.getFieldValue("");
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for empty name", caught);
-
- // This is legal?
- assertTrue("Blank field name is allowed", descriptor.getFieldValue(" ") == null);
- }
-
- public void testSetFieldValue()
- throws Exception
- {
- String[] fields = new String[] { "name=testName", "descriptorType=testType" };
- DescriptorSupport descriptor = new DescriptorSupport(fields);
- assertEquals("testName", descriptor.getFieldValue("name"));
- descriptor.setField("name", "newName");
- assertEquals("newName", descriptor.getFieldValue("name"));
- descriptor.setField("NAME", "newNAME");
- assertEquals("newNAME", descriptor.getFieldValue("name"));
-
- boolean caught = false;
- try
- {
- descriptor.setField(null, "null");
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null name", caught);
-
- caught = false;
- try
- {
- descriptor.setField("", "empty");
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for empty name", caught);
-
- // This is legal?
- descriptor.setField(" ", "blank");
- assertEquals("blank", descriptor.getFieldValue(" "));
-
- descriptor.setField("newField", "newValue");
- assertEquals("newValue", descriptor.getFieldValue("newField"));
- }
-
- public void testGetFields()
- throws Exception
- {
- String[] fields = new String[] { "name=testName", "descriptorType=testType" };
- DescriptorSupport descriptor = new DescriptorSupport(fields);
- String[] getFields = descriptor.getFields();
- compareFields(fields, getFields);
- }
-
- public void testGetFieldNames()
- throws Exception
- {
- String[] fields = new String[] { "name=testName", "descriptorType=testType" };
- DescriptorSupport descriptor = new DescriptorSupport(fields);
- String[] names = descriptor.getFieldNames();
- compareFieldNames(fields, names);
- }
-
- public void testGetFieldValues()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType" };
- String[] values = new String[] { "testName", "testType" };
- DescriptorSupport descriptor = new DescriptorSupport(names, values);
-
- Object[] result = descriptor.getFieldValues(null);
- compareFieldValuesUnsorted(values, result);
-
- result = descriptor.getFieldValues(new String[0]);
- compareFieldValues(new Object[0], result);
-
- result = descriptor.getFieldValues(names);
- compareFieldValues(values, result);
-
- result = descriptor.getFieldValues(new String[] { "name" });
- compareFieldValues(new Object[] { "testName" }, result);
-
- result = descriptor.getFieldValues(new String[] { "descriptorType", "name" });
- compareFieldValues(new Object[] { "testType", "testName" }, result);
-
- result = descriptor.getFieldValues(new String[] { "NAME" });
- compareFieldValues(new Object[] { "testName" }, result);
-
- result = descriptor.getFieldValues(new String[] { null });
- compareFieldValues(new Object[] { null }, result);
-
- result = descriptor.getFieldValues(new String[] { "" });
- compareFieldValues(new Object[] { null }, result);
- }
-
- public void testSetFieldValues()
- throws Exception
- {
- DescriptorSupport descriptor = new DescriptorSupport();
- String[] names = new String[] { "name", "descriptorType" };
- Object[] values = new Object[] { "testName", "testType" };
- descriptor.setFields(names, values);
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
- assertTrue("Should be valid", descriptor.isValid());
-
- descriptor = new DescriptorSupport();
- descriptor.setFields(new String[0], new Object[0]);
- assertTrue("Should be empty", descriptor.getFields().length == 0);
- assertFalse("Should not be valid", descriptor.isValid());
-
- boolean caught = false;
- try
- {
- descriptor = new DescriptorSupport();
- descriptor.setFields(null, null);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null names and values", caught);
-
- caught = false;
- try
- {
- descriptor = new DescriptorSupport();
- descriptor.setFields(null, values);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null names", caught);
-
- caught = false;
- try
- {
- descriptor = new DescriptorSupport();
- descriptor.setFields(names, null);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null values", caught);
-
- Object[] tooManyValues = new Object[] { "testName", "testType", "tooMany" };
- caught = false;
- try
- {
- descriptor = new DescriptorSupport();
- descriptor.setFields(names, tooManyValues);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for too many values", caught);
-
- Object[] tooFewValues = new Object[] { "testName" };
- caught = false;
- try
- {
- descriptor = new DescriptorSupport();
- descriptor.setFields(names, tooFewValues);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for too few values", caught);
-
- String[] nullName = new String[] { "name", null };
- caught = false;
- try
- {
- descriptor = new DescriptorSupport();
- descriptor.setFields(nullName, values);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for null name", caught);
-
- String[] emptyName = new String[] { "name", "" };
- caught = false;
- try
- {
- descriptor = new DescriptorSupport();
- descriptor.setFields(emptyName, values);
- }
- catch (RuntimeOperationsException e)
- {
- caught = true;
- }
- assertTrue("Expected an exception for empty name ", caught);
-
- // This is legal?
- String[] notEmptyName = new String[] { "name", " " };
- descriptor = new DescriptorSupport();
- descriptor.setFields(notEmptyName, values);
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue(" "));
- assertFalse("Should not be valid", descriptor.isValid());
-
- names = new String[] { "name", "descriptorType", "another" };
- values = new Object[] { "testName", "testType", null };
- descriptor = new DescriptorSupport();
- descriptor.setFields(names, values);
- assertTrue("Should be three fields", descriptor.getFields().length == 3);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
- assertTrue("another should be null", descriptor.getFieldValue("another") == null);
- assertTrue("Should be valid", descriptor.isValid());
- }
-
- public void testClone()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType" };
- Object[] values = new Object[] { "testName", "testType" };
- DescriptorSupport descriptor = new DescriptorSupport(names, values);
-
- DescriptorSupport clone = (DescriptorSupport) descriptor.clone();
- compareFields(descriptor.getFields(), clone.getFields());
- }
-
- public void testRemove()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType" };
- Object[] values = new Object[] { "testName", "testType" };
- DescriptorSupport descriptor = new DescriptorSupport(names, values);
-
- descriptor.removeField("name");
- assertTrue("Should be one field", descriptor.getFields().length == 1);
- assertTrue("name should not be present", descriptor.getFieldValue("name") == null);
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
-
- descriptor = new DescriptorSupport(names, values);
- descriptor.removeField("NAME");
- assertTrue("Should be one field", descriptor.getFields().length == 1);
- assertTrue("name should not be present", descriptor.getFieldValue("name") == null);
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
-
- descriptor = new DescriptorSupport(names, values);
- descriptor.removeField("notPresent");
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
-
- descriptor.removeField(null);
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
-
- descriptor.removeField("");
- assertTrue("Should be two fields", descriptor.getFields().length == 2);
- assertEquals("testName", descriptor.getFieldValue("name"));
- assertEquals("testType", descriptor.getFieldValue("descriptorType"));
- }
-
- public void testIsValidMandatory()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType" };
- Object[] values = new Object[] { "testName", "testType" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType" };
- values = new Object[] { null, "testType" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType" };
- values = new Object[] { "", "testType" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType" };
- values = new Object[] { "testName", null };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType" };
- values = new Object[] { "testName", "" };
- validate(names, values, false);
- }
-
- public void testIsValidRole()
- throws Exception
- {
- doTestString("role", "operation");
- }
-
- public void testIsValidGetMethod()
- throws Exception
- {
- doTestString("getMethod", "getSomething");
- }
-
- public void testIsValidSetMethod()
- throws Exception
- {
- doTestString("setMethod", "setSomething");
- }
-
- public void testIsValidPersistPeriod()
- throws Exception
- {
- doTestInteger("persistPeriod");
- }
-
- public void testIsValidCurrencyTimeLimit()
- throws Exception
- {
- doTestInteger("currencyTimeLimit");
- }
-
- public void testIsValidLastUpdateTimeStamp()
- throws Exception
- {
- doTestInteger("lastUpdatedTimeStamp");
- }
-
- public void testIsValidLog()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType", "log" };
- Object[] values = new Object[] { "testName", "testType", "true" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "false" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "t" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "f" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "TRUE" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "FALSE" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "T" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "F" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", null };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "log" };
- values = new Object[] { "testName", "testType", "rubbish" };
- validate(names, values, false);
- }
-
- public void testIsValidVisibility()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType", "visibility" };
- Object[] values = new Object[] { "testName", "testType", "1" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", "2" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", "3" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", "4" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", "0" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", "5" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", new Integer(1) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", new Integer(2) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", new Integer(3) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", new Integer(4) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", new Integer(0) };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", new Integer(6) };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", null };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "visibility" };
- values = new Object[] { "testName", "testType", "" };
- validate(names, values, false);
- }
-
- public void testIsValidSeverity()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType", "severity" };
- Object[] values = new Object[] { "testName", "testType", "1" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", "2" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", "3" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", "4" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", "5" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", new Integer(1) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", new Integer(2) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", new Integer(3) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", new Integer(4) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", new Integer(5) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", null };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", "" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", "0" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", "7" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", new Integer(0) };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", new Integer(7) };
- validate(names, values, false);
- }
-
- public void testIsValidError()
- throws Exception
- {
- try
- {
- String[] names = new String[] { "name", "descriptorType", "severity" };
- Object[] values = new Object[] { "testName", "testType", "6" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "severity" };
- values = new Object[] { "testName", "testType", new Integer(6) };
- validate(names, values, true);
- }
- catch (Exception e)
- {
- fail("FAILS IN RI: javadoc and spec are inconsistent on whether severity=6 is valid");
- }
- }
-
- public void testIsValidPersistPolicy()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType", "persistPolicy" };
- Object[] values = new Object[] { "testName", "testType", "onUpdate" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "persistPolicy" };
- values = new Object[] { "testName", "testType", "noMoreOftenThan" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "persistPolicy" };
- values = new Object[] { "testName", "testType", "never" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "persistPolicy" };
- values = new Object[] { "testName", "testType", "onTimer" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", "persistPolicy" };
- values = new Object[] { "testName", "testType", null };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "persistPolicy" };
- values = new Object[] { "testName", "testType", "" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", "persistPolicy" };
- values = new Object[] { "testName", "testType", "rubbish" };
- validate(names, values, false);
- }
-
- public void testSerialization()
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType" };
- Object[] values = new Object[] { "testName", "testType" };
- DescriptorSupport descriptor = new DescriptorSupport(names, values);
-
- // Serialize it
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(descriptor);
-
- // Deserialize it
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- ObjectInputStream ois = new ObjectInputStream(bais);
- Object result = ois.readObject();
-
- compareFields(descriptor.getFields(), ((DescriptorSupport) result).getFields());
- }
-
- // Support -------------------------------------------
-
- private void doTestString(String field, String value)
- throws Exception
- {
- String[] names = new String[] { "name", "descriptorType", field };
- Object[] values = new Object[] { "testName", "testType", value };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", null };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", "" };
- validate(names, values, false);
- }
-
- public void doTestInteger(String field)
- {
- String[] names = new String[] { "name", "descriptorType", field };
- Object[] values = new Object[] { "testName", "testType", "0" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", "-1" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", "100" };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", "-2" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", null };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", "" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", "rubbish" };
- validate(names, values, false);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", new Integer(0) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", new Integer(-1) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", new Integer(100) };
- validate(names, values, true);
-
- names = new String[] { "name", "descriptorType", field };
- values = new Object[] { "testName", "testType", new Integer(-2) };
- validate(names, values, false);
- }
-
- private void validate(String[] names, Object[] values, boolean valid)
- {
- DescriptorSupport descriptor = null;
- RuntimeOperationsException caught = null;
- boolean descriptorValid = false;
- try
- {
- descriptor = new DescriptorSupport(names, values);
- descriptorValid = descriptor.isValid();
- }
- catch (RuntimeOperationsException e)
- {
- caught = e;
- }
- if (valid && caught != null)
- throw caught;
- assertEquals("Expected "+ valid + " for new Descriptor(String[], String[]) names=" +
- Arrays.asList(names) + " values=" + Arrays.asList(values), valid, descriptorValid);
-
- caught = null;
- descriptorValid = false;
- try
- {
- String[] fields = new String[names.length];
- for (int i = 0; i < fields.length; i++)
- {
- if (values[i] == null)
- fields[i] = names[i] + "=";
- else
- fields[i] = names[i] + "=" + values[i].toString();
- }
- descriptor = new DescriptorSupport(names, values);
- descriptorValid = descriptor.isValid();
- }
- catch (RuntimeOperationsException e)
- {
- caught = e;
- }
- if (valid && caught != null)
- throw caught;
- assertEquals("Expected "+ valid + " for new Descriptor(String[], String[]) names=" +
- Arrays.asList(names) + " values=" + Arrays.asList(values), valid, descriptorValid);
-
- caught = null;
- descriptorValid = false;
- try
- {
- descriptor = new DescriptorSupport();
- for (int i = 0; i < names.length; i++)
- descriptor.setField(names[i], values[i]);
- descriptorValid = descriptor.isValid();
- }
- catch (RuntimeOperationsException e)
- {
- caught = e;
- }
- if (valid && caught != null)
- throw caught;
- assertEquals("Expected "+ valid + " for new Descriptor(String[], String[]) names=" +
- Arrays.asList(names) + " values=" + Arrays.asList(values), valid, descriptorValid);
-
- caught = null;
- descriptorValid = false;
- try
- {
- descriptor = new DescriptorSupport();
- descriptor.setFields(names, values);
- descriptorValid = descriptor.isValid();
- }
- catch (RuntimeOperationsException e)
- {
- caught = e;
- }
- if (valid && caught != null)
- throw caught;
- assertEquals("Expected "+ valid + " for new Descriptor(String[], String[]) names=" +
- Arrays.asList(names) + " values=" + Arrays.asList(values), valid, descriptorValid);
- }
-
- private void compareFieldNames(String[] one, String[] two)
- throws Exception
- {
- Set setOne = makeMap(one).keySet();
- List setTwo = new ArrayList(Arrays.asList(two));
- for (Iterator i = setOne.iterator(); i.hasNext(); )
- {
- Object key = i.next();
- if (setTwo.remove(key) == false)
- fail("Expected " + Arrays.asList(two) + " to contain field " + key);
- }
- assertTrue("Didn't expect the following fields " + setTwo, setTwo.isEmpty());
- }
-
- private void compareFieldValuesUnsorted(Object[] one, Object[] two)
- throws Exception
- {
- if (one.length != two.length)
- fail("Lengths are different original=" + Arrays.asList(one) + " result=" + Arrays.asList(two));
-
- List listOne = Arrays.asList(one);
- List listTwo = new ArrayList(Arrays.asList(two));
- for (Iterator i = listOne.iterator(); i.hasNext();)
- {
- Object value = i.next();
- if (listTwo.remove(value) == false)
- fail("Expected " + two + " to contain " + value);
- }
- assertTrue("Didn't expect the following fields " + listTwo, listTwo.isEmpty());
- }
-
- private void compareFieldValues(Object[] one, Object[] two)
- throws Exception
- {
- if (one.length != two.length)
- fail("Lengths are different original=" + Arrays.asList(one) + " result=" + Arrays.asList(two));
- for (int i = 0; i < one.length; i++)
- {
- if (one[i] == null && two[i] != null)
- fail("For index " + i + " original=" + one[i] + " result=" + two[i]);
- else if (one[i] != null && two[i] == null)
- fail("For index " + i + " original=" + one[i] + " result=" + two[i]);
- else if (one[i] != null && one[i].equals(two[i]) == false)
- fail("For index " + i + " original=" + one[i] + " result=" + two[i]);
- }
- }
-
- private void compareFields(String[] one, String[] two)
- throws Exception
- {
- Map mapOne = makeMap(one);
- Map mapTwo = makeMap(two);
- for (Iterator i = mapOne.entrySet().iterator(); i.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) i.next();
- Object key = entry.getKey();
- Object value = entry.getValue();
- if (value.equals(mapTwo.remove(key)) == false)
- fail("Expected " + Arrays.asList(two) + " to contain field " + key);
- }
- assertTrue("Didn't expect the following fields " + mapTwo, mapTwo.isEmpty());
- }
-
- private Map makeMap(String[] fields)
- throws Exception
- {
- HashMap result = new HashMap(fields.length);
- for (int i = 0; i < fields.length; i++)
- {
- int index = fields[i].indexOf("=");
- String key = fields[i].substring(0, index);
- String value = null;
- if (index != fields[i].length()-1)
- value = fields[i].substring(index);
- result.put(key, value);
- }
- return result;
- }
-}
Deleted: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanInfoSupportTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanInfoSupportTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanInfoSupportTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,289 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.jmx.compliance.modelmbean;
-
-import javax.management.Descriptor;
-import javax.management.MBeanOperationInfo;
-import javax.management.modelmbean.ModelMBeanAttributeInfo;
-import javax.management.modelmbean.ModelMBeanConstructorInfo;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.ModelMBeanInfoSupport;
-import javax.management.modelmbean.ModelMBeanOperationInfo;
-import javax.management.modelmbean.RequiredModelMBean;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
-
-public class ModelMBeanInfoSupportTEST extends TestCase
-{
- public ModelMBeanInfoSupportTEST(String s)
- {
- super(s);
- }
-
- public void testSetDescriptors() throws Exception
- {
- final boolean READABLE = true;
- final boolean WRITABLE = true;
- final boolean ISIS = true;
-
- RequiredModelMBean mbean = new RequiredModelMBean();
-
- ModelMBeanAttributeInfo attr1 = new ModelMBeanAttributeInfo(
- "Kissa",
- String.class.getName(),
- "Some attribute description",
- !READABLE, !WRITABLE, !ISIS
- );
-
- ModelMBeanAttributeInfo attr2 = new ModelMBeanAttributeInfo(
- "Koira",
- String.class.getName(),
- "Another attribute description",
- !READABLE, !WRITABLE, !ISIS
- );
-
- ModelMBeanConstructorInfo constr1 = new ModelMBeanConstructorInfo(
- "FirstConstructor",
- "Description of the first constructor",
- null
- );
-
- ModelMBeanConstructorInfo constr2 = new ModelMBeanConstructorInfo(
- "SecondConstructor",
- "Description of the second constructor",
- null
- );
-
- ModelMBeanConstructorInfo constr3 = new ModelMBeanConstructorInfo(
- "ThirdConstructor",
- "Description of the 3rd constructor",
- null
- );
-
- ModelMBeanOperationInfo operation = new ModelMBeanOperationInfo(
- "AnOperation",
- "The description",
- null,
- "AType",
- MBeanOperationInfo.ACTION
- );
-
- ModelMBeanInfoSupport info = new ModelMBeanInfoSupport(
- mbean.getClass().getName(),
- "some description",
- new ModelMBeanAttributeInfo[] { attr1, attr2 },
- new ModelMBeanConstructorInfo[] { constr1, constr2, constr3 },
- new ModelMBeanOperationInfo[] { operation },
- null
- );
-
- Descriptor descr1 = info.getDescriptor("SecondConstructor", "constructor");
-
- assertEquals("SecondConstructor", descr1.getFieldValue("name"));
- assertEquals("constructor", descr1.getFieldValue("role"));
-
- Descriptor descr2 = null;
-
- Descriptor[] descr3 = info.getDescriptors("operation");
-
- assertEquals("operation", descr3[0].getFieldValue("descriptorType"));
- assertEquals("AnOperation", descr3[0].getFieldValue("name"));
-
- descr1.setField("someField", "someValue");
- descr3[0].setField("Yksi", "Kaksi");
-
- info.setDescriptors(new Descriptor[] { descr1, descr2, descr3[0] });
-
- descr1 = info.getDescriptor("SecondConstructor", "constructor");
- assertEquals("SecondConstructor", descr1.getFieldValue("name"));
- assertEquals("constructor", descr1.getFieldValue("role"));
- assertEquals("FAILS IN JBOSSMX", "someValue", descr1.getFieldValue("someField"));
-
- descr1 = info.getDescriptor("AnOperation", "operation");
-
- assertEquals("AnOperation", descr1.getFieldValue("name"));
- assertEquals("Kaksi", descr1.getFieldValue("Yksi"));
-
- }
-
- public void testGetDescriptor() throws Exception
- {
- final boolean READABLE = true;
- final boolean WRITABLE = true;
- final boolean ISIS = true;
-
- RequiredModelMBean mbean = new RequiredModelMBean();
-
- ModelMBeanAttributeInfo attr1 = new ModelMBeanAttributeInfo(
- "Kissa",
- String.class.getName(),
- "Some attribute description",
- !READABLE, !WRITABLE, !ISIS
- );
-
- ModelMBeanAttributeInfo attr2 = new ModelMBeanAttributeInfo(
- "Koira",
- String.class.getName(),
- "Another attribute description",
- !READABLE, !WRITABLE, !ISIS
- );
-
- ModelMBeanConstructorInfo constr1 = new ModelMBeanConstructorInfo(
- "FirstConstructor",
- "Description of the first constructor",
- null
- );
-
- ModelMBeanConstructorInfo constr2 = new ModelMBeanConstructorInfo(
- "SecondConstructor",
- "Description of the second constructor",
- null
- );
-
- ModelMBeanConstructorInfo constr3 = new ModelMBeanConstructorInfo(
- "ThirdConstructor",
- "Description of the 3rd constructor",
- null
- );
-
- ModelMBeanOperationInfo operation = new ModelMBeanOperationInfo(
- "AnOperation",
- "The description",
- null,
- "AType",
- MBeanOperationInfo.ACTION
- );
-
- ModelMBeanInfoSupport info = new ModelMBeanInfoSupport(
- mbean.getClass().getName(),
- "some description",
- new ModelMBeanAttributeInfo[] { attr1, attr2 },
- new ModelMBeanConstructorInfo[] { constr1, constr2, constr3 },
- new ModelMBeanOperationInfo[] { operation },
- null
- );
-
- Descriptor descr = info.getDescriptor("SecondConstructor", "constructor");
-
- try
- {
- assertTrue(descr.getFieldValue("descriptorType").equals("operation"));
- }
- catch (AssertionFailedError e)
- {
- throw new AssertionFailedError(
- "FAILS IN JBOSSMX: We incorrectly return descriptor type " +
- "'constructor' here -- should be 'operation'"
- );
- }
-
- }
-
-
- public void testClone() throws Exception
- {
- final boolean READABLE = true;
- final boolean WRITABLE = true;
- final boolean ISIS = true;
-
- RequiredModelMBean mbean = new RequiredModelMBean();
-
- ModelMBeanAttributeInfo attr1 = new ModelMBeanAttributeInfo(
- "Kissa",
- String.class.getName(),
- "Some attribute description",
- !READABLE, !WRITABLE, !ISIS
- );
-
- ModelMBeanAttributeInfo attr2 = new ModelMBeanAttributeInfo(
- "Koira",
- String.class.getName(),
- "Another attribute description",
- !READABLE, !WRITABLE, !ISIS
- );
-
- ModelMBeanConstructorInfo constr1 = new ModelMBeanConstructorInfo(
- "FirstConstructor",
- "Description of the first constructor",
- null
- );
-
- ModelMBeanConstructorInfo constr2 = new ModelMBeanConstructorInfo(
- "SecondConstructor",
- "Description of the second constructor",
- null
- );
-
- ModelMBeanConstructorInfo constr3 = new ModelMBeanConstructorInfo(
- "ThirdConstructor",
- "Description of the 3rd constructor",
- null
- );
-
- ModelMBeanOperationInfo operation = new ModelMBeanOperationInfo(
- "AnOperation",
- "The description",
- null,
- "AType",
- MBeanOperationInfo.ACTION
- );
-
- ModelMBeanInfoSupport info = new ModelMBeanInfoSupport(
- mbean.getClass().getName(),
- "some description",
- new ModelMBeanAttributeInfo[] { attr1, attr2 },
- new ModelMBeanConstructorInfo[] { constr1, constr2, constr3 },
- new ModelMBeanOperationInfo[] { operation },
- null
- );
-
- ModelMBeanInfo clone = (ModelMBeanInfo)info.clone();
-
- assertTrue(clone.getDescriptors(null).length == info.getDescriptors(null).length);
-
- // FIXME: equality not implemented to match field, value pairs
- //assertTrue(clone.getDescriptor("FirstConstructor", "constructor")
- // .equals(
- // info.getDescriptor("FirstConstructor", "constructor"))
- //);
-
- assertTrue(
- clone.getDescriptor("AnOperation", "operation")
- .getFieldValue("descriptorType")
- .equals(
- info.getDescriptor("AnOperation", "operation")
- .getFieldValue("descriptorType"))
- );
-
- assertTrue(
- clone.getDescriptor("AnOperation", "operation")
- .getFieldValue("name")
- .equals(
- info.getDescriptor("AnOperation", "operation")
- .getFieldValue("name"))
- );
-
- }
-
-}
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,9 +35,7 @@
{
TestSuite suite = new TestSuite("All ModelMBean Related Tests");
- suite.addTest(new TestSuite(DescriptorTEST.class));
- suite.addTest(new TestSuite(ModelMBeanTEST.class));
- suite.addTest(new TestSuite(ModelMBeanInfoSupportTEST.class));
+ suite.addTest(ModelMBeanTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/modelmbean/ModelMBeanTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -22,13 +22,13 @@
package org.jboss.test.jmx.compliance.modelmbean;
import javax.management.Descriptor;
+import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
+import javax.management.Notification;
+import javax.management.NotificationListener;
import javax.management.ObjectName;
-import javax.management.MBeanInfo;
-import javax.management.NotificationListener;
-import javax.management.Notification;
import javax.management.modelmbean.DescriptorSupport;
import javax.management.modelmbean.ModelMBean;
import javax.management.modelmbean.ModelMBeanAttributeInfo;
@@ -37,12 +37,21 @@
import javax.management.modelmbean.ModelMBeanOperationInfo;
import javax.management.modelmbean.RequiredModelMBean;
+import junit.framework.Test;
+
+import org.jboss.mx.modelmbean.RequiredModelMBeanInstantiator;
+import org.jboss.mx.modelmbean.XMBean;
import org.jboss.test.jmx.compliance.modelmbean.support.Resource;
-import junit.framework.TestCase;
+import test.JBossMXTest;
-public class ModelMBeanTEST extends TestCase
+public class ModelMBeanTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(ModelMBeanTEST.class);
+ }
+
static class RMMListener implements NotificationListener
{
public void handleNotification(Notification msg, Object handback)
@@ -113,7 +122,7 @@
MBeanServer server = MBeanServerFactory.createMBeanServer();
Resource resource = new Resource();
- ModelMBean modelmbean = new RequiredModelMBean();
+ ModelMBean modelmbean = RequiredModelMBeanInstantiator.instantiate();
modelmbean.setModelMBeanInfo(getModelMBeanInfo());
ObjectName name = new ObjectName("rmm:invocationTest=true");
@@ -140,7 +149,7 @@
ModelMBeanInfo info = getModelMBeanInfo();
Object[] ctorArgs = { info };
String[] ctorSig = { "javax.management.modelmbean.ModelMBeanInfo" };
- server.createMBean("javax.management.modelmbean.RequiredModelMBean",
+ server.createMBean(XMBean.class.getName(),
name, ctorArgs, ctorSig);
Resource resource = new Resource();
@@ -166,7 +175,7 @@
ModelMBeanInfo info = getModelMBeanInfo();
Object[] ctorArgs = { info };
String[] ctorSig = { "javax.management.modelmbean.ModelMBeanInfo" };
- server.createMBean("javax.management.modelmbean.RequiredModelMBean",
+ server.createMBean(XMBean.class.getName(),
name, ctorArgs, ctorSig);
Resource resource = new Resource();
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/notcompliant/NCMBeanSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/notcompliant/NCMBeanSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/notcompliant/NCMBeanSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,7 +35,7 @@
{
TestSuite suite = new TestSuite("All Not Compliant MBean Tests");
- suite.addTest(new TestSuite(NCMBeanTEST.class));
+ suite.addTest(NCMBeanTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/notcompliant/NCMBeanTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/notcompliant/NCMBeanTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/notcompliant/NCMBeanTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -27,6 +27,8 @@
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
+import junit.framework.Test;
+
import org.jboss.test.jmx.compliance.notcompliant.support.DynamicAndStandard;
import org.jboss.test.jmx.compliance.notcompliant.support.InterfaceProblems;
import org.jboss.test.jmx.compliance.notcompliant.support.NullDynamic;
@@ -36,10 +38,15 @@
import org.jboss.test.jmx.compliance.notcompliant.support.OverloadedAttribute4;
import org.jboss.test.jmx.compliance.notcompliant.support.OverloadedAttribute5;
-import junit.framework.TestCase;
+import test.JBossMXTest;
-public class NCMBeanTEST extends TestCase
+public class NCMBeanTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(NCMBeanTEST.class);
+ }
+
public NCMBeanTEST(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QueryMBeansObjectNameOnlyTestCase.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/query/QueryMBeansObjectNameOnlyTestCase.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QueryMBeansObjectNameOnlyTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,20 +21,21 @@
*/
package org.jboss.test.jmx.compliance.query;
-import junit.framework.TestCase;
-
-
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import java.util.HashSet;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
+import junit.framework.Test;
+
import org.jboss.test.jmx.compliance.query.support.Trivial;
+import test.JBossMXTest;
+
/**
* Object Name Query tests.<p>
*
@@ -42,10 +43,14 @@
*
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
+ at SuppressWarnings("unchecked")
public class QueryMBeansObjectNameOnlyTestCase
- extends TestCase
+ extends JBossMXTest
{
- // Attributes ----------------------------------------------------------------
+ public static Test suite()
+ {
+ return suite(QueryMBeansObjectNameOnlyTestCase.class);
+ }
/**
* The number of objects registered in a server
@@ -54,21 +59,23 @@
// Constructor ---------------------------------------------------------------
- /**
- * Construct the test
- */
public QueryMBeansObjectNameOnlyTestCase(String s)
{
super(s);
+ }
+
+ // Tests ---------------------------------------------------------------------
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
// Determine the number of objects in the implementation
MBeanServer server = MBeanServerFactory.createMBeanServer();
implSize = server.getMBeanCount().intValue();
MBeanServerFactory.releaseMBeanServer(server);
}
- // Tests ---------------------------------------------------------------------
-
/**
* Test single bean found.
*/
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QuerySUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/query/QuerySUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QuerySUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -51,8 +51,8 @@
{
TestSuite suite = new TestSuite("Query tests");
- suite.addTest(new TestSuite(QueryMBeansObjectNameOnlyTestCase.class));
- suite.addTest(new TestSuite(QueryTestCase.class));
+ suite.addTest(QueryMBeansObjectNameOnlyTestCase.suite());
+ suite.addTest(QueryTestCase.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QueryTestCase.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/query/QueryTestCase.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/query/QueryTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -34,13 +34,14 @@
import javax.management.QueryExp;
import javax.management.ValueExp;
-import org.jboss.test.jmx.compliance.query.support.BooleanTest;
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+
import org.jboss.test.jmx.compliance.query.support.NumberTest;
import org.jboss.test.jmx.compliance.query.support.StringTest;
import org.jboss.test.jmx.compliance.query.support.Trivial;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
+import test.JBossMXTest;
/**
* Query unit tests
@@ -48,15 +49,13 @@
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class QueryTestCase
- extends TestCase
+ extends JBossMXTest
{
- // Attributes ----------------------------------------------------------------
+ public static Test suite()
+ {
+ return suite(QueryTestCase.class);
+ }
- // Constructor ---------------------------------------------------------------
-
- /**
- * Construct the test
- */
public QueryTestCase(String s)
{
super(s);
@@ -65,90 +64,9 @@
// Tests ---------------------------------------------------------------------
/**
- * Test a boolean
- */
- public void testBoolean() throws Exception
- {
- ValueExp one = Query.value(true);
- ValueExp two = Query.value(false);
- equalsTEST(one, two);
- attrTEST(new BooleanTest(true), Query.attr("Boolean"), one, two);
- attrTEST(new BooleanTest(true), Query.attr(BooleanTest.class.getName(), "Boolean"), one, two);
- try
- {
- // Test in first
- new QueryTEST(
- new MBean[]
- {
- new MBean(new Trivial(), "Domain1:type=instance1")
- },
- new MBean[0],
- Query.in
- (
- one,
- new ValueExp[]
- {
- one, two, two
- }
- )
- ).test();
- // Test in last
- new QueryTEST(
- new MBean[]
- {
- new MBean(new Trivial(), "Domain1:type=instance1")
- },
- new MBean[0],
- Query.in
- (
- one,
- new ValueExp[]
- {
- two, two, one
- }
- )
- ).test();
- // Test in not the first or last
- new QueryTEST(
- new MBean[]
- {
- new MBean(new Trivial(), "Domain1:type=instance1")
- },
- new MBean[0],
- Query.in
- (
- one,
- new ValueExp[]
- {
- two, one, two
- }
- )
- ).test();
- // Test not in
- new QueryTEST(
- new MBean[0],
- new MBean[]
- {
- new MBean(new Trivial(), "Domain1:type=instance1")
- },
- Query.in
- (
- one,
- new ValueExp[]
- {
- two, two, two
- }
- )
- ).test();
- }
- catch (AssertionFailedError e)
- {
- fail("FAILS IN RI: Query.in boolean");
- }
- }
-
- /**
* Test a double
+ *
+ * @throws Exception for any error
*/
public void testDouble() throws Exception
{
@@ -169,6 +87,8 @@
/**
* Test a Double
+ *
+ * @throws Exception for any error
*/
public void testDoubleObject() throws Exception
{
@@ -189,6 +109,8 @@
/**
* Test a float
+ *
+ * @throws Exception for any error
*/
public void testFloat() throws Exception
{
@@ -209,6 +131,8 @@
/**
* Test a Float
+ *
+ * @throws Exception for any error
*/
public void testFloatObject() throws Exception
{
@@ -229,6 +153,8 @@
/**
* Test a int
+ *
+ * @throws Exception for any error
*/
public void testInteger() throws Exception
{
@@ -249,6 +175,8 @@
/**
* Test a Integer
+ *
+ * @throws Exception for any error
*/
public void testIntegerObject() throws Exception
{
@@ -269,6 +197,8 @@
/**
* Test a long
+ *
+ * @throws Exception for any error
*/
public void testLong() throws Exception
{
@@ -289,6 +219,8 @@
/**
* Test a Long
+ *
+ * @throws Exception for any error
*/
public void testLongObject() throws Exception
{
@@ -309,6 +241,8 @@
/**
* Test a String
+ *
+ * @throws Exception for any error
*/
public void testString() throws Exception
{
@@ -330,10 +264,12 @@
/**
* Test and is true both
+ *
+ * @throws Exception for any error
*/
public void testAndTrueBoth() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -355,10 +291,12 @@
/**
* Test and is false first parameter
+ *
+ * @throws Exception for any error
*/
public void testAndFalseFirst() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -380,10 +318,12 @@
/**
* Test and is false second parameter
+ *
+ * @throws Exception for any error
*/
public void testAndFalseSecond() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -405,10 +345,12 @@
/**
* Test and is false both parameters
+ *
+ * @throws Exception for any error
*/
public void testAndFalseBoth() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -430,10 +372,12 @@
/**
* Test or is true both
+ *
+ * @throws Exception for any error
*/
public void testOrTrueBoth() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -455,10 +399,12 @@
/**
* Test or is false first parameter
+ *
+ * @throws Exception for any error
*/
public void testOrFalseFirst() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -480,10 +426,12 @@
/**
* Test or is false second parameter
+ *
+ * @throws Exception for any error
*/
public void testOrFalseSecond() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -505,10 +453,12 @@
/**
* Test or is false both parameters
+ *
+ * @throws Exception for any error
*/
public void testOrFalseBoth() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -530,10 +480,12 @@
/**
* Test not
+ *
+ * @throws Exception for any error
*/
public void testNot() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -551,10 +503,12 @@
/**
* Test not not
+ *
+ * @throws Exception for any error
*/
public void testNotNot() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -572,10 +526,12 @@
/**
* Test class attribute
+ *
+ * @throws Exception for any error
*/
public void testClassAttribute() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -593,10 +549,12 @@
/**
* Test simple object name
+ *
+ * @throws Exception for any error
*/
public void testSimpleObjectName() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new Trivial(), "Domain1:type=instance1")
@@ -611,10 +569,12 @@
/**
* Test domain pattern object name
+ *
+ * @throws Exception for any error
*/
public void testDomainPatternObjectName() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new Trivial(), "Domain1:type=instance1")
@@ -629,10 +589,12 @@
/**
* Test property pattern object name
+ *
+ * @throws Exception for any error
*/
public void testPropertyPatternObjectName() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new Trivial(), "Domain1:type=instance1"),
@@ -648,10 +610,12 @@
/**
* Test multiple property pattern object name
+ *
+ * @throws Exception for any error
*/
public void testMultiplePropertyPatternObjectName() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new Trivial(), "Domain1:type=instance1,extra=true")
@@ -666,6 +630,8 @@
/**
* Test invalid name passed to ObjectName
+ *
+ * @throws Exception for any error
*/
public void testInvalidNamePassedToObjectName() throws Exception
{
@@ -675,10 +641,12 @@
/**
* Test any substring
+ *
+ * @throws Exception for any error
*/
public void testAnySubstring() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
@@ -701,10 +669,12 @@
/**
* Test final substring
+ *
+ * @throws Exception for any error
*/
public void testFinalSubstring() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("endell"), "Domain1:type=instance1"),
@@ -727,10 +697,12 @@
/**
* Test initial substring
+ *
+ * @throws Exception for any error
*/
public void testInitialSubstring() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("ellbeginning"), "Domain1:type=instance1"),
@@ -753,10 +725,12 @@
/**
* Test match asterisk beginning
+ *
+ * @throws Exception for any error
*/
public void testMatchAsteriskBeginning() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("endell"), "Domain1:type=instance1"),
@@ -779,10 +753,12 @@
/**
* Test match asterisk end
+ *
+ * @throws Exception for any error
*/
public void testMatchAsteriskEnd() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("ellbeginning"), "Domain1:type=instance1"),
@@ -805,10 +781,12 @@
/**
* Test any match asterisk beginning and end
+ *
+ * @throws Exception for any error
*/
public void testMatchAsteriskBeginningAndEnd() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
@@ -831,10 +809,12 @@
/**
* Test match asterisk embedded
+ *
+ * @throws Exception for any error
*/
public void testMatchAsteriskEmbedded() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
@@ -857,10 +837,12 @@
/**
* Test match question beginning
+ *
+ * @throws Exception for any error
*/
public void testMatchQuestionBeginning() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
@@ -879,10 +861,12 @@
/**
* Test match question end
+ *
+ * @throws Exception for any error
*/
public void testMatchQuestionEnd() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
@@ -901,10 +885,12 @@
/**
* Test match question beginning and end
+ *
+ * @throws Exception for any error
*/
public void testMatchQuestionBeginningEnd() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
@@ -930,10 +916,12 @@
/**
* Test match question embedded
+ *
+ * @throws Exception for any error
*/
public void testMatchQuestionEmbedded() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
@@ -954,73 +942,13 @@
}
/**
- * Test match character set
- */
- public void testMatchCharacterSet() throws Exception
- {
- try
- {
- new QueryTEST(
- new MBean[]
- {
- new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
- new MBean(new StringTest("HeLlo"), "Domain1:type=instance2"),
- },
- new MBean[]
- {
- new MBean(new StringTest("hell"), "Domain2:type=instance1"),
- new MBean(new StringTest("ello"), "Domain2:type=instance2"),
- new MBean(new StringTest("ell"), "Domain2:type=instance3"),
- new MBean(new StringTest("Helloo"), "Domain2:type=instance4"),
- new MBean(new StringTest("HHello"), "Domain2:type=instance5"),
- new MBean(new StringTest("HHelloo"), "Domain2:type=instance6"),
- },
- Query.match(Query.attr("String"), Query.value("He[lL]lo"))
- ).test();
- }
- catch (AssertionFailedError e)
- {
- fail("FAILS IN RI: expected Hello to match He[lL]lo");
- }
- }
-
- /**
- * Test match character range
- */
- public void testMatchCharacterRange() throws Exception
- {
- try
- {
- new QueryTEST(
- new MBean[]
- {
- new MBean(new StringTest("Hello"), "Domain1:type=instance1"),
- new MBean(new StringTest("Hemlo"), "Domain1:type=instance2"),
- },
- new MBean[]
- {
- new MBean(new StringTest("hell"), "Domain2:type=instance1"),
- new MBean(new StringTest("He lo"), "Domain2:type=instance2"),
- new MBean(new StringTest("Heklo"), "Domain2:type=instance3"),
- new MBean(new StringTest("Henlo"), "Domain2:type=instance4"),
- new MBean(new StringTest("HeLlo"), "Domain2:type=instance5"),
- new MBean(new StringTest("HeMlo"), "Domain2:type=instance6"),
- },
- Query.match(Query.attr("String"), Query.value("He[l-m]lo"))
- ).test();
- }
- catch (AssertionFailedError e)
- {
- fail("FAILS IN RI: didn't expected HeMlo to match He[l-m]lo");
- }
- }
-
- /**
* Test match escaping question mark
+ *
+ * @throws Exception for any error
*/
public void testEscapingQuestion() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello?"), "Domain1:type=instance1"),
@@ -1035,10 +963,12 @@
/**
* Test match escaping asterisk
+ *
+ * @throws Exception for any error
*/
public void testEscapingAsterisk() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello*"), "Domain1:type=instance1"),
@@ -1053,10 +983,12 @@
/**
* Test match escaping open bracket
+ *
+ * @throws Exception for any error
*/
public void testEscapingOpenBracket() throws Exception
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello[ab]"), "Domain1:type=instance1"),
@@ -1071,33 +1003,10 @@
}
/**
- * Test match minus in character set
- */
- public void testMinusInCharacterSet() throws Exception
- {
- try
- {
- new QueryTEST(
- new MBean[]
- {
- new MBean(new StringTest("Hello-"), "Domain1:type=instance1"),
- },
- new MBean[]
- {
- new MBean(new StringTest("Hello[ab-]"), "Domain2:type=instance1"),
- },
- Query.match(Query.attr("String"), Query.value("Hello[ab-]"))
- ).test();
- }
- catch (AssertionFailedError e)
- {
- fail("FAILS IN RI: expected Hello- to match Hello[ab-]");
- }
- }
-
- /**
* Test threading, tests that running the same query in multiple threads
* works. This test might not catch a threading problem on every run.
+ *
+ * @throws Exception for any error
*/
public void testThreading() throws Exception
{
@@ -1129,12 +1038,14 @@
/**
* Test pathological
+ *
+ * @throws Exception for any error
*/
public void testPathological() throws Exception
{
try
{
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new StringTest("Hello(?:.)"), "Domain1:type=instance1"),
@@ -1158,7 +1069,7 @@
throws Exception
{
// Test equals
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1170,7 +1081,7 @@
)
).test();
// Test not equals
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1188,7 +1099,7 @@
throws Exception
{
// Test div
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1201,7 +1112,7 @@
)
).test();
// Test minus
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1214,7 +1125,7 @@
)
).test();
// Test mult
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1227,7 +1138,7 @@
)
).test();
// Test plus
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1245,7 +1156,7 @@
throws Exception
{
// Test cat
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1263,7 +1174,7 @@
throws Exception
{
// Test greater than or equals (really greater than)
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1275,7 +1186,7 @@
)
).test();
// Test greater than or equals (really greater equals)
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1287,7 +1198,7 @@
)
).test();
// Test not greater than or equals
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1299,7 +1210,7 @@
)
).test();
// Test greater than
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1311,7 +1222,7 @@
)
).test();
// Test not greater than
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1323,7 +1234,7 @@
)
).test();
// Test greater than or equals (really greater than)
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1335,7 +1246,7 @@
)
).test();
// Test greater than or equals (really greater equals)
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1347,7 +1258,7 @@
)
).test();
// Test not greater than or equals
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1359,7 +1270,7 @@
)
).test();
// Test greater than
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1371,7 +1282,7 @@
)
).test();
// Test not greater than
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1388,7 +1299,7 @@
throws Exception
{
// Test between (really between)
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1400,7 +1311,7 @@
)
).test();
// Test between (equals first)
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1412,7 +1323,7 @@
)
).test();
// Test between (equals second)
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1424,7 +1335,7 @@
)
).test();
// Test between (equals both)
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new NumberTest(0), "Domain1:type=instance1")
@@ -1436,7 +1347,7 @@
)
).test();
// Test not between (first)
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1448,7 +1359,7 @@
)
).test();
// Test not between (second)
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1465,7 +1376,7 @@
throws Exception
{
// Test true
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(mbean, "Domain1:type=instance1")
@@ -1480,7 +1391,7 @@
)
).test();
// Test false
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1498,7 +1409,7 @@
throws Exception
{
// Test in first
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new Trivial(), "Domain1:type=instance1")
@@ -1514,7 +1425,7 @@
)
).test();
// Test in last
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new Trivial(), "Domain1:type=instance1")
@@ -1530,7 +1441,7 @@
)
).test();
// Test in not the first or last
- new QueryTEST(
+ new TestQuery(
new MBean[]
{
new MBean(new Trivial(), "Domain1:type=instance1")
@@ -1546,7 +1457,7 @@
)
).test();
// Test not in
- new QueryTEST(
+ new TestQuery(
new MBean[0],
new MBean[]
{
@@ -1575,14 +1486,15 @@
}
}
- private class QueryTEST
+ @SuppressWarnings("unchecked")
+ private class TestQuery
{
HashSet expectedInstances = new HashSet();
HashSet expectedNames = new HashSet();
QueryExp queryExp;
MBeanServer server;
- public QueryTEST(MBean[] expected, MBean[] others, QueryExp queryExp)
+ public TestQuery(MBean[] expected, MBean[] others, QueryExp queryExp)
throws Exception
{
this.queryExp = queryExp;
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/registration/RegistrationSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/registration/RegistrationSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/registration/RegistrationSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,7 +35,7 @@
{
TestSuite suite = new TestSuite("All MBeanRegistration Related Tests");
- suite.addTest(new TestSuite(RegistrationTEST.class));
+ suite.addTest(RegistrationTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/registration/RegistrationTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/registration/RegistrationTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/registration/RegistrationTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -28,12 +28,19 @@
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
+import junit.framework.Test;
+
import org.jboss.test.jmx.compliance.registration.support.RegistrationAware;
-import junit.framework.TestCase;
+import test.JBossMXTest;
-public class RegistrationTEST extends TestCase
+public class RegistrationTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(RegistrationTEST.class);
+ }
+
public RegistrationTEST(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/DefaultDomainTestCase.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/DefaultDomainTestCase.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/DefaultDomainTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -28,11 +28,11 @@
import javax.management.ObjectName;
import javax.management.relation.RelationService;
-import junit.framework.TestCase;
-
import org.jboss.test.jmx.compliance.server.support.Broadcaster;
import org.jboss.test.jmx.compliance.server.support.Test;
+import test.JBossMXTest;
+
/**
* Tests default domain handling in the Server.<p>
*
@@ -49,15 +49,13 @@
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class DefaultDomainTestCase
- extends TestCase
+ extends JBossMXTest
{
- // Attributes ----------------------------------------------------------------
-
- // Constructor ---------------------------------------------------------------
-
- /**
- * Construct the test
- */
+ public static junit.framework.Test suite()
+ {
+ return suite(DefaultDomainTestCase.class);
+ }
+
public DefaultDomainTestCase(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanDelegateTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/MBeanDelegateTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanDelegateTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -27,10 +27,10 @@
import javax.management.NotificationListener;
import javax.management.ObjectName;
-import junit.framework.TestCase;
-
import org.jboss.test.jmx.compliance.server.support.Test;
+import test.JBossMXTest;
+
/**
* Tests for the MBean server delegate.
*
@@ -38,8 +38,12 @@
*
* @version $Revision$
*/
-public class MBeanDelegateTEST extends TestCase
+public class MBeanDelegateTEST extends JBossMXTest
{
+ public static junit.framework.Test suite()
+ {
+ return suite(MBeanDelegateTEST.class);
+ }
public MBeanDelegateTEST(String s)
{
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerBuilderTestCase.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/MBeanServerBuilderTestCase.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerBuilderTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -27,7 +27,7 @@
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
-import junit.framework.TestCase;
+import junit.framework.Test;
import org.jboss.test.jmx.compliance.server.support.BuilderTest;
import org.jboss.test.jmx.compliance.server.support.DelegateListener;
@@ -36,16 +36,21 @@
import org.jboss.test.jmx.compliance.server.support.TestMBeanServerBuilder;
import org.jboss.test.jmx.compliance.server.support.TestMBeanServerDelegate;
+import test.JBossMXTest;
+
/**
* Tests the MBeanServerBuilder
*
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class MBeanServerBuilderTestCase
- extends TestCase
+ extends JBossMXTest
{
- // Attributes ----------------------------------------------------------------
+ public static Test suite()
+ {
+ return suite(MBeanServerBuilderTestCase.class);
+ }
private ObjectName name;
private ObjectName delegateName;
@@ -56,9 +61,6 @@
// Constructor ---------------------------------------------------------------
- /**
- * Construct the test
- */
public MBeanServerBuilderTestCase(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerFactoryTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/MBeanServerFactoryTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerFactoryTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -28,11 +28,18 @@
import javax.management.ObjectName;
import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
+import junit.framework.Test;
+import test.JBossMXTest;
-public class MBeanServerFactoryTEST extends TestCase
+ at SuppressWarnings("unchecked")
+public class MBeanServerFactoryTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(MBeanServerFactoryTEST.class);
+ }
+
public MBeanServerFactoryTEST(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -33,34 +33,35 @@
import javax.management.NotificationListener;
import javax.management.ObjectName;
-import junit.framework.TestCase;
+import junit.framework.Test;
-import org.jboss.test.jmx.compliance.server.support.BroadcasterInvocationHandlerTest;
import org.jboss.test.jmx.compliance.server.support.EmitterInvocationHandlerTest;
import org.jboss.test.jmx.compliance.server.support.InvocationHandlerTest;
import org.jboss.test.jmx.compliance.server.support.InvocationHandlerTestMBean;
import org.jboss.test.jmx.compliance.server.support.ObjectInvocationHandlerTest;
+import test.JBossMXTest;
+
/**
* Tests the MBeanServerInvocationHandler
*
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class MBeanServerInvocationHandlerTestCase
- extends TestCase
+ extends JBossMXTest
implements NotificationListener
{
- // Attributes ----------------------------------------------------------------
+ public static Test suite()
+ {
+ return suite(MBeanServerInvocationHandlerTestCase.class);
+ }
private ObjectName invocationHandlerTestName;
- private ArrayList messages = new ArrayList();
+ private ArrayList<Notification> messages = new ArrayList<Notification>();
// Constructor ---------------------------------------------------------------
- /**
- * Construct the test
- */
public MBeanServerInvocationHandlerTestCase(String s)
{
super(s);
@@ -283,35 +284,6 @@
assertTrue(messages.size() == 0);
}
- public void testNotificationEmitterRemoveTripletFailsOnBroadcaster()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- BroadcasterInvocationHandlerTest test = new BroadcasterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- NotificationFilterSupport filter = new NotificationFilterSupport();
- filter.enableType("test");
- Object handback = new Object();
- proxy.addNotificationListener(this, filter, handback);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 1);
-
- try
- {
- proxy.removeNotificationListener(this, filter, handback);
- fail("FAILS IN JBOSSMX: removeNotificationListener(NotificationListener, NotificationFilter, Object) " +
- "should not work for a broadcaster");
- }
- catch (Exception ignored)
- {
- }
- }
-
public void testGetNotificationInfo()
throws Exception
{
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/MBeanServerTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.jmx.compliance.server;
-import java.io.File;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
@@ -46,7 +45,6 @@
import javax.management.loading.MLet;
import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
import org.jboss.test.jmx.compliance.server.support.BabarError;
import org.jboss.test.jmx.compliance.server.support.Base;
@@ -67,6 +65,8 @@
import org.jboss.test.jmx.compliance.server.support.Unrelated;
import org.jboss.test.jmx.compliance.server.support.UnrelatedMBean;
+import test.JBossMXTest;
+
/**
* Tests the MBean server impl. through the <tt>MBeanServer</tt> interface.
*
@@ -75,8 +75,13 @@
*
*/
public class MBeanServerTEST
- extends TestCase
+ extends JBossMXTest
{
+ public static junit.framework.Test suite()
+ {
+ return suite(MBeanServerTEST.class);
+ }
+
URL location;
public MBeanServerTEST(String s) throws Exception
@@ -99,6 +104,8 @@
/**
* Tests invoke with primitive boolean return type. <p>
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithPrimitiveBooleanReturn() throws Exception
{
@@ -113,6 +120,8 @@
/**
* Tests invoke with primitive long array return type. <p>
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithPrimitiveLongArrayReturn() throws Exception
{
@@ -129,6 +138,8 @@
/**
* Tests invoke with Long array return type. <p>
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithLongArrayReturn() throws Exception
{
@@ -145,6 +156,8 @@
/**
* Tests invoke with primitive long return type. <p>
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithPrimitiveLongReturn() throws Exception
{
@@ -159,6 +172,8 @@
/**
* Tests invoke with primitive double return type. <p>
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithPrimitiveDoubleReturn() throws Exception
{
@@ -173,6 +188,8 @@
/**
* Tests invoke with long signature. <p>
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithLongSignature() throws Exception
{
@@ -193,6 +210,8 @@
/**
* Tests invoke with mixed types in signature, especially types with double
* byte code length and arrays. <p>
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithMixedSignature() throws Exception
{
@@ -213,6 +232,8 @@
/**
* Attempts to invoke a method on an unregistered MBean; <tt>InstanceNotFoundException</tt> should occur.
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithNonExistantMBean() throws Exception
{
@@ -233,6 +254,8 @@
/**
* Attempts to invoke a MBean operation that throws a business exception; <tt>MBeanException</tt> should be thrown.
+ *
+ * @throws Exception for any error
*/
public void testInvokeWithBusinessException() throws Exception
{
@@ -453,6 +476,8 @@
/**
* Tests instantiate(String className). Class defined by system classloader.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultConstructor() throws Exception
{
@@ -465,6 +490,8 @@
/**
* Tests instantiate(String className) with constructor that throws a checked application exception.
* Class defined by system classloader.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultConstructorAndApplicationException() throws Exception
{
@@ -485,6 +512,8 @@
/**
* Tests instantiate(String className) with constructor that throws an unchecked application exception.
* Class defined by the system classloader.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultConstructorAndRuntimeException() throws Exception
{
@@ -505,6 +534,8 @@
/**
* Tests instantiate(String className) with constructor that throws an error.
* Class defined by the system classloader.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultConstructorAndError() throws Exception
{
@@ -525,6 +556,8 @@
/**
* Tests instantiate(String className) with constructor that fails with an unchecked exception in static init block.
* Class defined by the system classloader.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultConstructorAndExceptionInInit() throws Exception
{
@@ -562,6 +595,8 @@
/**
* Tests instatiante(String className) with constructor that fails with an error in static init block.
* Class defined by the system classloader.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultConstructorAndErrorInInit() throws Exception
{
@@ -598,6 +633,8 @@
/**
* Tests instantiate(String className) with unfound class.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultConstructorAndUnknownClass() throws Exception
{
@@ -618,6 +655,8 @@
/**
* Tests instantiate(String className) with class that doesn't have a default constructor.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithMissingDefaultConstructor() throws Exception
{
@@ -637,6 +676,8 @@
/**
* Tests instantiate(String className) with protected (no access) no args constructor.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithInaccessibleNoArgsConstructor() throws Exception
{
@@ -657,6 +698,8 @@
/**
* Tests instantiate(String className) with null class name. According to
* javadoc, should throw RuntimeOperationsException wrapping IllegalArgException.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithNullClassName() throws Exception
{
@@ -680,6 +723,8 @@
/**
* Tests instantiate(String className) with empty class name string. should
* throw ReflectionException wrapping CNFE.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithEmptyClassName() throws Exception
{
@@ -703,6 +748,8 @@
/**
* Tests instantiate(String className, ObjectName loader) with null class name. According to
* javadoc, should throw RuntimeOperationsException wrapping IllegalArgException.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithNullClassName2() throws Exception
{
@@ -726,6 +773,8 @@
/**
* Tests instantiate(String className, ObjectName loader) with empty class name string. should
* throw ReflectionException wrapping CNFE.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithEmptyClassName2() throws Exception
{
@@ -750,6 +799,8 @@
* Tests instantiate(String className, Object[] args, String[] sign) with null
* class name. According to javadoc, should throw RuntimeOperationsException
* wrapping IllegalArgException.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithNullClassName3() throws Exception
{
@@ -773,6 +824,8 @@
/**
* Tests instantiate(String className, Object[] args, String[] sign) with
* empty class name string. should throw ReflectionException wrapping CNFE.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithEmptyClassName3() throws Exception
{
@@ -797,6 +850,10 @@
* Tests instantiate(String className, ObjectName loader, Object[] args, String[] sign)
* with null class name. According to javadoc, should throw RuntimeOperationsException
* wrapping IllegalArgException.
+ *
+ * @throws Exception for any error
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithNullClassName4() throws Exception
{
@@ -820,6 +877,8 @@
/**
* Tests instantiate(String className, ObjectName loader, Object[] args, String[] sign)
* with empty class name string. should throw ReflectionException wrapping CNFE.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithEmptyClassName4() throws Exception
{
@@ -843,6 +902,8 @@
/**
* Tests instantiate(String className) classloading behaviour. According to
* javadoc, DLR should be used to instantiate the class
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultLoaderRepository() throws Exception
{
@@ -878,6 +939,8 @@
* Tests instantiate(String className, ObjectName loader) classloading behaviour. According to
* javadoc, DLR should be used to instantiate the class. This should fail as
* the MLet MBean is never added to the agent and therefore not in the DLR.
+ *
+ * @throws Exception for any error
*/
public void testInstantiateWithDefaultLoaderRepository2() throws Exception
{
@@ -917,6 +980,8 @@
/**
* Tests registering with null object name.
+ *
+ * @throws Exception for any error
*/
public void testRegisterNullObjectName() throws Exception
{
@@ -939,6 +1004,8 @@
/**
* Tests registering with a pattern object name.
+ *
+ * @throws Exception for any error
*/
public void testRegisterPatternObjectName() throws Exception
{
@@ -961,6 +1028,8 @@
/**
* Tests registering into JMImplementation
+ *
+ * @throws Exception for any error
*/
public void testRegisterJMImplementationObjectName() throws Exception
{
@@ -983,6 +1052,8 @@
/**
* Tests registering into JMImplementation using default domain
+ *
+ * @throws Exception for any error
*/
public void testRegisterJMImplementationDefaultDomainObjectName() throws Exception
{
@@ -1006,6 +1077,8 @@
/**
* Tests register for an MBean that throws unchecked exception from preRegister()
+ *
+ * @throws Exception for any error
*/
public void testRegisterMBeanOnExceptionFromPreRegister() throws Exception
{
@@ -1033,6 +1106,8 @@
/**
* Tests register for an MBean that throws checked exception from preRegister()
+ *
+ * @throws Exception for any error
*/
public void testRegisterMBeanOnExceptionFromPreRegister2() throws Exception
{
@@ -1057,6 +1132,8 @@
/**
* Tests register for an MBean that throws an MBeanRegistrationException from
* preRegister() method.
+ *
+ * @throws Exception for any error
*/
public void testRegisterMBeanOnExceptionFromPreRegister3() throws Exception
{
@@ -1083,6 +1160,8 @@
/**
* Tests unregister the delegate.
+ *
+ * @throws Exception for any error
*/
public void testUnregisterDelegate() throws Exception
{
@@ -1105,6 +1184,8 @@
/**
* Tests basic register/unregister
+ *
+ * @throws Exception for any error
*/
public void testBasicUnregister() throws Exception
{
@@ -1117,6 +1198,8 @@
/**
* Tests unregister with default domain name
+ *
+ * @throws Exception for any error
*/
public void testUnregisterWithDefaultDomainName() throws Exception
{
@@ -1139,6 +1222,8 @@
/**
* Tests unregister with default domain name gotten from ObjectInstance at registration time.
+ *
+ * @throws Exception for any error
*/
public void testUnregisterWithObjectNameFromRegistration() throws Exception
{
@@ -1164,6 +1249,8 @@
/**
* Tests unregister for an MBean that prevents unregistration by throwing an
* unchecked exception from its preDeregister() method.
+ *
+ * @throws Exception for any error
*/
public void testUnregisterMBeanOnExceptionFromPreDeregister() throws Exception
{
@@ -1196,6 +1283,8 @@
/**
* Tests unregister for an MBean that prevents unregistration by throwing a
* checked exception from its preDeregister() method.
+ *
+ * @throws Exception for any error
*/
public void testUnregisterMBeanOnExceptionFromPreDeregister2() throws Exception
{
@@ -1224,6 +1313,8 @@
* Tests unregister for an MBean that prevents unregistration by throwing a
* MBeanRegistrationException from its preDeregister() method. This should
* be rethrown by the agent as-is, and not wrapped into another MBeanRegistrationException.
+ *
+ * @throws Exception for any error
*/
public void testUnregisterMBeanOnExceptionFromPreDeregister3() throws Exception
{
@@ -1251,6 +1342,8 @@
/**
* Tests basic listener registration to server delegate
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddNotificationListenerToDelegate() throws Exception
{
@@ -1295,6 +1388,8 @@
/**
* Tests multiple listeners with different handbacks
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddMultipleListeners()
throws Exception
@@ -1338,6 +1433,8 @@
/**
* Tests one listener multiple handbacks
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddListenerMultipleHandbacks()
throws Exception
@@ -1379,6 +1476,8 @@
/**
* Tests removing a notification listener including multiple handbacks
+ *
+ * @throws Exception for any error
*/
public synchronized void testRemoveListener()
throws Exception
@@ -1446,6 +1545,8 @@
/**
* Tests removing a notification listener triplet
+ *
+ * @throws Exception for any error
*/
public synchronized void testRemoveTriplet()
throws Exception
@@ -1497,6 +1598,8 @@
/**
* Tests removing a broadcaster
+ *
+ * @throws Exception for any error
*/
public synchronized void testRemoveBroadcaster()
throws Exception
@@ -1546,6 +1649,8 @@
/**
* Tests adding the listener to different broadcasters
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddListenerToTwoBroadcasters()
throws Exception
@@ -1598,6 +1703,8 @@
/**
* Tests adding the listener to different broadcasters but remove one
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddListenerToTwoBroadcastersRemoveOne()
throws Exception
@@ -1647,6 +1754,8 @@
/**
* Tests basic listener registration to server delegate
+ *
+ * @throws Exception for any error
*/
public synchronized void testaddMBeanToDelegate() throws Exception
{
@@ -1673,6 +1782,8 @@
/**
* Tests multiple listeners with different handbacks
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddMBeanMultipleListeners()
throws Exception
@@ -1704,6 +1815,8 @@
/**
* Tests one listener multiple handbacks
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddMBeanListenerMultipleHandbacks()
throws Exception
@@ -1732,6 +1845,8 @@
/**
* Tests removing a notification listener including multiple handbacks
+ *
+ * @throws Exception for any error
*/
public synchronized void testMBeanRemoveListener()
throws Exception
@@ -1764,6 +1879,8 @@
/**
* Tests removing a notification listener triple
+ *
+ * @throws Exception for any error
*/
public synchronized void testMBeanRemoveTriplet()
throws Exception
@@ -1797,6 +1914,8 @@
/**
* Tests MBeanRedeploy notification
+ *
+ * @throws Exception for any error
*/
public synchronized void testMBeanRedeployNotification()
throws Exception
@@ -1827,6 +1946,8 @@
/**
* Tests removing a broadcaster
+ *
+ * @throws Exception for any error
*/
public synchronized void testMBeanRemoveBroadcaster()
throws Exception
@@ -1868,6 +1989,8 @@
/**
* Tests adding the listener to different broadcasters
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddMBeanListenerToTwoBroadcasters()
throws Exception
@@ -1922,6 +2045,8 @@
/**
* Tests adding the listener to different broadcasters but remove one
+ *
+ * @throws Exception for any error
*/
public synchronized void testAddMBeanListenerToTwoBroadcastersRemoveOne()
throws Exception
@@ -1981,7 +2106,7 @@
server.registerMBean(new Test(), new ObjectName("Domain3:test=test1"));
assertTrue("Now four domains", server.getDomains().length == 4);
- List domains = Arrays.asList(server.getDomains());
+ List<String> domains = Arrays.asList(server.getDomains());
assertTrue("server has JMImplementation", domains.contains("JMImplementation"));
assertTrue("server has Domain1", domains.contains("Domain1"));
assertTrue("server has Domain2", domains.contains("Domain2"));
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/ServerSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,12 +35,12 @@
{
TestSuite suite = new TestSuite("General MBeanServer Tests");
- suite.addTest(new TestSuite(MBeanServerFactoryTEST.class));
- suite.addTest(new TestSuite(MBeanServerTEST.class));
- suite.addTest(new TestSuite(MBeanDelegateTEST.class));
- suite.addTest(new TestSuite(DefaultDomainTestCase.class));
- suite.addTest(new TestSuite(MBeanServerBuilderTestCase.class));
- suite.addTest(new TestSuite(MBeanServerInvocationHandlerTestCase.class));
+ suite.addTest(MBeanServerFactoryTEST.suite());
+ suite.addTest(MBeanServerTEST.suite());
+ suite.addTest(MBeanDelegateTEST.suite());
+ suite.addTest(DefaultDomainTestCase.suite());
+ suite.addTest(MBeanServerBuilderTestCase.suite());
+ suite.addTest(MBeanServerInvocationHandlerTestCase.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/BabarError.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/support/BabarError.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/BabarError.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,8 +24,6 @@
/**
* <description>
*
- * @see <related>
- *
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
*
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/MyScreamingException.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/support/MyScreamingException.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/MyScreamingException.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,8 +24,6 @@
/**
* <description>
*
- * @see <related>
- *
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
*
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/Test.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/support/Test.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/Test.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,8 +24,6 @@
/**
* <description>
*
- * @see <related>
- *
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
*
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/TestMBean.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/server/support/TestMBean.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/support/TestMBean.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,8 +24,6 @@
/**
* <description>
*
- * @see <related>
- *
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
*
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InfoTortureSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/standard/InfoTortureSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InfoTortureSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -59,7 +59,7 @@
// make sure we are testing all exposed constructors (each ValidConstructorTest increments a counter
// which is used to figure out whether we have adequate test coverage)
- testSuite.addTest(new TestCoverageTEST("Torture constructor list length", constructorTestCount, info.getConstructors().length));
+ testSuite.addTest(new TestCoverage("Torture constructor list length", constructorTestCount, info.getConstructors().length));
// Tests for attributes that should not be there
addSpuriousAttributeTest(testSuite, info, "peachy");
@@ -91,7 +91,7 @@
// make sure we are testing all exposed attributes (each ValidAttributeTest increments a counter
// which is used to figure out whether we have adequate test coverage)
- testSuite.addTest(new TestCoverageTEST("Torture attribute list length", attributeTestCount, info.getAttributes().length));
+ testSuite.addTest(new TestCoverage("Torture attribute list length", attributeTestCount, info.getAttributes().length));
// validate the operations
// Args are: Name, impact, returnTypeString, SignatureAsStringArray
@@ -111,7 +111,7 @@
// make sure we are testing all exposed operations (each ValidOperationTest increments a counter
// which is used to figure out whether we have adequate test coverage)
- testSuite.addTest(new TestCoverageTEST("Torture operation list length", operationTestCount, info.getOperations().length));
+ testSuite.addTest(new TestCoverage("Torture operation list length", operationTestCount, info.getOperations().length));
return testSuite;
}
@@ -139,13 +139,13 @@
operationTestCount++;
}
- public static class TestCoverageTEST extends TestCase
+ public static class TestCoverage extends TestCase
{
private String msg;
private int expected;
private int got;
- public TestCoverageTEST(String msg, int expected, int got)
+ public TestCoverage(String msg, int expected, int got)
{
super("testAdequateCoverage");
this.msg = msg;
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InfoUtil.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/standard/InfoUtil.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InfoUtil.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -37,6 +37,8 @@
import javax.management.ObjectName;
import javax.management.ReflectionException;
+import org.jboss.mx.server.ServerConstants;
+
import junit.framework.Assert;
public class InfoUtil
@@ -47,6 +49,7 @@
try
{
+ System.setProperty(ServerConstants.MBEAN_SERVER_BUILDER_CLASS_PROPERTY, ServerConstants.DEFAULT_MBEAN_SERVER_BUILDER_CLASS);
MBeanServer server = MBeanServerFactory.newMBeanServer();
ObjectName objectName = new ObjectName(name);
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InheritanceSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/standard/InheritanceSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/InheritanceSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -56,11 +56,11 @@
MBeanInfo info = InfoUtil.getMBeanInfo(mbean, "test:type=mbeaninfo");
addConstructorTest(testSuite, info, StandardDerived1.class.getName(), new String[0]);
- testSuite.addTest(new TestCoverageTEST("StandardDerived1 constructor list length", constructorTestCount, info.getConstructors().length));
+ testSuite.addTest(new TestCoverage("StandardDerived1 constructor list length", constructorTestCount, info.getConstructors().length));
addAttributeTest(testSuite, info, "ParentValue", String.class.getName(), false, true, false);
addAttributeTest(testSuite, info, "Available", boolean.class.getName(), false, true, false);
- testSuite.addTest(new TestCoverageTEST("StandardDerived1 attribute list length", attributeTestCount, info.getAttributes().length));
- testSuite.addTest(new TestCoverageTEST("StandardDerived1 operation list length", operationTestCount, info.getOperations().length));
+ testSuite.addTest(new TestCoverage("StandardDerived1 attribute list length", attributeTestCount, info.getAttributes().length));
+ testSuite.addTest(new TestCoverage("StandardDerived1 operation list length", operationTestCount, info.getOperations().length));
resetCounters();
@@ -68,12 +68,12 @@
info = InfoUtil.getMBeanInfo(mbean, "test:type=mbeaninfo");
addConstructorTest(testSuite, info, StandardDerived2.class.getName(), new String[0]);
- testSuite.addTest(new TestCoverageTEST("StandardDerived2 constructor list length", constructorTestCount, info.getConstructors().length));
+ testSuite.addTest(new TestCoverage("StandardDerived2 constructor list length", constructorTestCount, info.getConstructors().length));
addAttributeTest(testSuite, info, "DerivedValue", String.class.getName(), false, true, false);
addAttributeTest(testSuite, info, "ParentValue", String.class.getName(), true, false, false);
addSpuriousAttributeTest(testSuite, info, "Available");
- testSuite.addTest(new TestCoverageTEST("StandardDerived2 attribute list length", attributeTestCount, info.getAttributes().length));
- testSuite.addTest(new TestCoverageTEST("StandardDerived2 operation list length", operationTestCount, info.getOperations().length));
+ testSuite.addTest(new TestCoverage("StandardDerived2 attribute list length", attributeTestCount, info.getAttributes().length));
+ testSuite.addTest(new TestCoverage("StandardDerived2 operation list length", operationTestCount, info.getOperations().length));
resetCounters();
@@ -81,19 +81,19 @@
info = InfoUtil.getMBeanInfo(mbean, "test:type=mbeaninfo");
addConstructorTest(testSuite, info, StandardDerived3.class.getName(), new String[0]);
- testSuite.addTest(new TestCoverageTEST("StandardDerived3 constructor list length", constructorTestCount, info.getConstructors().length));
+ testSuite.addTest(new TestCoverage("StandardDerived3 constructor list length", constructorTestCount, info.getConstructors().length));
addAttributeTest(testSuite, info, "ArbitraryValue", String.class.getName(), false, true, false);
- testSuite.addTest(new TestCoverageTEST("StandardDerived3 attribute list length", attributeTestCount, info.getAttributes().length));
- testSuite.addTest(new TestCoverageTEST("StandardDerived3 operation list length", operationTestCount, info.getOperations().length));
+ testSuite.addTest(new TestCoverage("StandardDerived3 attribute list length", attributeTestCount, info.getAttributes().length));
+ testSuite.addTest(new TestCoverage("StandardDerived3 operation list length", operationTestCount, info.getOperations().length));
resetCounters();
mbean = new DynamicDerived1();
info = InfoUtil.getMBeanInfo(mbean, "test:type=mbeaninfo");
- testSuite.addTest(new TestCoverageTEST("DynamicDerived1 constructor list length", constructorTestCount, info.getConstructors().length));
- testSuite.addTest(new TestCoverageTEST("DynamicDerived1 attribute list length", attributeTestCount, info.getAttributes().length));
- testSuite.addTest(new TestCoverageTEST("DynamicDerived1 operation list length", operationTestCount, info.getOperations().length));
+ testSuite.addTest(new TestCoverage("DynamicDerived1 constructor list length", constructorTestCount, info.getConstructors().length));
+ testSuite.addTest(new TestCoverage("DynamicDerived1 attribute list length", attributeTestCount, info.getAttributes().length));
+ testSuite.addTest(new TestCoverage("DynamicDerived1 operation list length", operationTestCount, info.getOperations().length));
return testSuite;
}
@@ -128,13 +128,13 @@
operationTestCount++;
}
- public static class TestCoverageTEST extends TestCase
+ public static class TestCoverage extends TestCase
{
private String msg;
private int expected;
private int got;
- public TestCoverageTEST(String msg, int expected, int got)
+ public TestCoverage(String msg, int expected, int got)
{
super("testAdequateCoverage");
this.msg = msg;
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/StandardMBeanTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/standard/StandardMBeanTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/StandardMBeanTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -32,9 +32,8 @@
import javax.management.ObjectName;
import javax.management.StandardMBean;
-import junit.framework.TestCase;
+import junit.framework.Test;
-import org.jboss.test.jmx.compliance.standard.support.ArbitraryInterface;
import org.jboss.test.jmx.compliance.standard.support.MBeanRunnable;
import org.jboss.test.jmx.compliance.standard.support.MyRunnable;
import org.jboss.test.jmx.compliance.standard.support.MyStandardMBean;
@@ -42,14 +41,21 @@
import org.jboss.test.jmx.compliance.standard.support.Trivial;
import org.jboss.test.jmx.compliance.standard.support.TrivialMBean;
+import test.JBossMXTest;
+
/**
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class StandardMBeanTEST
- extends TestCase
+ extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(StandardMBeanTEST.class);
+ }
+
public StandardMBeanTEST(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/StandardSUITE.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/standard/StandardSUITE.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/StandardSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -39,7 +39,7 @@
{
TestSuite suite = new TestSuite("StandardMBean Tests");
- suite.addTest(new TestSuite(TrivialTEST.class));
+ suite.addTest(TrivialTEST.suite());
suite.addTest(InfoTortureSUITE.suite());
suite.addTest(InheritanceSUITE.suite());
suite.addTest(new TestSuite(StandardMBeanTEST.class));
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/TrivialTEST.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/standard/TrivialTEST.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/TrivialTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -38,16 +38,23 @@
import javax.management.ObjectName;
import javax.management.ReflectionException;
-import junit.framework.TestCase;
+import junit.framework.Test;
import org.jboss.test.jmx.compliance.standard.support.Trivial;
+import test.JBossMXTest;
+
/**
* @author <a href="mailto:trevor at protocool.com">Trevor Squires</a>.
*/
-public class TrivialTEST extends TestCase
+public class TrivialTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(TrivialTEST.class);
+ }
+
public TrivialTEST(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/support/MBeanRunnable.java
===================================================================
--- projects/jbossmx/trunk/j2se/src/tests/org/jboss/test/jmx/compliance/standard/support/MBeanRunnable.java 2009-03-19 20:04:23 UTC (rev 86127)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/standard/support/MBeanRunnable.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -27,9 +27,6 @@
extends StandardMBean
implements Runnable
{
- /**
- * We provide the management interface
- */
public MBeanRunnable()
throws Exception
{
Added: projects/jbossmx/trunk/jmx/src/test/test/JBossMXTest.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/JBossMXTest.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/test/test/JBossMXTest.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package test;
+
+import org.jboss.test.AbstractTestCaseWithSetup;
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * A JBossMXTest
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 78885 $
+ */
+public class JBossMXTest extends AbstractTestCaseWithSetup
+{
+ /**
+ * Get the test delegate
+ *
+ * @param clazz the test class
+ * @return the delegate
+ * @throws Exception for any error
+ */
+ public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+ {
+ return new JBossMXTestDelegate(clazz);
+ }
+
+ /**
+ * Create a new JBossMX test
+ *
+ * @param name the test name
+ */
+ public JBossMXTest(String name)
+ {
+ super(name);
+ }
+}
Added: projects/jbossmx/trunk/jmx/src/test/test/JBossMXTestDelegate.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/JBossMXTestDelegate.java (rev 0)
+++ projects/jbossmx/trunk/jmx/src/test/test/JBossMXTestDelegate.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package test;
+
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+import org.jboss.mx.server.ServerConstants;
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * A JBossMXestDelegate.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 70576 $
+ */
+public class JBossMXTestDelegate extends AbstractTestDelegate
+{
+ /**
+ * Create a new JBossMXTestDelegate.
+ *
+ * @param clazz the test class
+ * @throws Exception for any error
+ */
+ public JBossMXTestDelegate(Class<?> clazz) throws Exception
+ {
+ super(clazz);
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ System.setProperty(ServerConstants.MBEAN_SERVER_BUILDER_CLASS_PROPERTY, ServerConstants.DEFAULT_MBEAN_SERVER_BUILDER_CLASS);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void tearDown() throws Exception
+ {
+ ArrayList<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
+ for (MBeanServer server : servers)
+ {
+ log.warn("Removed unreleased mbeanserver " + server);
+ MBeanServerFactory.releaseMBeanServer(server);
+ }
+ super.tearDown();
+ }
+}
Modified: projects/jbossmx/trunk/jmx/src/test/test/compliance/ComplianceSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/compliance/ComplianceSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/compliance/ComplianceSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -51,7 +51,7 @@
try
{
// Support for RI tracing, use -Dcom.sun.jmx.trace.level=x where x is one of 0, 1 or 2
- Class trace = Thread.currentThread().getContextClassLoader().loadClass("com.sun.jmx.trace.TraceImplementation");
+ Class<?> trace = Thread.currentThread().getContextClassLoader().loadClass("com.sun.jmx.trace.TraceImplementation");
java.lang.reflect.Method init = trace.getMethod("init", new Class[] { Integer.TYPE });
init.invoke(null, new Object[] { new Integer(System.getProperty("com.sun.jmx.trace.level")) });
}
Deleted: projects/jbossmx/trunk/jmx/src/test/test/compliance/FullComplianceSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/compliance/FullComplianceSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/compliance/FullComplianceSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package test.compliance;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * This suite includes the timer and monitoring tests that take
- * a while to run.
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- */
-
-public class FullComplianceSUITE extends TestSuite
-{
- public static void main(String[] args)
- {
- junit.textui.TestRunner.run(suite());
- }
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite("All Compliance Tests");
- suite.addTest(org.jboss.test.jmx.compliance.FullComplianceSUITE.suite());
-
- return suite;
- }
-}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/ImplementationSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/ImplementationSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/ImplementationSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -55,7 +55,6 @@
suite.addTest(test.implementation.util.UtilSUITE.suite());
suite.addTest(test.implementation.persistence.PersistenceSUITE.suite());
- suite.addTest(test.implementation.loading.LoadingSUITE.suite());
suite.addTest(test.implementation.server.ServerSUITE.suite());
suite.addTest(test.implementation.registry.RegistrySUITE.suite());
suite.addTest(test.implementation.modelmbean.ModelMBeanSUITE.suite());
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/InterceptorSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/InterceptorSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/InterceptorSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,8 +35,7 @@
{
TestSuite suite = new TestSuite("JBossMX Interceptor Tests");
- //suite.addTest(new TestSuite(InterceptorTEST.class));
- suite.addTest(new TestSuite(SharedInterceptorTEST.class));
+ suite.addTest(SharedInterceptorTEST.suite());
return suite;
}
Deleted: projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/InterceptorTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/InterceptorTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/InterceptorTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package test.implementation.interceptor;
-
-import junit.framework.TestCase;
-
-import org.jboss.mx.server.ServerConstants;
-import org.jboss.mx.service.ServiceConstants;
-
-
-/**
- *
- * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
- * @version $Revision$
- *
- */
-public class InterceptorTEST extends TestCase
- implements ServerConstants, ServiceConstants
-{
- public InterceptorTEST(String s)
- {
- super(s);
- }
-
-
-
-}
-
-
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/SharedInterceptorTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/SharedInterceptorTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/interceptor/SharedInterceptorTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -25,13 +25,14 @@
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
-import junit.framework.TestCase;
+import junit.framework.Test;
import org.jboss.mx.server.Invocation;
import org.jboss.mx.server.InvocationContext;
import org.jboss.mx.server.ServerConstants;
import org.jboss.mx.service.ServiceConstants;
+import test.JBossMXTest;
import test.implementation.interceptor.support.MySharedInterceptor;
@@ -41,9 +42,14 @@
* @version $Revision$
*
*/
-public class SharedInterceptorTEST extends TestCase
+public class SharedInterceptorTEST extends JBossMXTest
implements ServerConstants, ServiceConstants
{
+ public static Test suite()
+ {
+ return suite(SharedInterceptorTEST.class);
+ }
+
public SharedInterceptorTEST(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/AttributeCacheTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/AttributeCacheTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/AttributeCacheTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,6 +21,8 @@
*/
package test.implementation.modelmbean;
+import java.net.URL;
+
import javax.management.Attribute;
import javax.management.AttributeChangeNotification;
import javax.management.Descriptor;
@@ -31,11 +33,10 @@
import javax.management.ObjectName;
import javax.management.modelmbean.DescriptorSupport;
-import junit.framework.TestCase;
-
import org.jboss.mx.modelmbean.XMBean;
import org.jboss.mx.modelmbean.XMBeanConstants;
+import test.JBossMXTest;
import test.implementation.modelmbean.support.Test;
/**
@@ -44,8 +45,13 @@
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
*/
-public class AttributeCacheTEST extends TestCase implements XMBeanConstants
+public class AttributeCacheTEST extends JBossMXTest implements XMBeanConstants
{
+ public static junit.framework.Test suite()
+ {
+ return suite(AttributeCacheTEST.class);
+ }
+
public AttributeCacheTEST(String s)
{
super(s);
@@ -55,6 +61,8 @@
* Tests that attribute values are not cached if nothing is declared in xml.
*
* This test uses the xmbean.dtd
+ *
+ * @throws Exception for any error
*/
public void testImplicitDisabledAttributeCaching() throws Exception
{
@@ -62,9 +70,12 @@
MBeanServer server = MBeanServerFactory.createMBeanServer();
Test resource = new Test();
+ URL url = getResource("/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml");
+ assertNotNull(url);
+
Descriptor d = new DescriptorSupport();
d.setField(RESOURCE_REFERENCE, resource);
- d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/TrivialManagementInterface.xml");
+ d.setField(RESOURCE_TYPE, url.toURI().toString());
d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
XMBean mmb = new XMBean(d, DESCRIPTOR);
@@ -86,15 +97,21 @@
* Tests that attribute values are not cached if currencyTimeLimit = 0
*
* This test uses the xmbean.dtd
+ *
+ * @throws Exception for any error
*/
public void testExplicitDisabledAttributeCaching() throws Exception
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
Test resource = new Test();
+
+ URL url = getResource("/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml");
+ assertNotNull(url);
+
Descriptor d = new DescriptorSupport();
d.setField(RESOURCE_REFERENCE, resource);
- d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/TrivialManagementInterface2.xml");
+ d.setField(RESOURCE_TYPE, url.toURI().toString());
d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
XMBean mmb = new XMBean(d, DESCRIPTOR);
@@ -117,15 +134,18 @@
* Tests attribute that is never stale (currencyTimeLimit = -1)
*
* This test uses the xmbean.dtd
+ *
+ * @throws Exception for any error
*/
public void testNeverStaleAttributeCaching() throws Exception
{
-
MBeanServer server = MBeanServerFactory.createMBeanServer();
Test resource = new Test();
+ URL url = getResource("/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml");
+ assertNotNull(url);
Descriptor d = new DescriptorSupport();
d.setField(RESOURCE_REFERENCE, resource);
- d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/TrivialManagementInterface3.xml");
+ d.setField(RESOURCE_TYPE, url.toURI().toString());
d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
XMBean mmb = new XMBean(d, DESCRIPTOR);
@@ -140,22 +160,25 @@
}
assertTrue(resource.getFooCount() == 11);
- assertTrue(resource.getBarCount() == 0);
+ assertEquals(0, resource.getBarCount());
}
/**
* Tests attribute that caches the value for 10 secs.
*
* This test uses the xmbean.dtd
+ * @throws Exception for any error
*/
public void testCachedAttribute() throws Exception
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
Test resource = new Test();
+ URL url = getResource("/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml");
+ assertNotNull(url);
Descriptor d = new DescriptorSupport();
d.setField(RESOURCE_REFERENCE, resource);
- d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/TrivialManagementInterface4.xml");
+ d.setField(RESOURCE_TYPE, url.toURI().toString());
d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
XMBean mmb = new XMBean(d, DESCRIPTOR);
@@ -170,21 +193,24 @@
}
assertTrue(resource.getFooCount() == 7);
- assertTrue(resource.getBarCount() == 0);
+ assertEquals(0, resource.getBarCount());
}
/**
* Tests attribute that caches the value for 1 secs.
*
* This test uses the xmbean.dtd
+ * @throws Exception for any error
*/
public void testCachedAttribute2() throws Exception
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
Test resource = new Test();
+ URL url = getResource("/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml");
+ assertNotNull(url);
Descriptor d = new DescriptorSupport();
d.setField(RESOURCE_REFERENCE, resource);
- d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml");
+ d.setField(RESOURCE_TYPE, url.toURI().toString());
d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
XMBean mmb = new XMBean(d, DESCRIPTOR);
@@ -230,14 +256,17 @@
/**
* Tests attribute change notifications
+ * @throws Exception for any error
*/
public void testAttributeChangeNotifications() throws Exception
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
Test resource = new Test();
+ URL url = getResource("/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml");
+ assertNotNull(url);
Descriptor d = new DescriptorSupport();
d.setField(RESOURCE_REFERENCE, resource);
- d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml");
+ d.setField(RESOURCE_TYPE, url.toURI().toString());
d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
XMBean mmb = new XMBean(d, DESCRIPTOR);
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/ModelMBeanSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/ModelMBeanSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/ModelMBeanSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,8 +35,8 @@
{
TestSuite suite = new TestSuite("JBossMX Model MBean Tests");
- suite.addTest(new TestSuite(XMBeanTEST.class));
- suite.addTest(new TestSuite(AttributeCacheTEST.class));
+ suite.addTest(XMBeanTEST.suite());
+ suite.addTest(AttributeCacheTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/XMBeanTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/XMBeanTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/XMBeanTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,6 +21,8 @@
*/
package test.implementation.modelmbean;
+import java.net.URL;
+
import javax.management.Attribute;
import javax.management.Descriptor;
import javax.management.MBeanServer;
@@ -28,11 +30,12 @@
import javax.management.ObjectName;
import javax.management.modelmbean.DescriptorSupport;
-import junit.framework.TestCase;
+import junit.framework.Test;
import org.jboss.mx.modelmbean.XMBean;
import org.jboss.mx.modelmbean.XMBeanConstants;
+import test.JBossMXTest;
import test.implementation.modelmbean.support.Trivial;
import test.implementation.modelmbean.support.User;
@@ -43,8 +46,13 @@
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
*/
-public class XMBeanTEST extends TestCase implements XMBeanConstants
+public class XMBeanTEST extends JBossMXTest implements XMBeanConstants
{
+ public static Test suite()
+ {
+ return suite(XMBeanTEST.class);
+ }
+
public XMBeanTEST(String s)
{
super(s);
@@ -54,9 +62,11 @@
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
+ URL url = getResource("/test/implementation/modelmbean/support/xml/UserManagementInterface.xml");
+ assertNotNull(url);
Descriptor d = new DescriptorSupport();
d.setField(RESOURCE_REFERENCE, new User());
- d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/UserManagementInterface.xml");
+ d.setField(RESOURCE_TYPE, url.toURI().toString());
d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
XMBean mmb = new XMBean(d, DESCRIPTOR);
@@ -77,10 +87,12 @@
public void testCreateWithJBossXMBean10DTD() throws Exception
{
+ URL url = getResource("/test/implementation/modelmbean/support/xml/User.xml");
+ assertNotNull(url);
MBeanServer server = MBeanServerFactory.createMBeanServer();
Descriptor d = new DescriptorSupport();
d.setField(RESOURCE_REFERENCE, new User());
- d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/User.xml");
+ d.setField(RESOURCE_TYPE, url.toURI().toString());
d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");
XMBean mmb = new XMBean(d, DESCRIPTOR);
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/Trivial.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/Trivial.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/Trivial.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,6 +24,7 @@
public class Trivial implements TrivialMBean
{
private String something = null;
+ @SuppressWarnings("unused")
private boolean anAttribute = true;
public void setSomething(String thing)
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/User.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/User.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/modelmbean/support/User.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -20,32 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package test.implementation.modelmbean.support;
-/**
- * @jmx:mbean description="sample for jboss xmbean.dtd"
- * persistPolicy="Never"
- * persistPeriod="10"
- * persistLocation="pl1"
- * persistName="JBossXMLExample1"
- * currencyTimeLimit="10"
- * descriptor="name=\"testdescriptor\" value=\"testvalue\""
- * state-action-on-update="RESTART"
- *
- *
- * @jmx:notification description="first notification"
- * name="javax.management.SomeEvent"
- * notificationType="xd.example.first,xd.example.second"
- * persistPolicy="Never"
- * persistPeriod="20"
- * persistLocation="pl2"
- * persistName="JBossXMLExample2"
- * currencyTimeLimit="20"
- *
- **/
+
public class User {
private long id = System.currentTimeMillis();
private String name = "";
private String address = "";
+ @SuppressWarnings("unused")
private String password = null;
private String[] numbers = new String[3];
@@ -53,7 +34,6 @@
* Creates a new <code>User</code> instance using constructor with one argument.
*
* @param id a <code>long</code> value
- * @jmx:managed-constructor
*/
public User(long id)
{
@@ -62,8 +42,6 @@
/**
* Creates a new <code>User</code> using constructor with no argument
- * @jmx:managed-constructor
- *
*/
public User()
{
@@ -74,9 +52,6 @@
* Describe <code>getID</code> method here.
* read-only attribute
* @return a <code>long</code> value
- * @jmx:managed-attribute persistPolicy="Never"
- * persistPeriod="30"
- * currencyTimeLimit="30"
*/
public long getID() {
return id;
@@ -100,9 +75,6 @@
* Describe <code>getName</code> method here.
* read-write attribute
* @return a <code>String</code> value
- * @jmx:managed-attribute persistPolicy="Never"
- * persistPeriod="30"
- * currencyTimeLimit="30"
*/
public String getName() {
return name;
@@ -111,7 +83,6 @@
* Describe <code>setName</code> method here.
*
* @param name a <code>String</code> value
- * @jmx:managed-attribute
*/
public void setName(String name) {
@@ -126,9 +97,6 @@
* Describe <code>getAddress</code> method here.
* read-write attribute
* @return a <code>String</code> value
- * @jmx:managed-attribute persistPolicy="Never"
- * persistPeriod="30"
- * currencyTimeLimit="30"
*/
public String getAddress() {
return address;
@@ -138,7 +106,6 @@
* Describe <code>setAddress</code> method here.
*
* @param address a <code>String</code> value
- * @jmx:managed-attribute
*/
public void setAddress(String address) {
this.address = address;
@@ -150,9 +117,6 @@
* Describe <code>getPhoneNumbers</code> method here.
* read-write attribute
* @return a <code>String[]</code> value
- * @jmx:managed-attribute persistPolicy="Never"
- * persistPeriod="30"
- * currencyTimeLimit="30"
*/
public String[] getPhoneNumbers() {
return numbers;
@@ -161,7 +125,6 @@
* Describe <code>setPhoneNumbers</code> method here.
*
* @param numbers a <code>String[]</code> value
- * @jmx:managed-attribute
*/
public void setPhoneNumbers(String[] numbers) {
this.numbers = numbers;
@@ -173,9 +136,6 @@
* Describe <code>setPassword</code> method here.
* write only attribute
* @param passwd a <code>String</code> value
- * @jmx:managed-attribute persistPolicy="Never"
- * persistPeriod="30"
- * currencyTimeLimit="30"
*/
public void setPassword(String passwd) {
this.password = passwd;
@@ -188,7 +148,6 @@
* Describe <code>printInfo</code> method here.
* prints info
* @return a <code>String</code> value
- * @jmx:managed-operation
*/
public String printInfo() {
return
@@ -203,7 +162,6 @@
* Describe <code>addPhoneNumber</code> method here.
*
* @param number a <code>String</code> value, the phone number to add
- * @jmx:managed-operation
*/
public void addPhoneNumber(String number) {
for (int i = 0; i < numbers.length; ++i)
@@ -217,7 +175,6 @@
* Describe <code>removePhoneNumber</code> method here.
*
* @param index an <code>int</code> value, the index of phone number to remove
- * @jmx:managed-operation
*/
public void removePhoneNumber(int index) {
if (index < 0 || index >= numbers.length)
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/AsynchNotificationBroadcasterSupportTestCase.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/AsynchNotificationBroadcasterSupportTestCase.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/AsynchNotificationBroadcasterSupportTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -22,15 +22,14 @@
package test.implementation.notification;
import java.util.ArrayList;
-import java.util.Iterator;
import javax.management.Notification;
-import javax.management.NotificationFilterSupport;
-import junit.framework.TestCase;
+import junit.framework.Test;
import org.jboss.mx.notification.AsynchNotificationBroadcasterSupport;
+import test.JBossMXTest;
import test.implementation.notification.support.Listener;
/**
@@ -39,14 +38,17 @@
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class AsynchNotificationBroadcasterSupportTestCase
- extends TestCase
+ extends JBossMXTest
{
- // Attributes ----------------------------------------------------------------
+ public static Test suite()
+ {
+ return suite(AsynchNotificationBroadcasterSupportTestCase.class);
+ }
/**
* The sent notifications
*/
- private ArrayList sent = new ArrayList();
+ private ArrayList<Notification> sent = new ArrayList<Notification>();
/**
* The next notification sequence
@@ -59,20 +61,12 @@
private static final String DEFAULT_TYPE = "DefaultType";
/**
- * A different notification type
- */
- private static final String ANOTHER_TYPE = "AnotherType";
-
- /**
* No notifications
*/
- private static final ArrayList EMPTY = new ArrayList();
+ private static final ArrayList<Notification> EMPTY = new ArrayList<Notification>();
// Constructor ---------------------------------------------------------------
- /**
- * Construct the test
- */
public AsynchNotificationBroadcasterSupportTestCase(String s)
{
super(s);
@@ -150,35 +144,22 @@
sent.clear();
}
- private ArrayList apply(ArrayList sent, NotificationFilterSupport filter)
+ private ArrayList<Notification> received(Listener listener, Object object)
{
- ArrayList result = new ArrayList();
- for (Iterator iterator = sent.iterator(); iterator.hasNext();)
- {
- Notification notification = (Notification) iterator.next();
- if (filter.isNotificationEnabled(notification))
- result.add(notification);
- }
- return result;
- }
-
- private ArrayList received(Listener listener, Object object)
- {
- ArrayList result = (ArrayList) listener.notifications.get(object);
+ ArrayList<Notification> result = listener.notifications.get(object);
if (result == null)
result = EMPTY;
return result;
}
- private void compare(ArrayList passedSent, ArrayList passedReceived)
+ private void compare(ArrayList<Notification> passedSent, ArrayList<Notification> passedReceived)
throws Exception
{
- ArrayList sent = new ArrayList(passedSent);
- ArrayList received = new ArrayList(passedReceived);
+ ArrayList<Notification> sent = new ArrayList<Notification>(passedSent);
+ ArrayList<Notification> received = new ArrayList<Notification>(passedReceived);
- for (Iterator iterator = sent.iterator(); iterator.hasNext();)
+ for (Notification notification : sent)
{
- Notification notification = (Notification) iterator.next();
boolean found = received.remove(notification);
assertTrue("Expected notification " + notification, found);
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/NotificationSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/NotificationSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/NotificationSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -51,7 +51,7 @@
{
TestSuite suite = new TestSuite("JBossMX Specific Notiifcation tests");
- suite.addTest(new TestSuite(AsynchNotificationBroadcasterSupportTestCase.class));
+ suite.addTest(AsynchNotificationBroadcasterSupportTestCase.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/support/Listener.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/support/Listener.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/notification/support/Listener.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -40,7 +40,7 @@
/**
* The notifications received by handback object
*/
- public HashMap notifications = new HashMap();
+ public HashMap<Object, ArrayList<Notification>> notifications = new HashMap<Object, ArrayList<Notification>>();
public boolean waiting = false;
@@ -64,10 +64,10 @@
synchronized(notifications)
{
- ArrayList received = (ArrayList) notifications.get(handback);
+ ArrayList<Notification> received = notifications.get(handback);
if (received == null)
{
- received = new ArrayList();
+ received = new ArrayList<Notification>();
notifications.put(handback, received);
}
received.add(notification);
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/persistence/OnTimerPersistenceTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/persistence/OnTimerPersistenceTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/persistence/OnTimerPersistenceTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,28 +21,33 @@
*/
package test.implementation.persistence;
+import javax.management.Descriptor;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
-import javax.management.Descriptor;
import javax.management.ObjectName;
import javax.management.modelmbean.DescriptorSupport;
import javax.management.modelmbean.ModelMBean;
+import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo;
import javax.management.modelmbean.ModelMBeanInfoSupport;
-import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.RequiredModelMBean;
+import junit.framework.Test;
+
import org.jboss.mx.modelmbean.ModelMBeanConstants;
-import junit.framework.TestCase;
-
+import test.JBossMXTest;
import test.implementation.persistence.support.Resource;
public class OnTimerPersistenceTEST
- extends TestCase
+ extends JBossMXTest
implements ModelMBeanConstants
{
-
+ public static Test suite()
+ {
+ return suite(OnTimerPersistenceTEST.class);
+ }
+
public OnTimerPersistenceTEST(String s)
{
super(s);
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/persistence/PersistenceSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/persistence/PersistenceSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/persistence/PersistenceSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,7 +35,7 @@
{
TestSuite suite = new TestSuite("JBossMX Persistence Interceptor and Persistence Manager Tests");
- suite.addTest(new TestSuite(OnTimerPersistenceTEST.class));
+ suite.addTest(OnTimerPersistenceTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/RegistrySUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/RegistrySUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/RegistrySUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -51,7 +51,7 @@
{
TestSuite suite = new TestSuite("JBossMX Specific Registry tests");
- suite.addTest(new TestSuite(ValuesTestCase.class));
+ suite.addTest(ValuesTestCase.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/ValuesTestCase.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/ValuesTestCase.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/ValuesTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -29,10 +29,11 @@
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
-import junit.framework.TestCase;
+import junit.framework.Test;
import org.jboss.mx.server.ServerConstants;
+import test.JBossMXTest;
import test.implementation.registry.support.Trivial;
/**
@@ -41,16 +42,14 @@
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class ValuesTestCase
- extends TestCase
+ extends JBossMXTest
implements ServerConstants
{
- // Attributes ----------------------------------------------------------------
+ public static Test suite()
+ {
+ return suite(ValuesTestCase.class);
+ }
- // Constructor ---------------------------------------------------------------
-
- /**
- * Construct the test
- */
public ValuesTestCase(String s)
{
super(s);
@@ -58,9 +57,7 @@
// Tests ---------------------------------------------------------------------
- /**
- * Test classloader
- */
+ @SuppressWarnings("unchecked")
public void testClassLoader()
throws Exception
{
@@ -112,9 +109,7 @@
}
}
- /**
- * Test value
- */
+ @SuppressWarnings("unchecked")
public void testValue()
throws Exception
{
@@ -166,9 +161,7 @@
}
}
- /**
- * Test value registered
- */
+ @SuppressWarnings("unchecked")
public void testValueRegistered()
throws Exception
{
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/support/Trivial.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/support/Trivial.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/registry/support/Trivial.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,6 +24,7 @@
public class Trivial implements TrivialMBean
{
private String something = null;
+ @SuppressWarnings("unused")
private boolean anAttribute = true;
public void setSomething(String thing)
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/server/ObjectInstanceTestCase.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/server/ObjectInstanceTestCase.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/server/ObjectInstanceTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,10 +21,6 @@
*/
package test.implementation.server;
-import junit.framework.TestCase;
-
-import test.implementation.server.support.Trivial;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -33,11 +29,16 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import junit.framework.Test;
+
import org.jboss.mx.server.ServerObjectInstance;
+import test.JBossMXTest;
+import test.implementation.server.support.Trivial;
+
/**
* Tests the ObjectInstance handling which is a bit brain-dead in the RI.<p>
*
@@ -46,15 +47,13 @@
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class ObjectInstanceTestCase
- extends TestCase
+ extends JBossMXTest
{
- // Attributes ----------------------------------------------------------------
+ public static Test suite()
+ {
+ return suite(ObjectInstanceTestCase.class);
+ }
- // Constructor ---------------------------------------------------------------
-
- /**
- * Construct the test
- */
public ObjectInstanceTestCase(String s)
{
super(s);
@@ -62,28 +61,18 @@
// Tests that should work in the RI ------------------------------------------
- /**
- * Test default domain
- */
- public void testDefaultDomain()
+ public void testDefaultDomain() throws Exception
{
MBeanServer server =null;
ObjectName unqualifiedName = null;
ObjectName qualifiedName = null;
ObjectInstance instance1 = null;
ObjectInstance instance2 = null;
- try
- {
- server = MBeanServerFactory.createMBeanServer();
- unqualifiedName = new ObjectName(":property=1");
- qualifiedName = new ObjectName("DefaultDomain:property=1");
- instance1 = server.registerMBean(new Trivial(), qualifiedName);
- instance2 = server.getObjectInstance(unqualifiedName);
- }
- catch (Exception e)
- {
- fail(e.toString());
- }
+ server = MBeanServerFactory.createMBeanServer();
+ unqualifiedName = new ObjectName(":property=1");
+ qualifiedName = new ObjectName("DefaultDomain:property=1");
+ instance1 = server.registerMBean(new Trivial(), qualifiedName);
+ instance2 = server.getObjectInstance(unqualifiedName);
assertEquals(instance1.getObjectName(),qualifiedName);
assertEquals(instance1, instance2);
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/server/ServerSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/server/ServerSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/server/ServerSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -51,7 +51,7 @@
{
TestSuite suite = new TestSuite("JBossMX Specific Server tests");
- suite.addTest(new TestSuite(ObjectInstanceTestCase.class));
+ suite.addTest(ObjectInstanceTestCase.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/server/support/Trivial.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/server/support/Trivial.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/server/support/Trivial.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,6 +24,7 @@
public class Trivial implements TrivialMBean
{
private String something = null;
+ @SuppressWarnings("unused")
private boolean anAttribute = true;
public void setSomething(String thing)
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/util/AgentIDTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/util/AgentIDTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/util/AgentIDTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -25,25 +25,24 @@
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
-import junit.framework.TestCase;
+import junit.framework.Test;
import org.jboss.mx.server.ServerConstants;
-import org.jboss.mx.util.AgentID;
+import org.jboss.mx.util.MBeanServerLocator;
+import test.JBossMXTest;
-public class AgentIDTEST extends TestCase implements ServerConstants
+
+public class AgentIDTEST extends JBossMXTest implements ServerConstants
{
- public AgentIDTEST(String s)
+ public static Test suite()
{
- super(s);
+ return suite(AgentIDTEST.class);
}
- public void testCreate()
+ public AgentIDTEST(String s)
{
- String id1 = AgentID.create();
- String id2 = AgentID.create();
-
- assertTrue(!id1.equals(id2));
+ super(s);
}
public void testGet()
@@ -52,7 +51,7 @@
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
String id1 = (String)server.getAttribute(new ObjectName(MBEAN_SERVER_DELEGATE), "MBeanServerId");
- String id2 = AgentID.get(server);
+ String id2 = MBeanServerLocator.getId(server);
assertTrue(id1.equals(id2));
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/util/MBeanProxyTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/util/MBeanProxyTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/util/MBeanProxyTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,10 +21,9 @@
*/
package test.implementation.util;
+import java.lang.reflect.Method;
import java.util.Set;
-import java.lang.reflect.Method;
-
import javax.management.Attribute;
import javax.management.AttributeNotFoundException;
import javax.management.DynamicMBean;
@@ -33,39 +32,43 @@
import javax.management.MBeanServerFactory;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
-
import javax.management.modelmbean.ModelMBean;
-import javax.management.modelmbean.RequiredModelMBean;
-import test.implementation.util.support.Trivial;
-import test.implementation.util.support.TrivialMBean;
-import test.implementation.util.support.Trivial2;
-import test.implementation.util.support.Trivial2MBean;
+import junit.framework.Test;
+
+import org.jboss.mx.modelmbean.RequiredModelMBeanInstantiator;
+import org.jboss.mx.modelmbean.XMBean;
+import org.jboss.mx.util.DefaultExceptionHandler;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.ProxyContext;
+
+import test.JBossMXTest;
import test.implementation.util.support.ExtendedResource;
import test.implementation.util.support.MyInterface;
import test.implementation.util.support.MyInterface2;
import test.implementation.util.support.Resource;
+import test.implementation.util.support.ResourceIncorrectInfo;
import test.implementation.util.support.ResourceOverride;
-import test.implementation.util.support.ResourceIncorrectInfo;
+import test.implementation.util.support.Trivial;
+import test.implementation.util.support.Trivial2;
+import test.implementation.util.support.Trivial2MBean;
+import test.implementation.util.support.TrivialMBean;
-import junit.framework.TestCase;
-import org.jboss.mx.util.AgentID;
-import org.jboss.mx.util.DefaultExceptionHandler;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.ProxyContext;
-
-import org.jboss.mx.modelmbean.XMBean;
-
-
/**
* Tests for mbean proxy
*
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
*/
-public class MBeanProxyTEST extends TestCase
+public class MBeanProxyTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(MBeanProxyTEST.class);
+ }
+
public MBeanProxyTEST(String s)
{
super(s);
@@ -87,7 +90,7 @@
public void testGetWithAgentID() throws Exception
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
- String agentID = AgentID.get(server);
+ String agentID = MBeanServerLocator.getId(server);
ObjectName oname = new ObjectName("test:name=test");
server.registerMBean(new Trivial(), oname);
@@ -113,7 +116,7 @@
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("test:test=test");
- String agentID = AgentID.get(server);
+ String agentID = MBeanServerLocator.getId(server);
TrivialMBean mbean = (TrivialMBean)MBeanProxy.create(
Trivial.class, TrivialMBean.class, oname, agentID);
@@ -129,7 +132,7 @@
server.registerMBean(new Trivial(), oname);
TrivialMBean mbean = (TrivialMBean)MBeanProxy.get(
- TrivialMBean.class, oname, AgentID.get(server));
+ TrivialMBean.class, oname, MBeanServerLocator.getId(server));
mbean.doOperation();
mbean.setSomething("JBossMX");
@@ -145,7 +148,7 @@
server.registerMBean(new Trivial(), oname);
TrivialMBean mbean = (TrivialMBean)MBeanProxy.get(
- TrivialMBean.class, oname, AgentID.get(server));
+ TrivialMBean.class, oname, MBeanServerLocator.getId(server));
mbean.getMBeanServer();
assertTrue(mbean.isGMSInvoked());
@@ -226,6 +229,7 @@
assertTrue(((Boolean)server.getAttribute(oname, "OperationInvoked")).booleanValue());
}
+ @SuppressWarnings("unchecked")
public void testContextAccessToMBeanServer() throws Exception
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
@@ -244,10 +248,10 @@
assertTrue(oi.getObjectName().equals(oname));
- assertTrue(srvr.getAttribute(
+ assertEquals("JBossMX", srvr.getAttribute(
new ObjectName("JMImplementation:type=MBeanServerDelegate"),
"ImplementationName"
- ).equals("JBossMX"));
+ ));
}
@@ -256,7 +260,7 @@
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("test:test=test");
- RequiredModelMBean rmm = new RequiredModelMBean();
+ ModelMBean rmm = RequiredModelMBeanInstantiator.instantiate();
Resource resource = new Resource();
rmm.setManagedResource(resource, "ObjectReference");
@@ -271,7 +275,7 @@
mbean.setAttributeName("foo");
mbean.setAttributeName2("bar");
- assertTrue(mbean.getAttributeName2().equals("bar"));
+ assertEquals("bar", mbean.getAttributeName2());
assertTrue(mbean.doOperation().equals("tamppi"));
}
@@ -283,6 +287,8 @@
* RuntimeProxyExceptions. See org.jboss.mx.proxy.DefaultExceptionHandler
* for details. This behavior can be changed at runtime through the proxy
* context interface setExceptionHandler() method.
+ *
+ * @throws Exception for any error
*/
public void testCustomExceptionHandler() throws Exception
{
@@ -290,7 +296,7 @@
ObjectName oname = new ObjectName("test:test=test");
ObjectName oname2 = new ObjectName("test:test=test2");
- RequiredModelMBean rmm = new RequiredModelMBean();
+ ModelMBean rmm = RequiredModelMBeanInstantiator.instantiate();
Resource resource = new Resource();
rmm.setManagedResource(resource, "ObjectReference");
@@ -327,7 +333,7 @@
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("test:test=test");
- RequiredModelMBean rmm = new RequiredModelMBean();
+ ModelMBean rmm = RequiredModelMBeanInstantiator.instantiate();
Resource resource = new Resource();
rmm.setManagedResource(resource, "ObjectReference");
@@ -341,7 +347,7 @@
mbean.toString();
- Object o = (Object)mbean;
+ Object o = mbean;
o.toString();
}
@@ -350,7 +356,7 @@
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("test:test=test");
- RequiredModelMBean rmm = new RequiredModelMBean();
+ ModelMBean rmm = RequiredModelMBeanInstantiator.instantiate();
ResourceOverride resource = new ResourceOverride();
rmm.setManagedResource(resource, "ObjectReference");
@@ -363,7 +369,7 @@
);
assertTrue(mbean.toString().equals("Resource"));
- Object o = (Object)mbean;
+ Object o = mbean;
assertTrue(o.toString().equals("Resource"));
}
@@ -372,7 +378,7 @@
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("test:test=test");
- RequiredModelMBean rmm = new RequiredModelMBean();
+ ModelMBean rmm = RequiredModelMBeanInstantiator.instantiate();
Resource resource = new Resource();
rmm.setManagedResource(resource, "ObjectReference");
@@ -386,7 +392,7 @@
mbean.hashCode();
- Object o = (Object)mbean;
+ Object o = mbean;
o.toString();
}
@@ -395,7 +401,7 @@
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("test:test=test");
- RequiredModelMBean rmm = new RequiredModelMBean();
+ ModelMBean rmm = RequiredModelMBeanInstantiator.instantiate();
ResourceOverride resource = new ResourceOverride();
rmm.setManagedResource(resource, "ObjectReference");
@@ -408,7 +414,7 @@
);
assertTrue(mbean.hashCode() == 10);
- Object o = (Object)mbean;
+ Object o = mbean;
assertTrue(o.hashCode() == 10);
}
@@ -443,7 +449,7 @@
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("test:test=test");
- ModelMBean rmm = new RequiredModelMBean();
+ ModelMBean rmm = RequiredModelMBeanInstantiator.instantiate();
ResourceOverride resource = new ResourceOverride("state");
rmm.setManagedResource(resource, "ObjectReference");
@@ -567,7 +573,7 @@
mbean.setAttribute3("Attribute3");
- assertTrue(mbean.getAttribute3().equals("Attribute3"));
+ assertEquals("Attribute3", mbean.getAttribute3());
}
public void testInheritanceInProxyReturnType() throws Exception
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/util/UtilSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/util/UtilSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/util/UtilSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,8 +35,8 @@
{
TestSuite suite = new TestSuite("JBossMX Util Tests");
- suite.addTest(new TestSuite(MBeanProxyTEST.class));
- suite.addTest(new TestSuite(AgentIDTEST.class));
+ suite.addTest(MBeanProxyTEST.suite());
+ suite.addTest(AgentIDTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/ExtendedResource.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/ExtendedResource.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/ExtendedResource.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,12 +24,15 @@
import javax.management.*;
import javax.management.modelmbean.*;
+import org.jboss.mx.modelmbean.ModelMBeanConstants;
+
/**
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
*/
public class ExtendedResource implements MyInterface2
{
+ @SuppressWarnings("unused")
private String attr = null;
private String attr2 = null;
private Object arg = null;
@@ -76,19 +79,35 @@
public ModelMBeanInfo getMBeanInfo()
{
+ DescriptorSupport descriptor = new DescriptorSupport();
+ descriptor.setField(ModelMBeanConstants.DESCRIPTOR_TYPE, ModelMBeanConstants.ATTRIBUTE_DESCRIPTOR);
+
+ DescriptorSupport attributeName = (DescriptorSupport) descriptor.clone();
+ attributeName.setField(ModelMBeanConstants.NAME, "AttributeName");
+
+ DescriptorSupport attributeName2 = (DescriptorSupport) descriptor.clone();
+ attributeName2.setField(ModelMBeanConstants.NAME, "AttributeName2");
+ attributeName2.setField(ModelMBeanConstants.GET_METHOD, "getAttributeName2");
+ attributeName2.setField(ModelMBeanConstants.SET_METHOD, "setAttributeName2");
+
+ DescriptorSupport attribute3 = (DescriptorSupport) descriptor.clone();
+ attribute3.setField(ModelMBeanConstants.NAME, "Attribute3");
+ attribute3.setField(ModelMBeanConstants.GET_METHOD, "getAttribute3");
+ attribute3.setField(ModelMBeanConstants.SET_METHOD, "setAttribute3");
+
ModelMBeanAttributeInfo[] attributes = new ModelMBeanAttributeInfo[]
{
new ModelMBeanAttributeInfo(
"AttributeName", "java.lang.String", "description",
- false, true, false
+ false, true, false, attributeName
),
new ModelMBeanAttributeInfo(
"AttributeName2", "java.lang.String", "description",
- true, true, false
+ true, true, false, attributeName2
),
new ModelMBeanAttributeInfo(
"Attribute3", "java.lang.Object", "description",
- true, true, false
+ true, true, false, attribute3
)
};
@@ -105,7 +124,7 @@
"arg", "java.lang.Object", "description"
)
},
- "java.lang.Object", 1
+ "java.lang.String", 1
),
new ModelMBeanOperationInfo(
"runMe", "description",
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/Resource.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/Resource.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/Resource.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,11 +21,14 @@
*/
package test.implementation.util.support;
+import javax.management.modelmbean.DescriptorSupport;
import javax.management.modelmbean.ModelMBeanInfo;
import javax.management.modelmbean.ModelMBeanInfoSupport;
import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanOperationInfo;
+import org.jboss.mx.modelmbean.ModelMBeanConstants;
+
/**
* @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
* @version $Revision$
@@ -34,15 +37,25 @@
{
public ModelMBeanInfo getMBeanInfo()
{
+ DescriptorSupport descriptor = new DescriptorSupport();
+ descriptor.setField(ModelMBeanConstants.DESCRIPTOR_TYPE, ModelMBeanConstants.ATTRIBUTE_DESCRIPTOR);
+ descriptor.setField(ModelMBeanConstants.CURRENCY_TIME_LIMIT, ModelMBeanConstants.CACHE_ALWAYS);
+
+ DescriptorSupport attributeName = (DescriptorSupport) descriptor.clone();
+ attributeName.setField(ModelMBeanConstants.NAME, "AttributeName");
+
+ DescriptorSupport attributeName2 = (DescriptorSupport) descriptor.clone();
+ attributeName2.setField(ModelMBeanConstants.NAME, "AttributeName2");
+
ModelMBeanAttributeInfo[] attributes = new ModelMBeanAttributeInfo[]
{
new ModelMBeanAttributeInfo(
"AttributeName", "java.lang.String", "description",
- false, true, false
+ false, true, false, attributeName
),
new ModelMBeanAttributeInfo(
"AttributeName2", "java.lang.String", "description",
- true, true, false
+ true, true, false, attributeName2
)
};
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/ResourceOverride.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/ResourceOverride.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/ResourceOverride.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -39,6 +39,7 @@
// Attributes ----------------------------------------------------
+ @SuppressWarnings("unused")
private String state = null;
Modified: projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/Trivial.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/Trivial.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/implementation/util/support/Trivial.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -31,6 +31,7 @@
public class Trivial implements TrivialMBean
{
private String something = null;
+ @SuppressWarnings("unused")
private boolean anAttribute = true;
private boolean gmsWasInvoked = false;
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/PerformanceSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/PerformanceSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/PerformanceSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -54,9 +54,7 @@
suite.addTest(test.performance.standard.StandardSUITE.suite());
suite.addTest(test.performance.modelmbean.ModelMBeanSUITE.suite());
suite.addTest(test.performance.invocationhandler.InvocationHandlerSUITE.suite());
- suite.addTest(test.performance.serialize.SerializeSUITE.suite());
suite.addTest(test.performance.registration.RegistrationSUITE.suite());
- suite.addTest(test.performance.timer.TimerSUITE.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/DynamicSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/DynamicSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/DynamicSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -35,7 +35,7 @@
{
TestSuite suite = new TestSuite("Performance tests for Dynamic MBeans");
- suite.addTest(new TestSuite(ThroughputTEST.class));
+ suite.addTest(ThroughputTEST.suite());
return suite;
}
Deleted: projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/InvocationTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/InvocationTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/InvocationTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,255 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package test.performance.dynamic;
-
-import junit.framework.TestCase;
-import test.performance.PerformanceSUITE;
-import test.performance.dynamic.support.Dyn;
-
-import javax.management.*;
-
-
-public class InvocationTEST extends TestCase
-{
-
- public InvocationTEST(String s)
- {
- super(s);
- }
-
- public void testVoidInvocationWithDefaultDomain()
- {
- try
- {
- System.out.println("\nDYNAMIC: void invocation with DefaultDomain");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName(":performanceTest=dynamic");
- String method = "methodInvocation";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(new Dyn(), name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
- MBeanServerFactory.releaseMBeanServer(server);
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
-
- }
-
- public void testVoidInvocation()
- {
- try
- {
- System.out.println("\nDYNAMIC: void invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=dynamic");
- String method = "methodInvocation";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(new Dyn(), name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
- MBeanServerFactory.releaseMBeanServer(server);
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- }
-
- public void testCounterInvocation()
- {
- try
- {
- System.out.println("\nDYNAMIC: counter invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=dynamic");
- Dyn mbean = new Dyn();
- String method = "counter";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(mbean, name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
- MBeanServerFactory.releaseMBeanServer(server);
-
- assertTrue(mbean.getCount() == (PerformanceSUITE.REPEAT_COUNT + 1)*PerformanceSUITE.ITERATION_COUNT);
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- }
-
-
- public void testMixedArgsInvocation()
- {
- try
- {
- System.out.println("\nDYNAMIC: mixed arguments invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=dynamic");
- Dyn mbean = new Dyn();
-
- String method = "mixedArguments";
- String[] signature = new String[] {
- Integer.class.getName(),
- int.class.getName(),
- Object[][][].class.getName(),
- Attribute.class.getName()
- };
-
- Object[] args = new Object[] {
- new Integer(1234),
- new Integer(455617),
- new Object[][][] {
- {
- { "1x1x1", "1x1x2", "1x1x3" },
- { "1x2x1", "1x2x2", "1x2x3" },
- { "1x3x1", "1x3x2", "1x3x3" }
- },
-
- {
- { "2x1x1", "2x1x2", "2x1x3" },
- { "2x2x1", "2x2x2", "2x2x3" },
- { "2x3x1", "2x3x2", "2x3x3" }
- },
-
- {
- { "3x1x1", "3x1x2", "3x1x3" },
- { "3x2x1", "3x2x2", "3x2x3" },
- { "3x3x1", "3x3x2", "3x3x3" }
- }
- },
- new Attribute("attribute", "value")
- };
-
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(mbean, name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, args, signature);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
- MBeanServerFactory.releaseMBeanServer(server);
-
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- }
-
-}
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/ThroughputTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/ThroughputTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/dynamic/ThroughputTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,15 +21,23 @@
*/
package test.performance.dynamic;
-import junit.framework.TestCase;
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+import test.JBossMXTest;
import test.performance.PerformanceSUITE;
import test.performance.dynamic.support.Dyn;
-import javax.management.*;
-
-public class ThroughputTEST extends TestCase
+public class ThroughputTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(ThroughputTEST.class);
+ }
public ThroughputTEST(String s)
{
@@ -87,7 +95,7 @@
t.start();
while(myThread.isKeepRunning())
{
- Object o = server.invoke(name, method, args, signature);
+ server.invoke(name, method, args, signature);
}
System.out.println("\nDynamic MBean Throughput: " +
@@ -157,7 +165,7 @@
t.start();
while(myThread.isKeepRunning())
{
- Object o = server.invoke(name, method, args, signature);
+ server.invoke(name, method, args, signature);
}
System.out.println("\nDynamic MBean Throughput (DEFAULTDOMAIN): " +
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/invocationhandler/InvocationHandlerSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/invocationhandler/InvocationHandlerSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/invocationhandler/InvocationHandlerSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -41,7 +41,7 @@
{
TestSuite suite = new TestSuite("Performance tests for MBeanServerInvocationHandler");
- suite.addTest(new TestSuite(ThroughputTEST.class));
+ suite.addTest(ThroughputTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/invocationhandler/ThroughputTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/invocationhandler/ThroughputTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/invocationhandler/ThroughputTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,15 +21,24 @@
*/
package test.performance.invocationhandler;
-import junit.framework.TestCase;
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+import test.JBossMXTest;
import test.performance.PerformanceSUITE;
import test.performance.invocationhandler.support.Standard;
import test.performance.invocationhandler.support.StandardMBean;
-import javax.management.*;
-
-public class ThroughputTEST extends TestCase
+public class ThroughputTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(ThroughputTEST.class);
+ }
public ThroughputTEST(String s)
{
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/modelmbean/ModelMBeanSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/modelmbean/ModelMBeanSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/modelmbean/ModelMBeanSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -41,7 +41,7 @@
{
TestSuite suite = new TestSuite("Performance tests for Model MBeans");
- suite.addTest(new TestSuite(ThroughputTEST.class));
+ suite.addTest(ThroughputTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/modelmbean/ThroughputTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/modelmbean/ThroughputTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/modelmbean/ThroughputTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,15 +21,31 @@
*/
package test.performance.modelmbean;
-import junit.framework.TestCase;
+import javax.management.Attribute;
+import javax.management.MBeanParameterInfo;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.management.modelmbean.DescriptorSupport;
+import javax.management.modelmbean.ModelMBeanAttributeInfo;
+import javax.management.modelmbean.ModelMBeanConstructorInfo;
+import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.ModelMBeanInfoSupport;
+import javax.management.modelmbean.ModelMBeanNotificationInfo;
+import javax.management.modelmbean.ModelMBeanOperationInfo;
+import javax.management.modelmbean.RequiredModelMBean;
+
+import junit.framework.Test;
+import test.JBossMXTest;
import test.performance.PerformanceSUITE;
import test.performance.modelmbean.support.Resource;
-import javax.management.*;
-import javax.management.modelmbean.*;
-
-public class ThroughputTEST extends TestCase
+public class ThroughputTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(ThroughputTEST.class);
+ }
public ThroughputTEST(String s)
{
@@ -123,10 +139,6 @@
private ModelMBeanInfo getManagementInterface()
{
- final boolean READABLE = true;
- final boolean WRITABLE = true;
- final boolean BOOLEAN = true;
-
// registerMBean operation
DescriptorSupport descMixedArgs = new DescriptorSupport();
descMixedArgs.setField("name", "invokeMixedArgs");
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/registration/RegistrationSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/registration/RegistrationSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/registration/RegistrationSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,8 +24,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import test.performance.registration.support.Standard;
-
/**
* Registration performance tests.
*
@@ -53,7 +51,7 @@
{
TestSuite suite = new TestSuite("Registation Performance tests");
- suite.addTest(new RegistrationTEST("testIt", new Standard(), "test:test=test", "Standard"));
+ suite.addTest(RegistrationTEST.suite());
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/registration/RegistrationTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/registration/RegistrationTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/registration/RegistrationTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,24 +21,28 @@
*/
package test.performance.registration;
-import junit.framework.TestCase;
-
-import test.performance.PerformanceSUITE;
-
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
+import junit.framework.Test;
+import test.JBossMXTest;
+import test.performance.PerformanceSUITE;
+import test.performance.registration.support.Standard;
+
/**
* Tests the speed of registrion
*
* @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
*/
public class RegistrationTEST
- extends TestCase
+ extends JBossMXTest
{
- // Attributes ----------------------------------------------------------------
-
+ public static Test suite()
+ {
+ return suite(RegistrationTEST.class);
+ }
+
/**
* The object to register
*/
@@ -56,15 +60,12 @@
// Constructor ---------------------------------------------------------------
- /**
- * Construct the test
- */
- public RegistrationTEST(String s, Object obj, String name, String desc)
+ public RegistrationTEST(String s)
{
super(s);
- this.obj = obj;
- this.name = name;
- this.desc = desc;
+ this.obj = new Standard();
+ this.name = "test:test=test";
+ this.desc = "Standard";
}
/**
@@ -78,7 +79,6 @@
long start = 0, end = 0;
float avg = 0l;
- int size = 0;
MBeanServer server = MBeanServerFactory.createMBeanServer();
try
Deleted: projects/jbossmx/trunk/jmx/src/test/test/performance/standard/InvocationTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/standard/InvocationTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/standard/InvocationTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,250 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package test.performance.standard;
-
-import junit.framework.TestCase;
-import test.performance.PerformanceSUITE;
-import test.performance.standard.support.Standard;
-
-import javax.management.*;
-
-
-public class InvocationTEST extends TestCase
-{
-
- public InvocationTEST(String s)
- {
- super(s);
- }
-
- public void testVoidInvocationWithDefaultDomain()
- {
- try
- {
- System.out.println("\nSTANDARD: void invocation with DefaultDomain");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName(":performanceTest=standard");
- String method = "methodInvocation";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(new Standard(), name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- }
-
- public void testVoidInvocation()
- {
- try
- {
- System.out.println("\nSTANDARD: void invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=standard");
- String method = "methodInvocation";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(new Standard(), name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- }
-
- public void testCounterInvocation()
- {
- try
- {
- System.out.println("\nSTANDARD: counter invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=standard");
- Standard mbean = new Standard();
- String method = "counter";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(mbean, name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
-
- assertTrue(mbean.getCount() == (PerformanceSUITE.REPEAT_COUNT + 1)*PerformanceSUITE.ITERATION_COUNT);
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- }
-
-
- public void testMixedArgsInvocation()
- {
- try
- {
- System.out.println("\nSTANDARD: mixed arguments invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=standard");
- Standard mbean = new Standard();
-
- String method = "mixedArguments";
- String[] signature = new String[] {
- Integer.class.getName(),
- int.class.getName(),
- Object[][][].class.getName(),
- Attribute.class.getName()
- };
-
- Object[] args = new Object[] {
- new Integer(1234),
- new Integer(455617),
- new Object[][][] {
- {
- { "1x1x1", "1x1x2", "1x1x3" },
- { "1x2x1", "1x2x2", "1x2x3" },
- { "1x3x1", "1x3x2", "1x3x3" }
- },
-
- {
- { "2x1x1", "2x1x2", "2x1x3" },
- { "2x2x1", "2x2x2", "2x2x3" },
- { "2x3x1", "2x3x2", "2x3x3" }
- },
-
- {
- { "3x1x1", "3x1x2", "3x1x3" },
- { "3x2x1", "3x2x2", "3x2x3" },
- { "3x3x1", "3x3x2", "3x3x3" }
- }
- },
- new Attribute("attribute", "value")
- };
-
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(mbean, name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, args, signature);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
-
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- }
-
-}
Deleted: projects/jbossmx/trunk/jmx/src/test/test/performance/standard/OptimizedInvocationTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/standard/OptimizedInvocationTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/standard/OptimizedInvocationTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,287 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package test.performance.standard;
-
-import junit.framework.TestCase;
-import test.performance.PerformanceSUITE;
-import test.performance.standard.support.Standard;
-
-import javax.management.*;
-
-import org.jboss.mx.server.ServerConstants;
-
-/**
- * Tests the performance of the byte code optimized invocation dispatcher.
- *
- * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
- * @version $Revision$
- *
- */
-public class OptimizedInvocationTEST extends TestCase
- implements ServerConstants
-{
-
- public OptimizedInvocationTEST(String s)
- {
- super(s);
- }
-
- public void testVoidInvocationWithDefaultDomain()
- {
- try
- {
- System.setProperty(OPTIMIZE_REFLECTED_DISPATCHER, "true");
-
-
- System.out.println("\nSTANDARD (OPTIMIZED): void invocation with DefaultDomain");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName(":performanceTest=standard");
- String method = "methodInvocation";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(new Standard(), name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- finally
- {
- System.setProperty(OPTIMIZE_REFLECTED_DISPATCHER, "false");
- }
- }
-
- public void testVoidInvocation()
- {
- try
- {
- System.setProperty(OPTIMIZE_REFLECTED_DISPATCHER, "true");
-
-
- System.out.println("\nSTANDARD (OPTIMIZED): void invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=standard");
- String method = "methodInvocation";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(new Standard(), name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- finally
- {
- System.setProperty(OPTIMIZE_REFLECTED_DISPATCHER, "false");
- }
- }
-
- public void testCounterInvocation()
- {
- try
- {
- System.setProperty(OPTIMIZE_REFLECTED_DISPATCHER, "true");
-
-
- System.out.println("\nSTANDARD (OPTIMIZED): counter invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=standard");
- Standard mbean = new Standard();
- String method = "counter";
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(mbean, name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, null, null);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
-
- assertTrue(mbean.getCount() == (PerformanceSUITE.REPEAT_COUNT + 1)*PerformanceSUITE.ITERATION_COUNT);
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- finally
- {
- System.setProperty(OPTIMIZE_REFLECTED_DISPATCHER, "false");
- }
- }
-
-
- public void testMixedArgsInvocation()
- {
- try
- {
- System.setProperty(OPTIMIZE_REFLECTED_DISPATCHER, "true");
-
- System.out.println("\nSTANDARD (OPTIMIZED): mixed arguments invocation");
- System.out.println(PerformanceSUITE.ITERATION_COUNT + " Invocations, Repeat: x" + PerformanceSUITE.REPEAT_COUNT);
- System.out.println("(this may take a while...)\n");
-
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- ObjectName name = new ObjectName("Domain:performanceTest=standard");
- Standard mbean = new Standard();
-
- String method = "mixedArguments";
- String[] signature = new String[] {
- Integer.class.getName(),
- int.class.getName(),
- Object[][][].class.getName(),
- Attribute.class.getName()
- };
-
- Object[] args = new Object[] {
- new Integer(1234),
- new Integer(455617),
- new Object[][][] {
- {
- { "1x1x1", "1x1x2", "1x1x3" },
- { "1x2x1", "1x2x2", "1x2x3" },
- { "1x3x1", "1x3x2", "1x3x3" }
- },
-
- {
- { "2x1x1", "2x1x2", "2x1x3" },
- { "2x2x1", "2x2x2", "2x2x3" },
- { "2x3x1", "2x3x2", "2x3x3" }
- },
-
- {
- { "3x1x1", "3x1x2", "3x1x3" },
- { "3x2x1", "3x2x2", "3x2x3" },
- { "3x3x1", "3x3x2", "3x3x3" }
- }
- },
- new Attribute("attribute", "value")
- };
-
- long start = 0, end = 0;
- float avg = 0l;
-
- server.registerMBean(mbean, name);
-
- // drop the first batch (+1)
- for (int testIterations = 0; testIterations < PerformanceSUITE.REPEAT_COUNT + 1; ++testIterations)
- {
- start = System.currentTimeMillis();
- for (int invocationIterations = 0; invocationIterations < PerformanceSUITE.ITERATION_COUNT; ++invocationIterations)
- {
- server.invoke(name, method, args, signature);
- }
- end = System.currentTimeMillis();
-
- if (testIterations != 0)
- {
- long time = end - start;
- System.out.print( time + " ");
- avg += time;
- }
- }
-
- System.out.println("\nAverage: " + (avg/PerformanceSUITE.REPEAT_COUNT));
-
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- fail("Unexpected error: " + t.toString());
- }
- finally
- {
- System.setProperty(OPTIMIZE_REFLECTED_DISPATCHER, "false");
- }
-
- }
-
-}
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/standard/OptimizedThroughputTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/standard/OptimizedThroughputTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/standard/OptimizedThroughputTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,18 +21,27 @@
*/
package test.performance.standard;
-import junit.framework.TestCase;
-import test.performance.PerformanceSUITE;
-import test.performance.standard.support.Standard;
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
-import javax.management.*;
+import junit.framework.Test;
import org.jboss.mx.server.ServerConstants;
+import test.JBossMXTest;
+import test.performance.PerformanceSUITE;
+import test.performance.standard.support.Standard;
-public class OptimizedThroughputTEST extends TestCase
+
+public class OptimizedThroughputTEST extends JBossMXTest
implements ServerConstants
{
+ public static Test suite()
+ {
+ return suite(OptimizedThroughputTEST.class);
+ }
public OptimizedThroughputTEST(String s)
{
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/standard/StandardMBeanThroughputTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/standard/StandardMBeanThroughputTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/standard/StandardMBeanThroughputTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,14 +21,22 @@
*/
package test.performance.standard;
-import junit.framework.TestCase;
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+import test.JBossMXTest;
import test.performance.PerformanceSUITE;
import test.performance.standard.support.StandardMBeanExtension;
-import javax.management.*;
-
-public class StandardMBeanThroughputTEST extends TestCase
+public class StandardMBeanThroughputTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(StandardMBeanThroughputTEST.class);
+ }
public StandardMBeanThroughputTEST(String s)
{
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/standard/StandardSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/standard/StandardSUITE.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/standard/StandardSUITE.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -24,11 +24,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
-
/**
* Suite of performance tests for Standard MBeans.
*
@@ -45,27 +40,11 @@
public static Test suite()
{
TestSuite suite = new TestSuite("Performance tests for Standard MBeans");
-
- try
- {
- MBeanServer server = MBeanServerFactory.createMBeanServer();
-
- if ("JBossMX".equalsIgnoreCase((String)server.getAttribute(new ObjectName("JMImplementation:type=MBeanServerDelegate"), "ImplementationName")))
- {
- //suite.addTest(new TestSuite(OptimizedInvocationTEST.class));
- suite.addTest(new TestSuite(OptimizedThroughputTEST.class));
- }
- }
- catch (JMException e)
- {
- System.err.println("Unable to run optimized tests: " + e.toString());
- }
+ suite.addTest(OptimizedThroughputTEST.suite());
+ suite.addTest(ThroughputTEST.suite());
+ suite.addTest(StandardMBeanThroughputTEST.suite());
- //suite.addTest(new TestSuite(InvocationTEST.class));
- suite.addTest(new TestSuite(ThroughputTEST.class));
- suite.addTest(new TestSuite(StandardMBeanThroughputTEST.class));
-
return suite;
}
Modified: projects/jbossmx/trunk/jmx/src/test/test/performance/standard/ThroughputTEST.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/test/performance/standard/ThroughputTEST.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/jmx/src/test/test/performance/standard/ThroughputTEST.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -21,15 +21,23 @@
*/
package test.performance.standard;
-import junit.framework.TestCase;
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+import test.JBossMXTest;
import test.performance.PerformanceSUITE;
import test.performance.standard.support.Standard;
-import javax.management.*;
-
-public class ThroughputTEST extends TestCase
+public class ThroughputTEST extends JBossMXTest
{
+ public static Test suite()
+ {
+ return suite(ThroughputTEST.class);
+ }
public ThroughputTEST(String s)
{
Deleted: projects/jbossmx/trunk/mbeans/build.bat
===================================================================
--- projects/jbossmx/trunk/mbeans/build.bat 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/build.bat 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,98 +0,0 @@
- at echo off
-
-REM ======================================================================
-REM
-REM This is the main entry point for the build system.
-REM
-REM ======================================================================
-REM
-REM $Id$
-REM
-REM Authors:
-REM Jason Dillon <jason at planet57.com>
-REM Sacha Labourey <sacha.labourey at cogito-info.ch>
-REM
-
-REM ******************************************************
-REM Ignore the ANT_HOME variable: we want to use *our*
-REM ANT version and associated JARs.
-REM ******************************************************
-REM Ignore the users classpath, cause it might mess
-REM things up
-REM ******************************************************
-
-SETLOCAL
-
-set CLASSPATH=
-set ANT_HOME=
-set ANT_OPTS=
-
-REM ******************************************************
-REM - "for" loops have been unrolled for compatibility
-REM with some WIN32 systems.
-REM ******************************************************
-
-set NAMES=tools;
-set SUBFOLDERS=..;..\..;..\..\..;..\..\..\..
-
-REM ******************************************************
-REM ******************************************************
-
-SET EXECUTED=FALSE
-for %%i in (%NAMES%) do call :subLoop %%i %*
-
-goto :EOF
-
-
-REM ******************************************************
-REM ********* Search for names in the subfolders *********
-REM ******************************************************
-
-:subLoop
-SET SUBDIR=%1
-SHIFT
-
-set OTHER_ARGS=
-:setupArgs
-if %1a==a goto doneSetupArgs
-set OTHER_ARGS=%OTHER_ARGS% %1
-shift
-goto setupArgs
-:doneSetupArgs
-
-for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%SUBDIR%\bin\ant.bat -logger org.apache.tools.ant.NoBannerLogger %OTHER_ARGS%
-
-goto :EOF
-
-
-REM ******************************************************
-REM ************ Test if ANT Batch file exists ***********
-REM ******************************************************
-
-:testIfExists
-if exist %1 call :BatchFound %*
-
-goto :EOF
-
-
-REM ******************************************************
-REM ************** Batch file has been found *************
-REM ******************************************************
-
-:BatchFound
-if (%EXECUTED%)==(FALSE) call :ExecuteBatch %*
-set EXECUTED=TRUE
-
-goto :EOF
-
-REM ******************************************************
-REM ************* Execute Batch file only once ***********
-REM ******************************************************
-
-:ExecuteBatch
-echo Calling %*
-call %*
-
-:end
-
-pause
Deleted: projects/jbossmx/trunk/mbeans/build.sh
===================================================================
--- projects/jbossmx/trunk/mbeans/build.sh 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/build.sh 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,172 +0,0 @@
-#!/bin/sh
-### ====================================================================== ###
-## ##
-## This is the main entry point for the build system. ##
-## ##
-## Users should be sure to execute this file rather than 'ant' to ensure ##
-## the correct version is being used with the correct configuration. ##
-## ##
-### ====================================================================== ###
-
-# $Id$
-
-PROGNAME=`basename $0`
-DIRNAME=`dirname $0`
-GREP="grep"
-ROOT="/"
-
-# Ignore user's ANT_HOME if it is set
-ANT_HOME=""
-
-# the default search path for ant
-ANT_SEARCH_PATH="\
- tools
- tools/ant \
- tools/apache/ant \
- ant"
-
-# the default build file name
-ANT_BUILD_FILE="build.xml"
-
-# the default arguments
-ANT_OPTIONS="--noconfig -find $ANT_BUILD_FILE"
-
-# Use the maximum available, or set MAX_FD != -1 to use that
-MAX_FD="maximum"
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false;
-darwin=false;
-case "`uname`" in
- CYGWIN*)
- cygwin=true
- ;;
-
- Darwin*)
- darwin=true
- ;;
-esac
-
-#
-# Helper to complain.
-#
-die() {
- echo "${PROGNAME}: $*"
- exit 1
-}
-
-#
-# Helper to complain.
-#
-warn() {
- echo "${PROGNAME}: $*"
-}
-
-#
-# Helper to source a file if it exists.
-#
-maybe_source() {
- for file in $*; do
- if [ -f "$file" ]; then
- . $file
- fi
- done
-}
-
-search() {
- search="$*"
- for d in $search; do
- ANT_HOME="`pwd`/$d"
- ANT="$ANT_HOME/bin/ant"
- if [ -x "$ANT" ]; then
- # found one
- echo $ANT_HOME
- break
- fi
- done
-}
-
-#
-# Main function.
-#
-main() {
- # if there is a build config file. then source it
- maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"
-
- # Increase the maximum file descriptors if we can
- if [ $cygwin = "false" ]; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ]; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
- # use the system max
- MAX_FD="$MAX_FD_LIMIT"
- fi
-
- ulimit -n $MAX_FD
- if [ $? -ne 0 ]; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
- fi
-
- # try the search path
- ANT_HOME=`search $ANT_SEARCH_PATH`
-
- # try looking up to root
- if [ "x$ANT_HOME" = "x" ]; then
- target="build"
- _cwd=`pwd`
-
- while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
- cd ..
- cwd=`pwd`
- ANT_HOME=`search $ANT_SEARCH_PATH`
- done
-
- # make sure we get back
- cd $_cwd
-
- if [ "$cwd" != "$ROOT" ]; then
- found="true"
- fi
-
- # complain if we did not find anything
- if [ "$found" != "true" ]; then
- die "Could not locate Ant; check \$ANT or \$ANT_HOME."
- fi
- fi
-
- # make sure we have one
- ANT=$ANT_HOME/bin/ant
- if [ ! -x "$ANT" ]; then
- die "Ant file is not executable: $ANT"
- fi
-
- # need to specify planet57/buildmagic protocol handler package
- ANT_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"
-
- # setup some build properties
- ANT_OPTS="$ANT_OPTS -Dbuild.script=$0"
-
- # change to the directory where the script lives so users are not forced
- # to be in the same directory as build.xml
- cd $DIRNAME
-
- # export some stuff for ant
- export ANT ANT_HOME ANT_OPTS
-
- # execute in debug mode, or simply execute
- if [ "x$ANT_DEBUG" != "x" ]; then
- /bin/sh -x $ANT $ANT_OPTIONS "$@"
- else
- exec $ANT $ANT_OPTIONS "$@"
- fi
-}
-
-##
-## Bootstrap
-##
-
-main "$@"
Deleted: projects/jbossmx/trunk/mbeans/build.xml
===================================================================
--- projects/jbossmx/trunk/mbeans/build.xml 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/build.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -1,255 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE project [
- <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
- <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
- <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
-]>
-
-<!-- $Id$ -->
-
-<!--+======================================================================+-->
-<!--| JBoss (The OpenSource J2EE WebOS) Build File |-->
-<!--| |-->
-<!--| Distributable under LGPL license. |-->
-<!--| See terms of license at http://www.gnu.org. |-->
-<!--| |-->
-<!--| This file has been designed to work with the 'tools' module and |-->
-<!--| Buildmagic extentions. |-->
-<!--+======================================================================+-->
-
-<project default="main" name="JBoss/MBeans">
-
- <!--+====================================================================+-->
- <!--| Setup |-->
- <!--| |-->
- <!--| Include the common build elements. |-->
- <!--| |-->
- <!--| This defines several different targets, properties and paths. |-->
- <!--| It also sets up the basic extention tasks amoung other things. |-->
- <!--+====================================================================+-->
-
- &buildmagic;
-
- <!--+====================================================================+-->
- <!--| Initialization |-->
- <!--| |-->
- <!--| Initialize the build system. Other targets should depend on |-->
- <!--| 'init'. |-->
- <!--+====================================================================+-->
-
- <target name="init" unless="init.disable" depends="_buildmagic:init">
- </target>
-
- <!-- Added since in target.ent, but can not include since duplicate _default:init
- in buildmagic.ent -->
- <target name="_default:most"
- description="Builds almost everything."
- depends="output"/>
-
- <target name="_default:help"
- description="Show this help message."
- depends="_buildmagic:help:standard"/>
-
- <target name="_default:all"
- description="Builds everything."
- depends="most,docs"/>
-
-
- <!--+====================================================================+-->
- <!--| Configuration |-->
- <!--| |-->
- <!--| This target is invoked by the Buildmagic initialization logic |-->
- <!--| and should contain module specific configuration elements. |-->
- <!--+====================================================================+-->
-
- <target name="configure" unless="configure.disable">
-
- &libraries;
- &modules;
-
- <property name="source.classes" value="${module.source}/main"/>
- <property name="source.java" value="${source.classes}"/>
-
- <!-- Configure modules -->
- <path id="dependentmodule.classpath">
- <!-- Add dependent module classpath elements here. -->
- <path refid="jboss.common.core.classpath"/>
- <path refid="jboss.common.logging.spi.classpath"/>
- <path refid="jboss.common.logging.log4j.classpath"/>
- <path refid="jboss.common.logging.jdk.classpath"/>
- <path refid="jboss.j2se.classpath"/>
- <path refid="jboss.j2se.classpath"/>
- </path>
-
- <!-- Configure thirdparty libraries -->
- <path id="library.classpath">
- <path refid="apache.bcel.classpath"/>
- <path refid="apache.xerces.classpath"/>
- <path refid="dom4j.dom4j.classpath"/>
- <path refid="jboss.jbossxb.classpath"/>
- </path>
-
- <!-- The combined thirdparty classpath -->
- <path id="thirdparty.classpath">
- <path refid="library.classpath"/>
- <path refid="dependentmodule.classpath"/>
- </path>
-
- <!-- The classpath required to build classes. -->
- <path id="javac.classpath">
- <pathelement path="${classpath}"/>
- <pathelement path="${local.classpath}"/>
- <path refid="thirdparty.classpath"/>
- </path>
-
- <!-- Where source files live -->
- <property name="source.classes" value="${module.source}/main"/>
- <property name="source.docs" value="${module.source}/docs"/>
- <property name="source.etc" value="${module.source}/etc"/>
- <property name="source.examples" value="${module.source}/examples"/>
- <property name="source.bin" value="${module.source}/bin"/>
- <property name="source.resources" value="${module.source}/resources"/>
- <property name="source.stylesheets" value="${module.source}/stylesheets"/>
- <property name="source.web" value="${module.source}/web"/>
- <property name="source.test" value="${module.source}/test"/>
- <property name="source.java" value="${module.source}/main"/>
-
- <!-- Where build generated files will go -->
- <property name="build.api" value="${module.output}/api"/>
- <property name="build.bin" value="${module.output}/bin"/>
- <property name="build.classes" value="${module.output}/classes"/>
- <property name="build.docs" value="${module.output}/docs"/>
- <property name="build.stylesheets" value="${module.output}/stylesheets"/>
- <property name="build.etc" value="${module.output}/etc"/>
- <property name="build.examples" value="${module.output}/examples"/>
- <property name="build.gen" value="${module.output}/gen"/>
- <property name="build.gen.classes" value="${build.gen}/classes"/>
- <property name="build.jmx-api" value="${module.output}/jmx-api"/>
- <property name="build.jmx-doc" value="${module.output}/jmx-doc"/>
- <property name="build.lib" value="${module.output}/lib"/>
- <property name="build.deploy" value="${module.output}/deploy"/>
- <property name="build.reports" value="${module.output}/reports"/>
- <property name="build.resources" value="${module.output}/resources"/>
- <property name="build.todo" value="${module.output}/todo"/>
- <property name="build.web" value="${module.output}/web"/>
- <property name="build.log" value="${module.output}/log"/>
- <property name="build.cache" value="${module.output}/cache"/>
- <property name="build.test" value="${module.output}/test"/>
- <property name="build.gen.test" value="${build.gen}/test"/>
-
- <!-- Module name & version -->
- <property name="module.name" value="jbossmbeans"/>
- <property name="module.Name" value="JBoss/MBeans"/>
- <property name="javac.target" value="1.5"/>
- <property name="javac.source" value="1.5"/>
- <!-- Where build generated files will go -->
- <property name="build.reports" value="${module.output}/reports"/>
- <property name="build.classes" value="${module.output}/classes"/>
- <property name="build.lib" value="${module.output}/lib"/>
- <property name="build.api" value="${module.output}/api"/>
- <property name="build.etc" value="${module.output}/etc"/>
- <property name="build.gen-src" value="${module.output}/gen-src"/>
- <property name="build.gen" value="${module.output}/gen"/>
-
-
- <!--+=======================================+-->
- <!--| Override any default properties here. |-->
- <!--+=======================================+-->
-
- <property name="javadoc.packages" value="org.jboss.*"/>
-
- </target>
-
-
- <!--+====================================================================+-->
- <!--| Compile |-->
- <!--| |-->
- <!--| This target should depend on other compile-* targets for each |-->
- <!--| different type of compile that needs to be performed, short of |-->
- <!--| documentation compiles. |-->
- <!--+====================================================================+-->
-
- <target name="compile"
- description="Compile all source files."
- depends="init, _default:compile-classes, _default:compile-etc, compile-resources">
- <!-- Add module specific elements here. -->
- </target>
-
- <!-- Compile resource files (dtds) -->
- <target name="compile-resources" depends="init">
- <mkdir dir="${build.resources}"/>
- <copy todir="${build.resources}">
- <fileset dir="${source.resources}">
- <include name="dtd/*.dtd"/>
- <include name="*.xml"/>
- </fileset>
- </copy>
- </target>
-
- <!--+====================================================================+-->
- <!--| Generate Output |-->
- <!--| |-->
- <!--| Generates the target output for this module. Target output is |-->
- <!--| the output which is ment to be released or used by external |-->
- <!--| modules. |-->
- <!--+====================================================================+-->
-
- <target name="output"
- description="Generate all target output."
- depends="_buildmagic:build-bypass-check"
- unless="build-bypass.on">
-
- <call target="compile"/>
-
- <mkdir dir="${build.lib}"/>
-
- <!-- Build the jboss-mbeans.jar -->
- <jar jarfile="${build.lib}/jboss-mbeans.jar" manifest="${build.etc}/default.mf">
- <fileset dir="${build.classes}">
- <include name="**"/>
- </fileset>
- <!-- include dtds for xmbeans -->
- <fileset dir="${build.resources}">
- <include name="dtd/*.dtd"/>
- <!-- include descriptor for MBean Info DB service -->
- <include name="*-xmbeandd.xml"/>
- </fileset>
- </jar>
-
- <!-- Update the build marker to allow bypassing -->
- <touch file="${build-bypass.marker}"/>
-
- </target>
-
-
- <!--+====================================================================+-->
- <!--| Documents |-->
- <!--| |-->
- <!--| Generate all documentation for this module. |-->
- <!--+====================================================================+-->
-
-<!-- <target name="docs" depends="_default:docs">
- </target> -->
-
-
- <!--+====================================================================+-->
- <!--| Misc. |-->
- <!--| |-->
- <!--| Standard targets and psuedo-targets. |-->
- <!--+====================================================================+-->
-
- <target name="clean" depends="_default:clean">
- <!-- Add module specific elements here. -->
- </target>
-
- <target name="clobber" depends="_default:clobber">
- <!-- Add module specific elements here. -->
- </target>
-
- <!-- main, all, most and help are primary psuedo-targets -->
- <target name="main" depends="most"/>
- <target name="all" depends="_default:all"/>
- <target name="most" depends="_default:most"/>
- <target name="help" depends="_default:help"/>
-
-</project>
Modified: projects/jbossmx/trunk/mbeans/pom.xml
===================================================================
--- projects/jbossmx/trunk/mbeans/pom.xml 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/pom.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -14,7 +14,7 @@
<build>
<sourceDirectory>src/main</sourceDirectory>
- <!--<testSourceDirectory>src/tests</testSourceDirectory>-->
+ <testSourceDirectory>src/tests</testSourceDirectory>
<resources>
<resource>
<directory>src/resources</directory>
Modified: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/capability/DispatcherFactory.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/capability/DispatcherFactory.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/capability/DispatcherFactory.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -25,7 +25,6 @@
import org.jboss.mx.metadata.MethodMapper;
import org.jboss.mx.server.ServerConstants;
-import org.jboss.mx.util.PropertyAccess;
import javax.management.DynamicMBean;
import javax.management.IntrospectionException;
Added: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/capability/PropertyAccess.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/capability/PropertyAccess.java (rev 0)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/capability/PropertyAccess.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.capability;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/** System property access utilties that encapsulate the
+ * AccessController.doPrivileged calls required when running with a
+ * security manager. Use to access system properties when the callers
+ * permissions should not dictate whether or not access is allowed.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 85671 $
+ */
+class PropertyAccess
+{
+ static class PropertyReadAction implements PrivilegedAction<String>
+ {
+ private String name;
+ private String defaultValue;
+ PropertyReadAction(String name, String defaultValue)
+ {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+ public String run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ }
+ static class PropertyWriteAction implements PrivilegedAction<String>
+ {
+ private String name;
+ private String value;
+ PropertyWriteAction(String name, String value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+ public String run()
+ {
+ return System.setProperty(name, value);
+ }
+ }
+
+ public static String getProperty(String name)
+ {
+ return getProperty(name, null);
+ }
+
+ public static String getProperty(String name, String defaultValue)
+ {
+ PropertyReadAction action = new PropertyReadAction(name, defaultValue);
+ String property = AccessController.doPrivileged(action);
+ return property;
+ }
+
+ public static String setProperty(String name, String value)
+ {
+ PropertyWriteAction action = new PropertyWriteAction(name, value);
+ String property = AccessController.doPrivileged(action);
+ return property;
+ }
+
+}
Modified: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/interceptor/AbstractSharedInterceptor.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/interceptor/AbstractSharedInterceptor.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/interceptor/AbstractSharedInterceptor.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -40,7 +40,7 @@
import org.jboss.mx.modelmbean.RequiredModelMBeanInstantiator;
import org.jboss.mx.server.Invocation;
import org.jboss.mx.service.ServiceConstants;
-import org.jboss.mx.util.AgentID;
+import org.jboss.mx.util.MBeanServerLocator;
/**
@@ -149,7 +149,7 @@
if (names.size() > 0)
throw new InterceptorNameConflictException(
"A shared interceptor named '" + name + "' already registered " +
- "to this MBean server (" + AgentID.get(server) + ")"
+ "to this MBean server (" + MBeanServerLocator.getId(server) + ")"
);
// register the interceptor to server
@@ -169,7 +169,7 @@
// actually had a chance to register
throw new InterceptorNameConflictException(
"A shared interceptor named '" + name + "' already registered " +
- "to this MBean server (" + AgentID.get(server) + ")"
+ "to this MBean server (" + MBeanServerLocator.getId(server) + ")"
);
}
Modified: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/metadata/JBossXMBean10.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/metadata/JBossXMBean10.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/metadata/JBossXMBean10.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -425,13 +425,15 @@
boolean isReadable = true;
boolean isWritable = true;
- if (access.equalsIgnoreCase("read-only"))
- isWritable = false;
+ if (access != null)
+ {
+ if (access.equalsIgnoreCase("read-only"))
+ isWritable = false;
- else if (access.equalsIgnoreCase("write-only"))
- isReadable = false;
+ else if (access.equalsIgnoreCase("write-only"))
+ isReadable = false;
+ }
-
ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(
name, type, description, isReadable, isWritable, false, descr
);
Copied: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/ModelMBeanConstants.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/modelmbean/ModelMBeanConstants.java)
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/ModelMBeanConstants.java (rev 0)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/ModelMBeanConstants.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,218 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.modelmbean;
+
+/**
+ * Constants used with Model MBean implementations.
+ *
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
+ * @author <a href="mailto:thomas.diesler at jboss.com">Thomas Diesler</a>.
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>.
+ * @author Matt Munz
+ * @version $Revision$
+ */
+public interface ModelMBeanConstants
+{
+ // Model MBean notification type string -------------------------
+ String GENERIC_MODELMBEAN_NOTIFICATION = "jmx.modelmbean.generic";
+
+ // Mandatory descriptor fields -----------------------------------
+
+ String NAME = "name";
+ String DESCRIPTOR_TYPE = "descriptorType";
+
+ // Optional shared descriptor fields -----------------------------------
+
+ String CLASS = "class";
+ String CURRENCY_TIME_LIMIT = "currencyTimeLimit";
+ String DISPLAY_NAME = "displayName";
+ String LAST_UPDATED_TIME_STAMP = "lastUpdatedTimeStamp";
+ String LOG = "log";
+ String LOG_FILE = "logFile";
+ String PERSIST_POLICY = "persistPolicy";
+ String PERSIST_PERIOD = "persistPeriod";
+ String PRESENTATION_STRING = "presentationString";
+ String VISIBILITY = "visibility";
+
+ // MBean descriptor fields -----------------------------------
+
+ String PERSIST_LOCATION = "persistLocation";
+ String PERSIST_NAME = "persistName";
+ String EXPORT = "export";
+
+ // Attribute descriptor fields -----------------------------------
+
+ String CACHED_VALUE = "value"; // cached value, may be disabled
+ String ATTRIBUTE_VALUE = "attributeValue"; // last attribute value set
+ String DEFAULT = "default"; // default, if no accessors defined
+ String GET_METHOD = "getMethod";
+ String SET_METHOD = "setMethod";
+ String PROTOCOL_MAP = "protocolMap";
+
+ // constructor descriptor fields -----------------------------------
+
+ String ROLE = "role";
+
+ // Operation descriptor fields -----------------------------------
+
+ String TARGET_OBJECT = "targetObject";
+ String TARGET_TYPE = "targetType";
+
+ // Notification descriptor fields -----------------------------------
+
+ String SEVERITY = "severity";
+ String MESSAGE_ID = "messageId";
+
+ // Persistence policies ------------------------------------------
+ String PP_NEVER = "Never";
+ String PP_ON_TIMER = "OnTimer";
+ String PP_ON_UPDATE = "OnUpdate";
+ String PP_NO_MORE_OFTEN_THAN = "NoMoreOftenThan";
+ String PP_ALWAYS = "Always";
+
+ String[] PERSIST_POLICIES = new String[]
+ {
+ ModelMBeanConstants.PP_NEVER,
+ ModelMBeanConstants.PP_ON_TIMER,
+ ModelMBeanConstants.PP_ON_UPDATE,
+ ModelMBeanConstants.PP_NO_MORE_OFTEN_THAN,
+ ModelMBeanConstants.PP_ALWAYS
+ };
+
+ // Severities ------------------------------------------
+ String SEVERITY_UNKNOWN = "0";
+ String SEVERITY_NON_RECOVERABLE = "1";
+ String SEVERITY_CRITICAL = "2";
+ String SEVERITY_MAJOR = "3";
+ String SEVERITY_MINOR = "4";
+ String SEVERITY_WARNING = "5";
+ String SEVERITY_NORMAL = "6";
+
+ // Descriptor types ----------------------------------------------
+
+ String MBEAN_DESCRIPTOR = "mbean";
+ String ATTRIBUTE_DESCRIPTOR = "attribute";
+ String CONSTRUCTOR_DESCRIPTOR = "constructor";
+ String OPERATION_DESCRIPTOR = "operation";
+ String NOTIFICATION_DESCRIPTOR = "notification";
+
+ // Role types ----------------------------------------------------
+
+ String ROLE_CONSTRUCTOR = "constructor";
+ String ROLE_GETTER = "getter";
+ String ROLE_SETTER = "setter";
+ String ROLE_OPERATION = "operation";
+
+ // Visibility values ---------------------------------------------
+ String HIGH_VISIBILITY = "1";
+ String NORMAL_VISIBILITY = "2";
+ String LOW_VISIBILITY = "3";
+ String MINIMAL_VISIBILITY = "4";
+
+ // Cache policies ------------------------------------------------
+ String CACHE_NEVER = "-1";
+ long CACHE_NEVER_LIMIT = -1;
+ String CACHE_ALWAYS = "0";
+ long CACHE_ALWAYS_LIMIT = 0;
+
+ // Operation impact ----------------------------------------------
+ String ACTION = "ACTION";
+ String ACTION_INFO = "ACTION_INFO";
+ String INFO = "INFO";
+
+ // END of standard descriptor fields *****************************
+
+ // Default Model MBean resource type, <tt>"ObjectReference"</tt>.
+ String OBJECT_REF = "ObjectReference";
+
+ /**
+ * A convenience constant to use with
+ * {@link javax.management.modelmbean.ModelMBeanInfo#getDescriptors getDescriptors()}
+ * to return the descriptors of all management interface elements
+ * (a <tt>null</tt> string).
+ */
+ String ALL_DESCRIPTORS = null;
+
+ // Optional descriptor fields ------------------------------------
+
+ String LAST_RETURNED_TIME_STAMP = "lastReturnedTimestamp";
+
+ /** used to mark the update (set) of an ATTRIBUTE_VALUE */
+ String LAST_UPDATED_TIME_STAMP2 = "lastUpdatedTimeStamp2";
+
+ /** */
+ String INTERCEPTORS = "interceptors";
+ /**
+ * Indicates whether MBean Info should be stored.
+ */
+ String PERSIST_INFO = "persistmbeaninfo";
+ /**
+ * Indicates the FQN of the resource class
+ */
+ String RESOURCE_CLASS = "resourceClass";
+ /**
+ * constant used by the 1.0 xmbean parser
+ * this defines the name of the descriptor used to designate the persistence manager
+ * that is to be used for a given XMBean
+ */
+ String PERSISTENCE_MANAGER = "persistence-manager";
+
+ /**
+ * Used to store the JMX ObjectName of the MBean, so it can be referenced
+ * by subsystem that may need it
+ */
+ String OBJECT_NAME = "objectname";
+
+ /**
+ * Extended descriptor used in conjuction with DelegatingPersistenceManager
+ * to specify an external MBean service that will be used as a factory
+ * for creating AttributePersistenceManager objects.
+ *
+ * If the descriptor is not specified, the ObjectName below will be used
+ * as the default.
+ */
+ String DELEGATING_PM_SERVICE_DESCRIPTOR = "attribute-persistence-service";
+ String DELEGATING_PM_SERVICE_DEFAULT_VALUE = "jboss:service=AttributePersistenceService";
+
+ /**
+ * Extended descriptor used in conjuction with DelegatingPersistenceManager
+ * to specify the operation name that will be called on the external MBean service
+ * for creating AttributePersistenceManager objects.
+ *
+ * If the descriptor is not specified, the default will apply
+ */
+ String DELEGATING_PM_OPERATION_DESCRIPTOR = "attribute-persistence-operation";
+ String DELEGATING_PM_OPERATION_DEFAULT_VALUE = "apmCreate";
+
+ /** The MBeanServer injection id type */
+ final String MBEAN_SERVER_INJECTION_TYPE = "MBeanServerType";
+ /** The MBeanInfo injection id type */
+ final String MBEAN_INFO_INJECTION_TYPE = "MBeanInfoType";
+ /** The ObjectName injection id type */
+ final String OBJECT_NAME_INJECTION_TYPE = "ObjectNameType";
+
+ // Constants for metadata objects --------------------------------
+ boolean IS_READABLE = true;
+ boolean IS_WRITABLE = true;
+ boolean IS_IS = true;
+}
+
Added: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/PropertyAccess.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/PropertyAccess.java (rev 0)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/PropertyAccess.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.modelmbean;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/** System property access utilties that encapsulate the
+ * AccessController.doPrivileged calls required when running with a
+ * security manager. Use to access system properties when the callers
+ * permissions should not dictate whether or not access is allowed.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 85671 $
+ */
+class PropertyAccess
+{
+ static class PropertyReadAction implements PrivilegedAction<String>
+ {
+ private String name;
+ private String defaultValue;
+ PropertyReadAction(String name, String defaultValue)
+ {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+ public String run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ }
+ static class PropertyWriteAction implements PrivilegedAction<String>
+ {
+ private String name;
+ private String value;
+ PropertyWriteAction(String name, String value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+ public String run()
+ {
+ return System.setProperty(name, value);
+ }
+ }
+
+ public static String getProperty(String name)
+ {
+ return getProperty(name, null);
+ }
+
+ public static String getProperty(String name, String defaultValue)
+ {
+ PropertyReadAction action = new PropertyReadAction(name, defaultValue);
+ String property = AccessController.doPrivileged(action);
+ return property;
+ }
+
+ public static String setProperty(String name, String value)
+ {
+ PropertyWriteAction action = new PropertyWriteAction(name, value);
+ String property = AccessController.doPrivileged(action);
+ return property;
+ }
+
+}
Copied: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/RequiredModelMBeanInstantiator.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/modelmbean/RequiredModelMBeanInstantiator.java)
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/RequiredModelMBeanInstantiator.java (rev 0)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/modelmbean/RequiredModelMBeanInstantiator.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.modelmbean;
+
+import java.lang.reflect.Constructor;
+
+import javax.management.modelmbean.ModelMBean;
+import javax.management.modelmbean.ModelMBeanInfo;
+
+import org.jboss.mx.server.ServerConstants;
+
+/**
+ * ModelMBean instantiator. The ModelMBean implementation
+ * can be configured by setting a <tt>jbossmx.required.modelmbean.class</tt>
+ * system property.
+ *
+ * @see javax.management.modelmbean.ModelMBean
+ *
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
+ * @author <a href="mailto:Adrian at jboss.org">Adrian Brock</a>.
+ * @version $Revision$
+ */
+public class RequiredModelMBeanInstantiator
+{
+ public static ModelMBean instantiate()
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ String className = getClassName();
+ try
+ {
+ Class<?> modelMBean = cl.loadClass(className);
+ return (ModelMBean) modelMBean.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new Error("Cannot instantiate model mbean class. Class " + className + " not found.");
+ }
+ catch (ClassCastException e)
+ {
+ throw new Error("Cannot instantiate model mbean class. The target class is not an instance of ModelMBean interface.");
+ }
+ catch (Exception e)
+ {
+ throw new Error("Cannot instantiate model mbean class " + className + " with default constructor: " + e.getMessage());
+ }
+ }
+
+ public static ModelMBean instantiate(ModelMBeanInfo info)
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ String className = getClassName();
+ try
+ {
+ Class<?> modelMBean = cl.loadClass(className);
+ Constructor<?> constructor = modelMBean.getConstructor(new Class[] { ModelMBeanInfo.class });
+ return (ModelMBean) constructor.newInstance(new Object[] { info });
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new Error("Cannot instantiate model mbean class. Class " + className + " not found.");
+ }
+ catch (ClassCastException e)
+ {
+ throw new Error("Cannot instantiate model mbean class. The target class is not an instance of ModelMBean interface.");
+ }
+ catch (Exception e)
+ {
+ throw new Error("Cannot instantiate model mbean class " + className + ": " + e.toString());
+ }
+ }
+
+ public static String getClassName()
+ {
+ return PropertyAccess.getProperty
+ (
+ ServerConstants.REQUIRED_MODELMBEAN_CLASS_PROPERTY,
+ ServerConstants.DEFAULT_REQUIRED_MODELMBEAN_CLASS
+ );
+ }
+}
Modified: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/mxbean/MXBeanUtils.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/mxbean/MXBeanUtils.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/mxbean/MXBeanUtils.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -893,7 +893,7 @@
String name = names[i];
OpenType itemType = compositeType.getType(name);
Method method = getCompositeDataMethod(clazz, name, itemType == SimpleType.BOOLEAN);
- Object itemValue = method.invoke(value, null);
+ Object itemValue = method.invoke(value);
values[i] = construct(itemType, itemValue, context);
}
return new CompositeDataSupport(compositeType, names, values);
@@ -999,7 +999,7 @@
Method method = null;
try
{
- method = clazz.getMethod("get" + name, null);
+ method = clazz.getMethod("get" + name);
}
catch (NoSuchMethodException e)
{
@@ -1007,7 +1007,7 @@
{
try
{
- method = clazz.getMethod("is" + name, null);
+ method = clazz.getMethod("is" + name);
}
catch (NoSuchMethodException ignored)
{
Modified: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/persistence/DelegatingPersistenceManager.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/persistence/DelegatingPersistenceManager.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/persistence/DelegatingPersistenceManager.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -88,8 +88,9 @@
init(invoker, metadata);
}
- if (log.isDebugEnabled())
- log.debug("load() called for: '" + this.persistName + "'");
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace("load() called for: '" + this.persistName + "'");
AttributeList attrs = null;
@@ -111,8 +112,8 @@
// will triger a store() that should be ignored
setIsLoading(true);
- if (log.isDebugEnabled())
- log.debug("loading attributes: " + attrs);
+ if (trace)
+ log.trace("loading attributes: " + attrs);
invoker.setAttributes(attrs);
}
finally {
@@ -120,8 +121,8 @@
}
}
else {
- if (log.isDebugEnabled())
- log.debug("No attributes to load");
+ if (trace)
+ log.trace("No attributes to load");
}
}
@@ -149,8 +150,9 @@
return; // ignore call
}
else {
- if (log.isDebugEnabled())
- log.debug("store() called for: '" + this.persistName + "'");
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace("store() called for: '" + this.persistName + "'");
// placehold for attributes to be persisted
AttributeList attributes = new AttributeList();
@@ -158,8 +160,8 @@
// iterate over all attributes in metadata
MBeanAttributeInfo[] attrs = metadata.getAttributes();
- if (log.isDebugEnabled() && attrs.length > 0)
- log.debug("store() --- ModelMBeanAttributeInfo[] ---");
+ if (trace && attrs.length > 0)
+ log.trace("store() --- ModelMBeanAttributeInfo[] ---");
for (int i = 0; i < attrs.length; i++)
{
@@ -167,8 +169,8 @@
// create a new Attribute object and add it to the collection.
ModelMBeanAttributeInfo attributeInfo = (ModelMBeanAttributeInfo)attrs[i];
- if (log.isDebugEnabled())
- log.debug(" attr (#" + i + ") - " + attributeInfo);
+ if (trace)
+ log.trace(" attr (#" + i + ") - " + attributeInfo);
if (attributeInfo.isWritable()) {
Descriptor attrDesc = attributeInfo.getDescriptor();
@@ -195,18 +197,18 @@
try {
if (!attributes.isEmpty()) {
- if (log.isDebugEnabled())
- log.debug("calling persistor.store(" + this.persistName + ") attrs=" + attributes);
+ if (trace)
+ log.trace("calling persistor.store(" + this.persistName + ") attrs=" + attributes);
persistor.store(this.persistName, attributes);
}
else {
- if (log.isDebugEnabled())
- log.debug("nothing to persist");
+ if (trace)
+ log.trace("nothing to persist");
}
}
catch (Exception e) {
- log.warn("cought exception during store()", e);
+ log.warn("caught exception during store()", e);
}
}
}
@@ -227,9 +229,10 @@
{
Descriptor desc = ((ModelMBeanInfo)metadata).getMBeanDescriptor();
- if (log.isDebugEnabled()) {
- log.debug("init() --- ModelMBeanInfo Descriptor --- ");
- log.debug(desc);
+ boolean trace = log.isTraceEnabled();
+ if (trace) {
+ log.trace("init() --- ModelMBeanInfo Descriptor --- ");
+ log.trace(desc);
}
// Decide what to use as a persistent name (id) for this MBean
@@ -252,8 +255,8 @@
}
}
- if (log.isDebugEnabled())
- log.debug("chosen persistent id: '" + this.persistName + "'");
+ if (trace)
+ log.trace("chosen persistent id: '" + this.persistName + "'");
// get the name of the MBean factory service that creates
// the AttributePersistenceManager implementation
@@ -295,8 +298,8 @@
throw new MBeanException(e);
}
- if (log.isDebugEnabled())
- log.debug("using AttributePersistenceManager: " + this.persistor.getClass().getName());
+ if (trace)
+ log.trace("using AttributePersistenceManager: " + this.persistor.getClass().getName());
}
/**
Copied: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/server/ExceptionHandler.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/server/ExceptionHandler.java)
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/server/ExceptionHandler.java (rev 0)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/server/ExceptionHandler.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.server;
+
+// $Id$
+
+import javax.management.*;
+
+/**
+ * Handles exceptions and wraps them if neccessary, arccording to the spec.
+ *
+ * @author thomas.diesler at jboss.org
+ */
+public class ExceptionHandler
+{
+
+ // hide constructor
+ private ExceptionHandler()
+ {
+ }
+
+ /**
+ * Handles exceptions and wraps them if neccessary, arccording to the spec.
+ *
+ * @param t the exception thrown by the invocation
+ * @return any wrapped exception
+ */
+ public static JMException handleException(Throwable t)
+ {
+ handleRuntimeExceptionOrError(t);
+
+ // when we get here, only exceptions are left
+ Exception e = (Exception)t;
+
+ if (e instanceof OperationsException)
+ return (OperationsException)e;
+ if (e instanceof ReflectionException)
+ return (ReflectionException)e;
+ if (e instanceof MBeanRegistrationException)
+ return (MBeanRegistrationException)e;
+
+ // wrap the core java exceptions
+ if (e instanceof ClassNotFoundException)
+ return new ReflectionException(e);
+ if (e instanceof IllegalAccessException)
+ return new ReflectionException(e);
+ if (e instanceof InstantiationException)
+ return new ReflectionException(e);
+ if (e instanceof NoSuchMethodException)
+ return new ReflectionException(e);
+
+ // The MBeanException is the one that might wrap other exceptions
+ // For example, the AbstractMBeanInvoker.invoke cannot throw OperationsException
+ if (e instanceof MBeanException)
+ {
+ Throwable cause = e.getCause();
+
+ if (cause instanceof JMException)
+ return (JMException)cause;
+ else
+ return (MBeanException)e;
+ }
+
+ // wrap any exception thrown by an mbean
+ return new MBeanException(e);
+ }
+
+ /**
+ * Handles runtime exceptions and rethrows them wraped if neccessary, arccording to the spec.
+ *
+ * @param e the exception thrown by the invocation
+ */
+ private static void handleRuntimeExceptionOrError(Throwable e)
+ {
+ // is already of throwable type
+ if (e instanceof RuntimeOperationsException)
+ throw (RuntimeOperationsException)e;
+ if (e instanceof RuntimeErrorException)
+ throw (RuntimeErrorException)e;
+ if (e instanceof RuntimeMBeanException)
+ throw (RuntimeMBeanException)e;
+
+ // wrap java core runtime exceptions
+ if (e instanceof IllegalArgumentException)
+ throw new RuntimeOperationsException((IllegalArgumentException)e);
+ if (e instanceof IndexOutOfBoundsException)
+ throw new RuntimeOperationsException((IndexOutOfBoundsException)e);
+ if (e instanceof NullPointerException)
+ throw new RuntimeOperationsException((NullPointerException)e);
+
+ // wrap any error
+ if (e instanceof Error)
+ throw new RuntimeErrorException((Error)e);
+
+ // wrap any runtime exception
+ if (e instanceof RuntimeException)
+ throw new RuntimeMBeanException((RuntimeException)e);
+ }
+
+}
Copied: projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/server/ServerConstants.java (from rev 85922, projects/jbossmx/trunk/j2se/src/main/org/jboss/mx/server/ServerConstants.java)
===================================================================
--- projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/server/ServerConstants.java (rev 0)
+++ projects/jbossmx/trunk/mbeans/src/main/org/jboss/mx/server/ServerConstants.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.mx.server;
+
+/**
+ * Server related constant variables. These are constants that are used internally
+ * by the MBean server implementation or are used to configure the MBean server.
+ * Different JMX service specific constants should be added to the <tt>ServiceConstants</tt>
+ * interface.
+ *
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
+ * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
+ * @version $Revision$
+ *
+ */
+public interface ServerConstants
+{
+ // Constants -----------------------------------------------------
+
+ /**
+ * The name of the protected implementation domain
+ * Pass this object to the registry in the values map as the key and value
+ * to register in this domain
+ */
+ final static String JMI_DOMAIN = "JMImplementation";
+
+ /**
+ * String representation of the MBean server delegate MBean object name.
+ */
+ final static String MBEAN_SERVER_DELEGATE = JMI_DOMAIN + ":type=MBeanServerDelegate";
+
+ /**
+ * String representation of the MBean registry mbean object name.
+ */
+ final static String MBEAN_REGISTRY = JMI_DOMAIN + ":type=MBeanRegistry";
+
+ /**
+ * String representationof the MBean server configuration mbean object name.
+ */
+ final static String MBEAN_SERVER_CONFIGURATION = JMI_DOMAIN + ":type=MBeanServerConfiguration";
+
+ /**
+ * The default domain name for the MBean server. If a default domain is not specified
+ * when the server is created, this value (<tt>"DefaultDomain"</tt>) is used.
+ *
+ * @see javax.management.MBeanServerFactory
+ */
+ final static String DEFAULT_DOMAIN = "DefaultDomain";
+
+
+ // MBean Server Delegate -----------------------------------------
+
+ /**
+ * The specification name of the implementation. This value can be retrieved from the MBean server delegate.
+ */
+ final static String SPECIFICATION_NAME = "Java Management Extensions Instrumentation and Agent Specification";
+
+ /**
+ * The specification version of the implementation. This value can be retrieved from the MBean server delegate.
+ */
+ final static String SPECIFICATION_VERSION = "1.2 Maintenance Release";
+
+ /**
+ * The specification vendor name. This value can be retrieved from the MBean server delegate.
+ */
+ final static String SPECIFICATION_VENDOR = "Sun Microsystems, Inc.";
+
+ /**
+ * The name of the implementation. This value can be retrieved from the MBean server delegate.
+ */
+ final static String IMPLEMENTATION_NAME = "JBossMX";
+
+ /**
+ * The version of the implementation. This value can be retrieved from the MBean server delegate.
+ */
+ final static String IMPLEMENTATION_VERSION = "6.0";
+
+ /**
+ * The vendor of the implementation. This value can be retrieved from the MBean server delegate.
+ */
+ final static String IMPLEMENTATION_VENDOR = "Red Hat Enterprise Middleware LLC";
+
+
+ // System properties ---------------------------------------------
+
+ /**
+ * This property can be used to configure which Model MBean implementation is
+ * used for the MBean agent's required Model MBean
+ * (see {@link javax.management.modelmbean.RequiredModelMBean}). The required
+ * Model MBean implementation will delegate all calls to the class specified
+ * with this property, e.g
+ * <tt>-Djbossmx.required.modelmbean.class=org.jboss.mx.modelmbean.XMBean</tt>
+ * would instantiate and delegate all calls made to <tt>RequiredModelMBean</tt>
+ * instance to JBossMX XMBean implementation.
+ */
+ final static String REQUIRED_MODELMBEAN_CLASS_PROPERTY = "jbossmx.required.modelmbean.class";
+
+ /**
+ * This constant defines the default Model MBean implementation used for spec
+ * required Model MBean (<tt>javax.management.modelmbean.RequiredModelMBean</tt>)
+ * instance. Defaults to org.jboss.mx.modelmbean.XMBean implementation.
+ */
+ final static String DEFAULT_REQUIRED_MODELMBEAN_CLASS = "org.jboss.mx.modelmbean.XMBean";
+
+ /**
+ * This property can be used to configure the default class loader repository
+ * implementation for the JVM.
+ */
+ final static String LOADER_REPOSITORY_CLASS_PROPERTY = "jbossmx.loader.repository.class";
+
+ final static String DEFAULT_LOADER_REPOSITORY_CLASS = "org.jboss.mx.loading.UnifiedLoaderRepository3";
+ final static String UNIFIED_LOADER_REPOSITORY_CLASS = "org.jboss.mx.loading.UnifiedLoaderRepository3";
+ final static String DEFAULT_SCOPED_REPOSITORY_CLASS = "org.jboss.mx.loading.HeirarchicalLoaderRepository3";
+ final static String DEFAULT_SCOPED_REPOSITORY_PARSER_CLASS = "org.jboss.mx.loading.HeirarchicalLoaderRepository3ConfigParser";
+
+ final static String MBEAN_REGISTRY_CLASS_PROPERTY = "jbossmx.mbean.registry.class";
+ final static String DEFAULT_MBEAN_REGISTRY_CLASS = "org.jboss.mx.server.registry.BasicMBeanRegistry";
+
+ final static String MBEAN_SERVER_BUILDER_CLASS_PROPERTY = "javax.management.builder.initial";
+ final static String DEFAULT_MBEAN_SERVER_BUILDER_CLASS = "org.jboss.mx.server.MBeanServerBuilderImpl";
+
+ final static String OPTIMIZE_REFLECTED_DISPATCHER = "jbossmx.optimized.dispatcher";
+
+ //added for UnifiedLoaderRepository becoming an mbean that issues notifications
+ final static String DEFAULT_LOADER_NAME = JMI_DOMAIN + ":service=LoaderRepository,name=Default";
+
+ final static String CLASSLOADER_ADDED = "jboss.mx.classloader.added";
+ final static String CLASSLOADER_REMOVED = "jboss.mx.classloader.removed";
+ final static String CLASS_REMOVED = "jboss.mx.class.removed";
+
+ /**
+ * The key for the context classloader for an MBean registration
+ */
+ final static String CLASSLOADER = "org.jboss.mx.classloader";
+
+}
Modified: projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/support/SimpleInterface.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/support/SimpleInterface.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/support/SimpleInterface.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -218,7 +218,7 @@
stringChangedValue
};
- Class[] TYPES =
+ Class<?>[] TYPES =
{
BigDecimal.class,
BigInteger.class,
Modified: projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/AbstractMXBeanTest.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/AbstractMXBeanTest.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/AbstractMXBeanTest.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -144,7 +144,7 @@
try
{
Method method = MXBeanUtils.getCompositeDataMethod(clazz, name, itemType == SimpleType.BOOLEAN);
- Object expectedValue = method.invoke(expected, null);
+ Object expectedValue = method.invoke(expected);
Object actualValue = handler.invoke(actual, method, null);
assertEquals(expectedValue, actualValue);
}
@@ -179,14 +179,14 @@
{
assertNotNullArray("values", values);
- Class[] types = new Class[values.length];
+ Class<?>[] types = new Class<?>[values.length];
for (int i = 0; i < values.length; ++i)
types[i] = values[i].getClass();
return createCompositeData(name, keys, types, values);
}
- protected CompositeData createCompositeData(String name, String[] keys, Class[] types, Object[] values) throws Exception
+ protected CompositeData createCompositeData(String name, String[] keys, Class<?>[] types, Object[] values) throws Exception
{
CompositeType compositeType = createCompositeType(name, keys, types);
return new CompositeDataSupport(compositeType, keys, values);
@@ -198,7 +198,7 @@
return new CompositeDataSupport(compositeType, keys, values);
}
- protected CompositeType createCompositeType(String name, String[] keys, Class[] types) throws Exception
+ protected CompositeType createCompositeType(String name, String[] keys, Class<?>[] types) throws Exception
{
assertNotNull(name);
assertNotNullArray("keys", keys);
@@ -234,13 +234,13 @@
return createCompositeDataProxy(intf, compositeData);
}
- protected <T> T createCompositeDataProxy(Class<T> intf, String[] keys, Class[] types, Object[] values) throws Exception
+ protected <T> T createCompositeDataProxy(Class<T> intf, String[] keys, Class<?>[] types, Object[] values) throws Exception
{
assertNotNull(intf);
return createCompositeDataProxy(intf, intf.getName(), keys, types, values);
}
- protected <T> T createCompositeDataProxy(Class<T> intf, String name, String[] keys, Class[] types, Object[] values) throws Exception
+ protected <T> T createCompositeDataProxy(Class<T> intf, String name, String[] keys, Class<?>[] types, Object[] values) throws Exception
{
CompositeData compositeData = createCompositeData(name, keys, types, values);
return createCompositeDataProxy(intf, compositeData);
Modified: projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/CompositeTypeMetaDataFactoryUnitTestCase.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/CompositeTypeMetaDataFactoryUnitTestCase.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/CompositeTypeMetaDataFactoryUnitTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -106,7 +106,7 @@
assertEquals(expected, type);
}
- protected CompositeType createSimpleCompositeType(Class clazz) throws Exception
+ protected CompositeType createSimpleCompositeType(Class<?> clazz) throws Exception
{
return createCompositeType(clazz.getName(), SimpleInterface.KEYS, SimpleInterface.TYPES);
}
Modified: projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/MXBeanInvocationHandlerUnitTestCase.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/MXBeanInvocationHandlerUnitTestCase.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/MXBeanInvocationHandlerUnitTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -279,7 +279,7 @@
assertEquals(expected, result);
}
- protected void checkAttributes(Class intf, Object proxy, Object mxbean, String[] keys, OpenType[] types, Object[] values, OpenMBeanInfo info) throws Exception
+ protected void checkAttributes(Class<?> intf, Object proxy, Object mxbean, String[] keys, OpenType[] types, Object[] values, OpenMBeanInfo info) throws Exception
{
MBeanAttributeInfo[] attributes = info.getAttributes();
@@ -301,9 +301,9 @@
OpenMBeanAttributeInfo attribute = mapping.get(name);
assertNotNull("Could not find key " + name + " in " + mapping.keySet(), attribute);
Method method = MXBeanUtils.getCompositeDataMethod(intf, keys[i], types[i] == SimpleType.BOOLEAN);
- Object value = method.invoke(proxy, null);
+ Object value = method.invoke(proxy);
checkValueEquals(values[i], value);
- value = method.invoke(mxbean, null);
+ value = method.invoke(mxbean);
checkValueEquals(values[i], value);
assertEquals(types[i], attribute.getOpenType());
}
Modified: projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/MXBeanSupportUnitTestCase.java
===================================================================
--- projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/MXBeanSupportUnitTestCase.java 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/mbeans/src/tests/org/jboss/test/mx/mxbean/test/MXBeanSupportUnitTestCase.java 2009-03-19 20:48:17 UTC (rev 86129)
@@ -313,7 +313,7 @@
checkArrayEquals(expected, result);
}
- private void checkAttributes(MBeanServer server, ObjectName objectName, Class intf, Object mxbean, String[] keys, OpenType[] types, Object[] values, Object[] realValues, OpenMBeanInfo info) throws Exception
+ private void checkAttributes(MBeanServer server, ObjectName objectName, Class<?> intf, Object mxbean, String[] keys, OpenType[] types, Object[] values, Object[] realValues, OpenMBeanInfo info) throws Exception
{
MBeanAttributeInfo[] attributes = info.getAttributes();
@@ -339,7 +339,7 @@
Object value = server.getAttribute(objectName, name);
checkValueEquals(values[i], value);
Method method = MXBeanUtils.getCompositeDataMethod(intf, keys[i], types[i] == SimpleType.BOOLEAN);
- value = method.invoke(mxbean, null);
+ value = method.invoke(mxbean);
checkValueEquals(realValues[i], value);
assertEquals(types[i], attribute.getOpenType());
attributeNames[i] = name;
Modified: projects/jbossmx/trunk/pom.xml
===================================================================
--- projects/jbossmx/trunk/pom.xml 2009-03-19 20:24:08 UTC (rev 86128)
+++ projects/jbossmx/trunk/pom.xml 2009-03-19 20:48:17 UTC (rev 86129)
@@ -110,8 +110,17 @@
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<includes>
- <include>org/jboss/test/**/*TestCase.java</include>
+ <include>**/*TestCase.java</include>
+ <include>**/*TEST.java</include>
</includes>
+ <excludes>
+ <exclude>test/performance/**</exclude>
+ <!-- FIXME rework these tests so they work with Maven -->
+ <exclude>org/jboss/test/jmx/compliance/standard/AttributeInfoTEST.java</exclude>
+ <exclude>org/jboss/test/jmx/compliance/standard/ConstructorInfoTEST.java</exclude>
+ <exclude>org/jboss/test/jmx/compliance/standard/OperationInfoTEST.java</exclude>
+ <exclude>org/jboss/test/jmx/compliance/standard/SpuriousAttributeTEST.java</exclude>
+ </excludes>
</configuration>
</plugin>
</plugins>
More information about the jboss-cvs-commits
mailing list