From: Juergen H. <jho...@us...> - 2006-04-21 00:13:56
|
Update of /cvsroot/springframework/spring/test/org/springframework/remoting/rmi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/test/org/springframework/remoting/rmi Modified Files: Tag: mbranch-1-2 RmiSupportTests.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: RmiSupportTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/remoting/rmi/RmiSupportTests.java,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** RmiSupportTests.java 25 Mar 2005 09:28:37 -0000 1.6 --- RmiSupportTests.java 21 Apr 2006 00:13:51 -0000 1.6.4.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed 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, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed 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, *************** *** 35,38 **** --- 35,39 ---- import org.springframework.remoting.RemoteAccessException; import org.springframework.remoting.RemoteConnectFailureException; + import org.springframework.remoting.RemoteProxyFailureException; import org.springframework.remoting.support.RemoteInvocation; *************** *** 174,177 **** --- 175,198 ---- } + public void testRmiProxyFactoryBeanWithWrongBusinessInterface() throws Exception { + CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); + factory.setServiceInterface(IWrongBusinessBean.class); + factory.setServiceUrl("rmi://localhost:1090/test"); + factory.afterPropertiesSet(); + assertTrue(factory.getObject() instanceof IWrongBusinessBean); + IWrongBusinessBean proxy = (IWrongBusinessBean) factory.getObject(); + assertFalse(proxy instanceof IRemoteBean); + try { + proxy.setOtherName("name"); + fail("Should have thrown RemoteProxyFailureException"); + } + catch (RemoteProxyFailureException ex) { + assertTrue(ex.getCause() instanceof NoSuchMethodException); + assertTrue(ex.getMessage().indexOf("setOtherName") != -1); + assertTrue(ex.getMessage().indexOf("IWrongBusinessBean") != -1); + } + assertEquals(1, factory.counter); + } + public void testRmiProxyFactoryBeanWithBusinessInterfaceAndRemoteException() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( *************** *** 216,219 **** --- 237,241 ---- private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( Class rmiExceptionClass, Class springExceptionClass) throws Exception { + CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IBusinessBean.class); *************** *** 403,406 **** --- 425,435 ---- + public static interface IWrongBusinessBean { + + public void setOtherName(String name); + + } + + public static interface IRemoteBean extends Remote { |