Author: ggrzybek
Date: Tue May 9 10:59:40 2017
New Revision: 1794535
URL: http://svn.apache.org/viewvc?rev=1794535&view=rev
Log:
[ARIES-1618][ARIES-1342] Better sorting of separate interface hierarchies
(+test)
Added:
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/AriesTransactionManager.java
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/MonitorableTransactionManager.java
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/RecoverableTransactionManager.java
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XAWork.java
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XidImporter.java
Modified:
aries/trunk/proxy/proxy-impl/pom.xml
aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
Modified: aries/trunk/proxy/proxy-impl/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/pom.xml?rev=1794535&r1=1794534&r2=1794535&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/pom.xml (original)
+++ aries/trunk/proxy/proxy-impl/pom.xml Tue May 9 10:59:40 2017
@@ -116,6 +116,18 @@
<version>2.5.5</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>javax.transaction-api</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.6_spec</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified:
aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
URL:
http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java?rev=1794535&r1=1794534&r2=1794535&view=diff
==============================================================================
---
aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
(original)
+++
aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
Tue May 9 10:59:40 2017
@@ -124,9 +124,10 @@ public final class InterfaceProxyGenerat
// second class is subclass of first one, it occurs later in
hierarchy
return 1;
}
- // types have separate inheritance trees, so it doesn't mater which
one is first or second,
+ // types have separate inheritance trees, but it does matter which one
is first or second, so we
+ // won't end up with duplicates
// however we can't mark them as equal cause one of them will be
removed
- return 1;
+ return object1.getName().compareTo(object2.getName());
}
});
for(Class<?> c : ifaces) {
Modified:
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
URL:
http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java?rev=1794535&r1=1794534&r2=1794535&view=diff
==============================================================================
---
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
(original)
+++
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
Tue May 9 10:59:40 2017
@@ -33,11 +33,14 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import org.apache.aries.blueprint.proxy.AbstractProxyTest.TestListener;
+import org.apache.aries.blueprint.proxy.complex.AriesTransactionManager;
+import org.apache.aries.proxy.UnableToProxyException;
import org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator;
import org.junit.Before;
import org.junit.Test;
@@ -276,6 +279,18 @@ public class InterfaceProxyingTest {
assertTrue("parents should be different, as the are the classloaders of
different bundle revisions", parent1 != parent2);
}
+
+ // Test for https://issues.apache.org/jira/browse/ARIES-1618
+ @Test
+ public void checkDuplicateInterfaces() throws UnableToProxyException
+ {
+ Collection<Class<?>> classes =
Collections.<Class<?>>singletonList(AriesTransactionManager.class);
+
+ Object o = InterfaceProxyGenerator.getProxyInstance(testBundle, null,
classes, constantly(null), null);
+
+ assertTrue(o instanceof AriesTransactionManager);
+ }
+
protected void assertCalled(TestListener listener, boolean pre, boolean
post, boolean ex) {
assertEquals(pre, listener.preInvoke);
assertEquals(post, listener.postInvoke);
Added:
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/AriesTransactionManager.java
URL:
http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/AriesTransactionManager.java?rev=1794535&view=auto
==============================================================================
---
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/AriesTransactionManager.java
(added)
+++
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/AriesTransactionManager.java
Tue May 9 10:59:40 2017
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.proxy.complex;
+
+import
org.apache.aries.blueprint.proxy.complex.manager.MonitorableTransactionManager;
+import
org.apache.aries.blueprint.proxy.complex.manager.RecoverableTransactionManager;
+import org.apache.aries.blueprint.proxy.complex.manager.XAWork;
+import org.apache.aries.blueprint.proxy.complex.manager.XidImporter;
+
+import javax.resource.spi.XATerminator;
+import javax.transaction.TransactionManager;
+import javax.transaction.TransactionSynchronizationRegistry;
+import javax.transaction.UserTransaction;
+
+public interface AriesTransactionManager extends
+ TransactionManager, UserTransaction,
+ TransactionSynchronizationRegistry, XidImporter,
+ MonitorableTransactionManager, RecoverableTransactionManager,
+ XATerminator, XAWork {
+}
Added:
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/MonitorableTransactionManager.java
URL:
http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/MonitorableTransactionManager.java?rev=1794535&view=auto
==============================================================================
---
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/MonitorableTransactionManager.java
(added)
+++
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/MonitorableTransactionManager.java
Tue May 9 10:59:40 2017
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.proxy.complex.manager;
+
+import java.util.EventListener;
+
+public interface MonitorableTransactionManager extends EventListener {
+}
Added:
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/RecoverableTransactionManager.java
URL:
http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/RecoverableTransactionManager.java?rev=1794535&view=auto
==============================================================================
---
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/RecoverableTransactionManager.java
(added)
+++
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/RecoverableTransactionManager.java
Tue May 9 10:59:40 2017
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.proxy.complex.manager;
+
+import javax.transaction.TransactionManager;
+
+public interface RecoverableTransactionManager extends TransactionManager {
+}
Added:
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XAWork.java
URL:
http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XAWork.java?rev=1794535&view=auto
==============================================================================
---
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XAWork.java
(added)
+++
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XAWork.java
Tue May 9 10:59:40 2017
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.proxy.complex.manager;
+
+public interface XAWork {
+}
Added:
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XidImporter.java
URL:
http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XidImporter.java?rev=1794535&view=auto
==============================================================================
---
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XidImporter.java
(added)
+++
aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/complex/manager/XidImporter.java
Tue May 9 10:59:40 2017
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.proxy.complex.manager;
+
+public interface XidImporter {
+}