Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/MXBeanRegistrationTestCase.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/MXBeanRegistrationTestCase.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/MXBeanRegistrationTestCase.java (revision 0)
@@ -0,0 +1,567 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.jbossmx.compliance.registration;
+
+import java.io.IOException;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import junit.framework.Test;
+
+import org.jboss.test.jbossmx.compliance.TestCase;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.InvalidImpl1;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.InvalidImpl2;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.InvalidImpl3;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.InvalidImpl4;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.InvalidImplSub1;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.InvalidImplSub2;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.InvalidImplSub3;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.ValidImpl1;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.ValidImpl2;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.ValidImpl3;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.ValidImplDeepSub;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.ValidImplSub1;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.ValidImplSub2;
+import org.jboss.test.jbossmx.compliance.registration.mxbean.ValidImplSub3;
+/**
+ * @author baranowb
+ */
+public class MXBeanRegistrationTestCase
+extends TestCase
+{
+
+
+ /**
+ * Setup the test suite.
+ */
+ public static Test suite()
+ throws Exception
+ {
+ return getDeploySetup(MXBeanRegistrationTestCase.class, "mxbean-compliance.sar");
+ }
+
+ private ObjectName name;
+
+ // Constructor ---------------------------------------------------------------
+
+ public MXBeanRegistrationTestCase(String s) {
+ super(s);
+ }
+
+ // Tests ---------------------------------------------------------------------
+
+ public void testInvalidImpl() {
+
+ setup();
+ try {
+ register(InvalidImpl1.class.getName());
+ clear();
+ fail();
+ } catch (NotCompliantMBeanException e) {
+ //e.printStackTrace();
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(2+e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(3+e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(4+e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(5+e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(6+e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(7+e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(8+e.getMessage());
+ }
+ }
+
+ public void testInvalidImpl2() {
+
+ setup();
+ try {
+ register(InvalidImpl2.class.getName());
+ clear();
+ fail();
+ } catch (NotCompliantMBeanException e) {
+ //e.printStackTrace();
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testInvalidImpl3() {
+
+ setup();
+ try {
+ register(InvalidImpl3.class.getName());
+ clear();
+ fail();
+ } catch (NotCompliantMBeanException e) {
+ //e.printStackTrace();
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testInvalidImpl4() {
+
+ setup();
+ try {
+ register(InvalidImpl4.class.getName());
+ clear();
+ fail();
+ } catch (NotCompliantMBeanException e) {
+ // e.printStackTrace();
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testInvalidImplSub1() {
+
+ setup();
+ try {
+ register(InvalidImplSub1.class.getName());
+ clear();
+ fail();
+ } catch (NotCompliantMBeanException e) {
+ //e.printStackTrace();
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testInvalidImplSub2() {
+
+ setup();
+ try {
+ register(InvalidImplSub2.class.getName());
+ clear();
+ fail();
+ } catch (NotCompliantMBeanException e) {
+ //e.printStackTrace();
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testInvalidImplSub3() {
+
+ setup();
+ try {
+ register(InvalidImplSub3.class.getName());
+ clear();
+ fail();
+ } catch (NotCompliantMBeanException e) {
+ // e.printStackTrace();
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+ // tests which must pass ------------------------
+
+ public void testValidImpl1() {
+
+ setup();
+ try {
+ register(ValidImpl1.class.getName());
+ clear();
+ } catch (NotCompliantMBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testValidImpl2() {
+
+ setup();
+ try {
+ register(ValidImpl2.class.getName());
+ clear();
+ } catch (NotCompliantMBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testValidImpl3() {
+
+ setup();
+ try {
+ register(ValidImpl3.class.getName());
+ clear();
+ } catch (NotCompliantMBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testValidImplSub1() {
+
+ setup();
+ try {
+ register(ValidImplSub1.class.getName());
+ clear();
+ } catch (NotCompliantMBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testValidImplSub2() {
+
+ setup();
+ try {
+ register(ValidImplSub2.class.getName());
+ clear();
+ } catch (NotCompliantMBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testValidImplSub3() {
+
+ setup();
+ try {
+ register(ValidImplSub3.class.getName());
+ clear();
+ } catch (NotCompliantMBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ public void testValidImplDeepSub() {
+
+ setup();
+ try {
+ register(ValidImplDeepSub.class.getName());
+ clear();
+
+ } catch (NotCompliantMBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceAlreadyExistsException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanRegistrationException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (InstanceNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (MBeanException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (ReflectionException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+ // Helper methods
+ private void setup() {
+ if (this.name == null) {
+ try {
+ this.name = new ObjectName("jboss.mx:type=MXBean");
+ } catch (MalformedObjectNameException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void register(String className) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException, Exception {
+
+ getServer().createMBean(className, this.name);
+ }
+
+ private void clear(){
+ try{
+
+ getServer().unregisterMBean(this.name);
+ }catch(Exception e){
+
+ }
+ }
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface1.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface1.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface1.java (revision 0)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+import javax.management.MXBean;
+
+/**
+ * @author baranowb
+ *
+ */
+@MXBean
+public interface ValidInterface1 extends SimpleInterface{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface2.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface2.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface2.java (revision 0)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+import org.jboss.mx.mxbean.MXBean;
+
+/**
+ * @author baranowb
+ *
+ */
+@MXBean
+public interface ValidInterface2 extends SimpleInterface{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface1.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface1.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface1.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public interface InvalidSubInterface1 extends InvalidInterface1{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl1.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl1.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl1.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class ValidImpl1 extends SimpleInterfaceImpl implements ValidInterface1{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl2.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl2.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl2.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class ValidImpl2 extends SimpleInterfaceImpl implements ValidInterface2{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface2.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface2.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface2.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public interface InvalidSubInterface2 extends InvalidInterface2{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub1.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub1.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub1.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class InvalidImplSub1 extends SimpleInterfaceImpl implements InvalidSubInterface1{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface3.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface3.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidSubInterface3.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public interface InvalidSubInterface3 extends ValidInterface1,ValidInterface3MXBean{
+ //cant have more than one MXBean defs
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl3.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl3.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImpl3.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class ValidImpl3 extends SimpleInterfaceImpl implements ValidInterface3MXBean{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub2.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub2.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub2.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class InvalidImplSub2 extends SimpleInterfaceImpl implements InvalidSubInterface2{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub3.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub3.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImplSub3.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class InvalidImplSub3 extends SimpleInterfaceImpl implements InvalidSubInterface3{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/SimpleInterface.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/SimpleInterface.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/SimpleInterface.java (revision 0)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * Simple interface to define set of getter/setters.
+ * @author baranowb
+ *
+ */
+public interface SimpleInterface {
+
+ public void setString(String s);
+ public String getString();
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface1.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface1.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface1.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public interface ValidSubInterface1 extends ValidInterface1{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub1.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub1.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub1.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class ValidImplSub1 extends SimpleInterfaceImpl implements ValidSubInterface1{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface2.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface2.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface2.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public interface ValidSubInterface2 extends ValidInterface2{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidDeeeeeplySubInterface.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidDeeeeeplySubInterface.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidDeeeeeplySubInterface.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public interface ValidDeeeeeplySubInterface extends ValidSubInterface3 {
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub2.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub2.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub2.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class ValidImplSub2 extends SimpleInterfaceImpl implements ValidSubInterface2{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface3.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface3.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidSubInterface3.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public interface ValidSubInterface3 extends ValidInterface3MXBean{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub3.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub3.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplSub3.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class ValidImplSub3 extends SimpleInterfaceImpl implements ValidSubInterface3{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface3MXBean.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface3MXBean.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface3MXBean.java (revision 0)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+import javax.management.MXBean;
+
+/**
+ * @author baranowb
+ *
+ */
+@MXBean(false)
+public interface InvalidInterface3MXBean extends SimpleInterface{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface4MXBean.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface4MXBean.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface4MXBean.java (revision 0)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+import org.jboss.mx.mxbean.MXBean;
+
+/**
+ * @author baranowb
+ *
+ */
+@MXBean(false)
+public interface InvalidInterface4MXBean extends SimpleInterface{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface1.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface1.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface1.java (revision 0)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+import javax.management.MXBean;
+
+/**
+ * @author baranowb
+ *
+ */
+@MXBean(false)
+public interface InvalidInterface1 extends SimpleInterface{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface2.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface2.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidInterface2.java (revision 0)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+import org.jboss.mx.mxbean.MXBean;
+
+/**
+ * @author baranowb
+ *
+ */
+@MXBean(false)
+public interface InvalidInterface2 extends SimpleInterface{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl1.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl1.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl1.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class InvalidImpl1 extends SimpleInterfaceImpl implements InvalidInterface1{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplDeepSub.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplDeepSub.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidImplDeepSub.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class ValidImplDeepSub extends SimpleInterfaceImpl implements ValidSubInterface3{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl2.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl2.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl2.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class InvalidImpl2 extends SimpleInterfaceImpl implements InvalidInterface2{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl3.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl3.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl3.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class InvalidImpl3 extends SimpleInterfaceImpl implements InvalidInterface3MXBean{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl4.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl4.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/InvalidImpl4.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class InvalidImpl4 extends SimpleInterfaceImpl implements InvalidInterface4MXBean{
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/SimpleInterfaceImpl.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/SimpleInterfaceImpl.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/SimpleInterfaceImpl.java (revision 0)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public class SimpleInterfaceImpl implements SimpleInterface{
+
+ protected String string;
+ /* (non-Javadoc)
+ * @see org.jboss.test.jbossmx.compliance.mxbean.SimpleInterface#setString(java.lang.String)
+ */
+ @Override
+ public void setString(String s) {
+ this.string = s;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.test.jbossmx.compliance.mxbean.SimpleInterface#getString()
+ */
+ @Override
+ public String getString() {
+ return this.string;
+ }
+
+
+}
Index: testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface3MXBean.java
===================================================================
--- testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface3MXBean.java (revision 0)
+++ testsuite/src/main/org/jboss/test/jbossmx/compliance/registration/mxbean/ValidInterface3MXBean.java (revision 0)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jbossmx.compliance.registration.mxbean;
+
+/**
+ * @author baranowb
+ *
+ */
+public interface ValidInterface3MXBean extends SimpleInterface{
+
+}
Index: testsuite/src/resources/jbossmx/mxbean/META-INF/jboss-service.xml
===================================================================
--- testsuite/src/resources/jbossmx/mxbean/META-INF/jboss-service.xml (revision 0)
+++ testsuite/src/resources/jbossmx/mxbean/META-INF/jboss-service.xml (revision 0)
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: testsuite/imports/sections/jbossmx.xml
===================================================================
--- testsuite/imports/sections/jbossmx.xml (revision 113628)
+++ testsuite/imports/sections/jbossmx.xml (working copy)
@@ -26,5 +26,14 @@
+
+
+
+
+
+
+
+
+
Index: testsuite/build.xml
===================================================================
--- testsuite/build.xml (revision 113628)
+++ testsuite/build.xml (working copy)
@@ -1303,7 +1303,7 @@
-
+
@@ -1321,8 +1321,9 @@
-
-
+
+
+
@@ -2086,6 +2087,8 @@
+
+
Index: jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java
===================================================================
--- jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java (revision 113628)
+++ jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java (working copy)
@@ -60,6 +60,8 @@
import org.jboss.mx.modelmbean.RequiredModelMBeanInvoker;
import org.jboss.mx.modelmbean.XMBean;
import org.jboss.mx.modelmbean.XMBeanConstants;
+import org.jboss.mx.mxbean.MXBeanMetaData;
+import org.jboss.mx.mxbean.MXBeanUtils;
import org.jboss.mx.server.AbstractMBeanInvoker;
import org.jboss.mx.server.MBeanInvoker;
import org.jboss.mx.server.RawDynamicInvoker;
@@ -181,11 +183,10 @@
boolean invokedPreRegister = false;
String magicToken = null;
MBeanInvoker invoker = null;
-
+
if (object == null)
throw new RuntimeOperationsException(
new IllegalArgumentException("Attempting to register null object"));
-
// get mbean type, dynamic or standard
MBeanCapability mbcap = MBeanCapability.of(object.getClass());
@@ -209,8 +210,15 @@
{
if( object instanceof RequiredModelMBean )
invoker = new RequiredModelMBeanInvoker((DynamicMBean)object);
- else
+ else if(object instanceof DynamicMBean)
invoker = new RawDynamicInvoker((DynamicMBean)object);
+ else {
+ //JBPAPP-9809
+ Class mxbeanInterface = MXBeanMetaData.findMXBeanInterface(object.getClass());
+ object = MXBeanUtils.createMXBean(object, mxbeanInterface);
+ invoker= new RawDynamicInvoker((DynamicMBean)object);
+ }
+
}
// Perform the pregistration
Index: mbeans/src/main/org/jboss/mx/metadata/MBeanCapability.java
===================================================================
--- mbeans/src/main/org/jboss/mx/metadata/MBeanCapability.java (revision 113637)
+++ mbeans/src/main/org/jboss/mx/metadata/MBeanCapability.java (working copy)
@@ -21,7 +21,13 @@
*/
package org.jboss.mx.metadata;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Set;
+
import javax.management.DynamicMBean;
+import javax.management.MXBean;
import javax.management.NotCompliantMBeanException;
/**
@@ -60,6 +66,9 @@
protected int mbeanType = NOT_AN_MBEAN;
+ //inner use, indicates how many MXBean interfaces/@ have been found.
+ private int mxCount;
+
private MBeanCapability(int type)
{
mbeanType = type;
@@ -72,6 +81,23 @@
public static MBeanCapability of(Class mbeanClass) throws NotCompliantMBeanException
{
+ MBeanCapability cap = ofMBean(mbeanClass);
+
+ //if null, check for MXBean, if it there is, return it, else, throw exception
+ if(cap == null){
+ //check for MXBeans
+ cap = ofMXBean(mbeanClass);
+ if(cap != null){
+ return cap;
+ }
+ } else {
+ return cap;
+ }
+ throw new NotCompliantMBeanException("Class does not expose a management interface: " + mbeanClass.getName());
+ }
+
+ private static MBeanCapability ofMBean(Class mbeanClass)
+ {
if (null == mbeanClass)
{
throw new IllegalArgumentException("MBean class cannot be null");
@@ -97,9 +123,98 @@
// If there is an ancestor called SuperClass that is an instance of SuperClassMBean
Class superClass = mbeanClass.getSuperclass();
if (superClass != null)
- return of(superClass);
+ return ofMBean(superClass);
- throw new NotCompliantMBeanException("Class does not expose a management interface: " + mbeanClass.getName());
+ return null;
}
+
+ @SuppressWarnings("rawtypes")
+ private static MBeanCapability ofMXBean(final Class mbeanClass) throws NotCompliantMBeanException {
+ // this is a bit different, than ofMBean ( I hope ). We need to dive into interfaces.
+ if (null == mbeanClass) {
+ throw new IllegalArgumentException("MBean class cannot be null");
+ }
+ Class workOnMe = mbeanClass;
+ // gather all interfaces(top defined - this could be done with recursion.
+ LinkedList ifaces = new LinkedList();
+ while (true) {
+ Class[] declaredIfaces = workOnMe.getInterfaces();
+ ifaces.addAll(Arrays.asList(declaredIfaces));
+ workOnMe = workOnMe.getSuperclass();
+ if (workOnMe == null || workOnMe.equals(Object.class))
+ break;
+ }
+ // set, to avoid duplicates
+ final Set score = new HashSet();
+ for (Class iface : ifaces) {
+ ofMXBeanInterface(mbeanClass,iface, score);
+ }
+ switch (score.size()) {
+ case 0:
+ return null;
+ case 1:
+ // Note ... in perfect world we would return: MX_BEAN defined above..( if it has been defined )
+ // This value will use AS5 mx.mxbean package and classes implemented there.
+ return new MBeanCapability(DYNAMIC_MBEAN);
+ default:
+ throw new NotCompliantMBeanException("Class '" + mbeanClass.getName()
+ + "' exposes more than one MXBean interface '" + score + "'");
-}
+ }
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static void ofMXBeanInterface(final Class baseClass,final Class mbeanInterface,final Set score) throws NotCompliantMBeanException {
+ //this is a bit messy, we have two annotations...
+ boolean failedWithaAnnotation=false;
+ //we actually should mess with this?
+ org.jboss.mx.mxbean.MXBean jbossAnnotation = (org.jboss.mx.mxbean.MXBean) mbeanInterface
+ .getAnnotation(org.jboss.mx.mxbean.MXBean.class);
+ // we need to check for:
+ // - @MXBean || @MXBean(true)
+ // - zxcMXBean interface
+ MXBean jdkAnnodation = (MXBean) mbeanInterface.getAnnotation(MXBean.class);
+ if(jdkAnnodation!=null && jbossAnnotation!=null){
+ //thats just wrong
+ throw new NotCompliantMBeanException("Class '" + baseClass.getName()
+ + "' has interface '" + mbeanInterface.getName() + "' which exposes more than on MXBean annotation!");
+ }
+
+ if(jbossAnnotation!=null){
+ if(jbossAnnotation.value()){
+ score.add(mbeanInterface);
+ }else{
+ failedWithaAnnotation = true;
+ }
+ }
+
+ if(jdkAnnodation!=null){
+ if(jdkAnnodation.value()){
+ score.add(mbeanInterface);
+ }else{
+ failedWithaAnnotation = true;
+ }
+ }
+ //consider name only in case annotation dont deny
+ if(!failedWithaAnnotation)
+ {
+ // check interface name
+ final String ifaceName = mbeanInterface.getName();
+ if (ifaceName.endsWith("MXBean") && ifaceName.lastIndexOf("MXBean") > 0) {
+ score.add(mbeanInterface);
+ }
+
+ }
+ // now we need to check super interfaces
+ // NOTE: there is no word on double def -
+ // @MXBean public interface XX{}
+ // @MXBean public interface YY extends XX{} ...
+ // so we assume thats a no no. Same for class names?
+ Class[] ifaces = mbeanInterface.getInterfaces();
+ if (ifaces != null) // just in case some JVMs dont behave here
+ for (Class i : ifaces) {
+ ofMXBeanInterface(baseClass,i, score);
+ }
+ }
+}
\ No newline at end of file
Index: mbeans/src/main/org/jboss/mx/mxbean/MXBeanMetaData.java
===================================================================
--- mbeans/src/main/org/jboss/mx/mxbean/MXBeanMetaData.java (revision 113637)
+++ mbeans/src/main/org/jboss/mx/mxbean/MXBeanMetaData.java (working copy)
@@ -33,6 +33,7 @@
import javax.management.MBeanInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanOperationInfo;
+import javax.management.MXBean;
import javax.management.NotCompliantMBeanException;
import javax.management.NotificationBroadcaster;
import javax.management.openmbean.OpenMBeanAttributeInfo;
@@ -78,9 +79,10 @@
Class> concrete = mbeanClass;
while (null != concrete)
{
- Class result = findMXBeanInterface(concrete, concrete.getInterfaces());
+ Class result = findMXBeanInterface(concrete.getInterfaces());
if (null != result)
return result;
+
concrete = concrete.getSuperclass();
}
return null;
@@ -93,24 +95,41 @@
* @param interfaces the interfaces to consider
* @return the interface
*/
- private static Class> findMXBeanInterface(Class> concrete, Class>[] interfaces)
- {
- String mxName = concrete.getName() + "MXBean";
- String stdName = concrete.getName() + "MBean";
+ private static Class> findMXBeanInterface(Class>[] interfaces) {
+ //NOTE: returns first encountered result, MBeanCapability.of(...) checks for error conditions.
+ for (Class> intf : interfaces) {
+ // JBoss AS annotation, simulating false value as in case of JDK annotation
+ org.jboss.mx.mxbean.MXBean jbossAnnotation = intf.getAnnotation(org.jboss.mx.mxbean.MXBean.class);
- for (Class> intf : interfaces)
- {
- String name = intf.getName();
- if (mxName.equals(name) || stdName.equals(name))
- return intf;
-
- MXBean mxBean = intf.getAnnotation(MXBean.class);
- if (mxBean != null && mxBean.value())
- return intf;
- }
- return null;
- }
+ if (jbossAnnotation != null)
+ {
+ if(jbossAnnotation.value())
+ return intf;
+ else
+ continue;
+ }
+
+ MXBean jdkAnnodation = (MXBean) intf.getAnnotation(MXBean.class);
+ if (jdkAnnodation != null) {
+ if(jdkAnnodation.value())
+ return intf;
+ else
+ continue;
+ // if annotation is there its ok, else we check interface name
+ }
+ // check interface name
+ final String ifaceName = intf.getName();
+ if (ifaceName.endsWith("MXBean") && ifaceName.lastIndexOf("MXBean") > 0) {
+ return intf;
+ }
+
+ //dive into super interfaces
+ return findMXBeanInterface(intf.getInterfaces());
+ }
+ return null;
+ }
+
/**
* Create a new MXBeanMetaData.
*