Author: jcarman Date: Sat Jul 17 02:37:50 2010 New Revision: 964999 URL: http://svn.apache.org/viewvc?rev=964999&view=rev Log: Work in progress, still.
Added: commons/proper/proxy/branches/version-2.0-work/cglib/src/main/resources/ commons/proper/proxy/branches/version-2.0-work/cglib/src/main/resources/META-INF/ commons/proper/proxy/branches/version-2.0-work/cglib/src/main/resources/META-INF/services/ commons/proper/proxy/branches/version-2.0-work/cglib/src/main/resources/META-INF/services/org.apache.commons.proxy.ProxyFactory commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy/interceptor/ commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy/interceptor/filter/ commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy/interceptor/logging/ commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy/provider/remoting/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/TestProxyUtils.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/AbstractExceptionClassTestCase.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestDelegateProviderException.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestInvocationHandlerException.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestProxyFactoryException.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/impl/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/impl/TestMethodSignature.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/interceptor/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/interceptor/filter/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/invoker/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/invoker/recorder/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java commons/proper/proxy/branches/version-2.0-work/core/src/test/resources/ commons/proper/proxy/branches/version-2.0-work/core/src/test/resources/log4j.properties (contents, props changed) - copied, changed from r964961, commons/proper/proxy/branches/version-2.0-work/src/test/resources/log4j.properties Removed: commons/proper/proxy/branches/version-2.0-work/src/test/resources/log4j.properties Modified: commons/proper/proxy/branches/version-2.0-work/cglib/pom.xml commons/proper/proxy/branches/version-2.0-work/cglib/src/test/java/org/apache/commons/proxy/cglib/TestCglibProxyFactory.java commons/proper/proxy/branches/version-2.0-work/core/ (props changed) commons/proper/proxy/branches/version-2.0-work/core/pom.xml commons/proper/proxy/branches/version-2.0-work/javassist/ (props changed) commons/proper/proxy/branches/version-2.0-work/javassist/pom.xml commons/proper/proxy/branches/version-2.0-work/jdk/ (props changed) commons/proper/proxy/branches/version-2.0-work/jdk/pom.xml commons/proper/proxy/branches/version-2.0-work/pom.xml Modified: commons/proper/proxy/branches/version-2.0-work/cglib/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/cglib/pom.xml?rev=964999&r1=964998&r2=964999&view=diff ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/cglib/pom.xml (original) +++ commons/proper/proxy/branches/version-2.0-work/cglib/pom.xml Sat Jul 17 02:37:50 2010 @@ -20,7 +20,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> - <artifactId>commons-proxy</artifactId> + <artifactId>commons-proxy-parent</artifactId> <groupId>org.apache.commons</groupId> <version>2.0-SNAPSHOT</version> </parent> @@ -31,7 +31,7 @@ <dependencies> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>commons-proxy-core</artifactId> + <artifactId>commons-proxy</artifactId> <version>${project.version}</version> </dependency> <dependency> @@ -42,7 +42,7 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>commons-proxy-core</artifactId> + <artifactId>commons-proxy</artifactId> <version>${project.version}</version> <type>test-jar</type> <scope>test</scope> Added: commons/proper/proxy/branches/version-2.0-work/cglib/src/main/resources/META-INF/services/org.apache.commons.proxy.ProxyFactory URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/cglib/src/main/resources/META-INF/services/org.apache.commons.proxy.ProxyFactory?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/cglib/src/main/resources/META-INF/services/org.apache.commons.proxy.ProxyFactory (added) +++ commons/proper/proxy/branches/version-2.0-work/cglib/src/main/resources/META-INF/services/org.apache.commons.proxy.ProxyFactory Sat Jul 17 02:37:50 2010 @@ -0,0 +1 @@ +org.apache.commons.proxy.cglib.CglibProxyFactory \ No newline at end of file Modified: commons/proper/proxy/branches/version-2.0-work/cglib/src/test/java/org/apache/commons/proxy/cglib/TestCglibProxyFactory.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/cglib/src/test/java/org/apache/commons/proxy/cglib/TestCglibProxyFactory.java?rev=964999&r1=964998&r2=964999&view=diff ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/cglib/src/test/java/org/apache/commons/proxy/cglib/TestCglibProxyFactory.java (original) +++ commons/proper/proxy/branches/version-2.0-work/cglib/src/test/java/org/apache/commons/proxy/cglib/TestCglibProxyFactory.java Sat Jul 17 02:37:50 2010 @@ -27,6 +27,5 @@ public class TestCglibProxyFactory exten public TestCglibProxyFactory() { - super(new CglibProxyFactory()); } } Propchange: commons/proper/proxy/branches/version-2.0-work/core/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Sat Jul 17 02:37:50 2010 @@ -0,0 +1 @@ +commons-proxy-core.iml Modified: commons/proper/proxy/branches/version-2.0-work/core/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/pom.xml?rev=964999&r1=964998&r2=964999&view=diff ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/pom.xml (original) +++ commons/proper/proxy/branches/version-2.0-work/core/pom.xml Sat Jul 17 02:37:50 2010 @@ -3,13 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> - <artifactId>commons-proxy</artifactId> + <artifactId>commons-proxy-parent</artifactId> <groupId>org.apache.commons</groupId> <version>2.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>commons-proxy-core</artifactId> + <artifactId>commons-proxy</artifactId> <dependencies> <dependency> @@ -49,6 +49,12 @@ <optional>true</optional> </dependency> <dependency> + <groupId>concurrent</groupId> + <artifactId>concurrent</artifactId> + <version>1.3.4</version> + <optional>true</optional> + </dependency> + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.4.0</version> Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/TestProxyUtils.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/TestProxyUtils.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/TestProxyUtils.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/TestProxyUtils.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,110 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy; + +import junit.framework.TestCase; +import org.apache.commons.proxy.util.DuplicateEcho; +import org.apache.commons.proxy.util.Echo; +import org.apache.commons.proxy.util.EchoImpl; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Properties; + +public class TestProxyUtils extends TestCase +{ +//********************************************************************************************************************** +// Fields +//********************************************************************************************************************** + + private Properties prevProperties; + +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + protected void setUp() throws Exception + { + prevProperties = System.getProperties(); + System.setProperties(new Properties()); + } + + protected void tearDown() throws Exception + { + System.setProperties(prevProperties); + } + + public void testNullValue() + { + assertNullValue(null, String.class); + assertNullValue(( char ) 0, Character.TYPE); + assertNullValue(0, Integer.TYPE); + assertNullValue(( long ) 0, Long.TYPE); + assertNullValue(( short ) 0, Short.TYPE); + assertNullValue(( double ) 0, Double.TYPE); + assertNullValue(( float ) 0, Float.TYPE); + assertNullValue(false, Boolean.TYPE); + assertNullValue(( byte ) 0, Byte.TYPE); + } + + private void assertNullValue( Object expected, Class type ) + { + assertEquals(expected, ProxyUtils.nullValue(type)); + } + + public void testCreateNullObject() throws Exception + { + final Echo nullEcho = ( Echo ) ProxyUtils + .createNullObject(new JavassistProxyFactory(), new Class[] {Echo.class}); + assertNull(nullEcho.echoBack("hello")); + assertNull(nullEcho.echoBack("hello", "world")); + assertEquals(( int ) 0, nullEcho.echoBack(12345)); + } + + public void testCreateNullObjectWithClassLoader() throws Exception + { + final Echo nullEcho = ( Echo ) ProxyUtils.createNullObject(new JavassistProxyFactory(), + Echo.class.getClassLoader(), + new Class[] {Echo.class}); + assertNull(nullEcho.echoBack("hello")); + assertNull(nullEcho.echoBack("hello", "world")); + assertEquals(( int ) 0, nullEcho.echoBack(12345)); + } + + public void testGetAllInterfaces() + { + assertNull(ProxyUtils.getAllInterfaces(null)); + assertEquals(Arrays.asList(new Class[] {DuplicateEcho.class, Serializable.class, Echo.class}), + Arrays.asList(ProxyUtils.getAllInterfaces(EchoImpl.class))); + } + + public void testGetJavaClassName() throws Exception + { + assertEquals("java.lang.Object[]", ProxyUtils.getJavaClassName(Object[].class)); + assertEquals("java.lang.Object[][]", ProxyUtils.getJavaClassName(Object[][].class)); + assertEquals("java.lang.String[][][]", ProxyUtils.getJavaClassName(String[][][].class)); + assertEquals("int", ProxyUtils.getJavaClassName(Integer.TYPE)); + assertEquals("float", ProxyUtils.getJavaClassName(Float.TYPE)); + assertEquals("long", ProxyUtils.getJavaClassName(Long.TYPE)); + assertEquals("double", ProxyUtils.getJavaClassName(Double.TYPE)); + assertEquals("short", ProxyUtils.getJavaClassName(Short.TYPE)); + assertEquals("byte", ProxyUtils.getJavaClassName(Byte.TYPE)); + assertEquals("char", ProxyUtils.getJavaClassName(Character.TYPE)); + assertEquals("boolean", ProxyUtils.getJavaClassName(Boolean.TYPE)); + } +} \ No newline at end of file Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/AbstractExceptionClassTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/AbstractExceptionClassTestCase.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/AbstractExceptionClassTestCase.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/AbstractExceptionClassTestCase.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.exception; + +import junit.framework.TestCase; + +/** + * @author James Carman + * @since 1.0 + */ +public abstract class AbstractExceptionClassTestCase extends TestCase +{ +//********************************************************************************************************************** +// Fields +//********************************************************************************************************************** + + private final Class exceptionClass; + +//********************************************************************************************************************** +// Constructors +//********************************************************************************************************************** + + public AbstractExceptionClassTestCase( Class exceptionClass ) + { + this.exceptionClass = exceptionClass; + } + +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + public void testCauseOnlyConstructor() throws Exception + { + final Exception cause = new Exception(); + Exception e = ( Exception ) exceptionClass.getConstructor(new Class[] {Throwable.class}).newInstance(new Object[] {cause}); + assertEquals(cause.toString(), e.getMessage()); + assertEquals(cause, e.getCause()); + } + + public void testMessageAndCauseConstructor() throws Exception + { + final Exception cause = new Exception(); + final String message = "message"; + Exception e = ( Exception ) exceptionClass.getConstructor(new Class[] {String.class, Throwable.class}).newInstance(new Object[] {message, cause}); + assertEquals(message, e.getMessage()); + assertEquals(cause, e.getCause()); + } + + public void testMessageOnlyConstructor() throws Exception + { + final String message = "message"; + Exception e = ( Exception ) exceptionClass.getConstructor(new Class[] {String.class}).newInstance(new Object[] {message}); + assertEquals(message, e.getMessage()); + assertNull(e.getCause()); + } + + public void testNoArgConstructor() throws Exception + { + Exception e = ( Exception ) exceptionClass.getConstructor(new Class[] {}).newInstance(new Object[] {}); + assertNull(e.getMessage()); + assertNull(e.getCause()); + } +} Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestDelegateProviderException.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestDelegateProviderException.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestDelegateProviderException.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestDelegateProviderException.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.exception; + +public class TestDelegateProviderException extends AbstractExceptionClassTestCase +{ +//********************************************************************************************************************** +// Constructors +//********************************************************************************************************************** + + public TestDelegateProviderException() + { + super(ObjectProviderException.class); + } +} \ No newline at end of file Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestInvocationHandlerException.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestInvocationHandlerException.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestInvocationHandlerException.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestInvocationHandlerException.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.exception; + +public class TestInvocationHandlerException extends AbstractExceptionClassTestCase +{ +//********************************************************************************************************************** +// Constructors +//********************************************************************************************************************** + + public TestInvocationHandlerException() + { + super(InvokerException.class); + } +} \ No newline at end of file Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestProxyFactoryException.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestProxyFactoryException.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestProxyFactoryException.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/exception/TestProxyFactoryException.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.exception; + +/** + * @author James Carman + * @since 1.0 + */ +public class TestProxyFactoryException extends AbstractExceptionClassTestCase +{ +//********************************************************************************************************************** +// Constructors +//********************************************************************************************************************** + + public TestProxyFactoryException() + { + super(ProxyFactoryException.class); + } +} Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/impl/TestMethodSignature.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/impl/TestMethodSignature.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/impl/TestMethodSignature.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/impl/TestMethodSignature.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.impl; + +import junit.framework.TestCase; + +public class TestMethodSignature extends TestCase +{ +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + public void testEquals() throws Exception + { + final MethodSignature sig = new MethodSignature(Echo.class.getMethod("echoBack", new Class[] {String.class})); + assertTrue(sig.equals(sig)); + assertFalse(sig.equals("echoBack")); + assertEquals(sig, new MethodSignature(Echo.class.getMethod("echoBack", new Class[] {String.class}))); + assertEquals(sig, new MethodSignature(DuplicateEcho.class.getMethod("echoBack", new Class[] {String.class}))); + assertFalse(sig.equals(new MethodSignature(Echo.class.getMethod("echoBack", new Class[] {String.class, String.class})))); + assertFalse(sig.equals(new MethodSignature(Echo.class.getMethod("echo", new Class[] {})))); + } +} \ No newline at end of file Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.provider; + +import org.apache.commons.proxy.ObjectProvider; + +/** + * @author James Carman + * @since 1.0 + */ +public class CountingProvider extends ProviderDecorator +{ +//********************************************************************************************************************** +// Fields +//********************************************************************************************************************** + + private int count = 0; + +//********************************************************************************************************************** +// Constructors +//********************************************************************************************************************** + + public CountingProvider( ObjectProvider inner ) + { + super(inner); + } + +//********************************************************************************************************************** +// ObjectProvider Implementation +//********************************************************************************************************************** + + + public synchronized Object getObject() + { + count++; + return super.getObject(); + } + +//********************************************************************************************************************** +// Getter/Setter Methods +//********************************************************************************************************************** + + public synchronized int getCount() + { + return count; + } +} Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.provider; + +import org.apache.commons.proxy.exception.ObjectProviderException; +import org.apache.commons.proxy.util.AbstractTestCase; + +public class TestBeanProvider extends AbstractTestCase +{ +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + public void testAbstractBeanClass() + { + try + { + final BeanProvider p = new BeanProvider(); + p.setBeanClass(Number.class); + p.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } + + public void testNonAccessibleConstructor() + { + try + { + new BeanProvider(MyBean.class).getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } + + public void testSerialization() + { + assertSerializable(new BeanProvider(MyBean.class)); + } + + public void testWithNullBeanClass() + { + try + { + final BeanProvider p = new BeanProvider(); + p.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } + +//********************************************************************************************************************** +// Inner Classes +//********************************************************************************************************************** + + public static class MyBean + { + private MyBean() + { + + } + } +} \ No newline at end of file Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.provider; + +import org.apache.commons.proxy.exception.ObjectProviderException; +import org.apache.commons.proxy.util.AbstractTestCase; + +import java.util.Date; + +public class TestCloningProvider extends AbstractTestCase +{ +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + public void testSerialization() + { + assertSerializable(new CloningProvider(new Date())); + } + + public void testValidCloneable() + { + final Date now = new Date(); + final CloningProvider provider = new CloningProvider(now); + final Date clone1 = ( Date ) provider.getObject(); + assertEquals(now, clone1); + assertNotSame(now, clone1); + final Date clone2 = ( Date ) provider.getObject(); + assertEquals(now, clone2); + assertNotSame(now, clone2); + assertNotSame(clone2, clone1); + } + + public void testWithExceptionThrown() + { + final CloningProvider provider = new CloningProvider(new ExceptionCloneable()); + try + { + provider.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } + + public void testWithInvalidCloneable() + { + final CloningProvider provider = new CloningProvider(new InvalidCloneable()); + try + { + provider.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } + + public void testWithPrivateCloneMethod() + { + final CloningProvider provider = new CloningProvider(new PrivateCloneable()); + try + { + provider.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } + +//********************************************************************************************************************** +// Inner Classes +//********************************************************************************************************************** + + public static class ExceptionCloneable implements Cloneable + { + public Object clone() + { + throw new RuntimeException("No clone for you!"); + } + } + + public static class InvalidCloneable implements Cloneable + { + } + + public static class PrivateCloneable implements Cloneable + { + protected Object clone() + { + return this; + } + } +} \ No newline at end of file Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.provider; + +import org.apache.commons.proxy.util.AbstractTestCase; + +/** + * @since 1.0 + */ +public class TestConstantProvider extends AbstractTestCase +{ +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + public void testGetObject() throws Exception + { + final String s = "Hello, World!"; + final ConstantProvider provider = new ConstantProvider(s); + assertSame(s, provider.getObject()); + } + + public void testSerialization() + { + assertSerializable(new ConstantProvider("Hello, World!")); + } +} Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.provider; + +import org.apache.commons.proxy.util.AbstractTestCase; + +/** + * @author James Carman + * @since 1.0 + */ +public class TestNullProvider extends AbstractTestCase +{ +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + public void testGetObject() + { + final NullProvider provider = new NullProvider(); + assertNull(provider.getObject()); + } + + public void testSerialization() + { + assertSerializable(new NullProvider()); + } +} Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.provider.remoting; + +import org.apache.commons.proxy.exception.ObjectProviderException; +import org.apache.commons.proxy.util.AbstractTestCase; +import org.apache.commons.proxy.util.Echo; + +public class TestBurlapProvider extends AbstractTestCase +{ +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + public void testSerialization() + { + final BurlapProvider p = new BurlapProvider(); + p.setServiceInterface(Echo.class); + p.setUrl("a malformed URL"); + assertSerializable(p); + } + + public void testWithMalformedUrl() + { + try + { + final BurlapProvider p = new BurlapProvider(Echo.class, "a malformed URL"); + p.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } + + public void testWithMalformedUrlBean() + { + try + { + final BurlapProvider p = new BurlapProvider(); + p.setServiceInterface(Echo.class); + p.setUrl("a malformed URL"); + p.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } +} \ No newline at end of file Added: commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java?rev=964999&view=auto ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java (added) +++ commons/proper/proxy/branches/version-2.0-work/core/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java Sat Jul 17 02:37:50 2010 @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.proxy.provider.remoting; + +import org.apache.commons.proxy.exception.ObjectProviderException; +import org.apache.commons.proxy.util.AbstractTestCase; +import org.apache.commons.proxy.util.Echo; + +public class TestHessianProvider extends AbstractTestCase +{ +//********************************************************************************************************************** +// Other Methods +//********************************************************************************************************************** + + public void testSerialization() + { + final HessianProvider p = new HessianProvider(); + p.setServiceInterface(Echo.class); + p.setUrl("a malformed URL"); + assertSerializable(p); + } + + public void testWithMalformedUrl() + { + try + { + final HessianProvider p = new HessianProvider(Echo.class, "a malformed URL"); + p.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } + + public void testWithMalformedUrlBean() + { + try + { + final HessianProvider p = new HessianProvider(); + p.setServiceInterface(Echo.class); + p.setUrl("a malformed URL"); + p.getObject(); + fail(); + } + catch( ObjectProviderException e ) + { + } + } +} \ No newline at end of file Copied: commons/proper/proxy/branches/version-2.0-work/core/src/test/resources/log4j.properties (from r964961, commons/proper/proxy/branches/version-2.0-work/src/test/resources/log4j.properties) URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/test/resources/log4j.properties?p2=commons/proper/proxy/branches/version-2.0-work/core/src/test/resources/log4j.properties&p1=commons/proper/proxy/branches/version-2.0-work/src/test/resources/log4j.properties&r1=964961&r2=964999&rev=964999&view=diff ============================================================================== (empty) Propchange: commons/proper/proxy/branches/version-2.0-work/core/src/test/resources/log4j.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: commons/proper/proxy/branches/version-2.0-work/javassist/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Sat Jul 17 02:37:50 2010 @@ -0,0 +1 @@ +commons-proxy-javassist.iml Modified: commons/proper/proxy/branches/version-2.0-work/javassist/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/javassist/pom.xml?rev=964999&r1=964998&r2=964999&view=diff ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/javassist/pom.xml (original) +++ commons/proper/proxy/branches/version-2.0-work/javassist/pom.xml Sat Jul 17 02:37:50 2010 @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> - <artifactId>commons-proxy</artifactId> + <artifactId>commons-proxy-parent</artifactId> <groupId>org.apache.commons</groupId> <version>2.0-SNAPSHOT</version> </parent> @@ -14,7 +14,7 @@ <dependencies> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>commons-proxy-core</artifactId> + <artifactId>commons-proxy</artifactId> <version>${project.version}</version> </dependency> <dependency> @@ -24,7 +24,7 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>commons-proxy-core</artifactId> + <artifactId>commons-proxy</artifactId> <version>${project.version}</version> <type>test-jar</type> <scope>test</scope> Propchange: commons/proper/proxy/branches/version-2.0-work/jdk/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Sat Jul 17 02:37:50 2010 @@ -0,0 +1 @@ +commons-proxy-jdk.iml Modified: commons/proper/proxy/branches/version-2.0-work/jdk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/jdk/pom.xml?rev=964999&r1=964998&r2=964999&view=diff ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/jdk/pom.xml (original) +++ commons/proper/proxy/branches/version-2.0-work/jdk/pom.xml Sat Jul 17 02:37:50 2010 @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> - <artifactId>commons-proxy</artifactId> + <artifactId>commons-proxy-parent</artifactId> <groupId>org.apache.commons</groupId> <version>2.0-SNAPSHOT</version> </parent> @@ -14,12 +14,12 @@ <dependencies> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>commons-proxy-core</artifactId> + <artifactId>commons-proxy</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>commons-proxy-core</artifactId> + <artifactId>commons-proxy</artifactId> <version>${project.version}</version> <type>test-jar</type> <scope>test</scope> Modified: commons/proper/proxy/branches/version-2.0-work/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/pom.xml?rev=964999&r1=964998&r2=964999&view=diff ============================================================================== --- commons/proper/proxy/branches/version-2.0-work/pom.xml (original) +++ commons/proper/proxy/branches/version-2.0-work/pom.xml Sat Jul 17 02:37:50 2010 @@ -28,9 +28,9 @@ <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-parent</artifactId> - <version>16</version> + <version>17</version> </parent> - <artifactId>commons-proxy</artifactId> + <artifactId>commons-proxy-parent</artifactId> <version>2.0-SNAPSHOT</version> <name>Commons Proxy</name> <description>Java library for dynamic proxying</description>