View Javadoc

1   package test.crispy.impl;
2   
3   import java.util.ArrayList;
4   import java.util.Date;
5   import java.util.List;
6   import java.util.Properties;
7   
8   import junit.framework.TestCase;
9   import net.sf.crispy.Property;
10  import net.sf.crispy.impl.ServiceManager;
11  import net.sf.crispy.impl.StaticBurlapProxy;
12  import net.sf.crispy.impl.caucho.MiniCauchoServer;
13  import net.sf.crispy.interceptor.StopWatchInterceptor;
14  import net.sf.crispy.strategy.ClassWithOutPackageInvocationStrategy;
15  import test.crispy.JUnitTestException;
16  import test.crispy.JUnitTestException2;
17  import test.crispy.compatibility.CompatibilityKit;
18  import test.crispy.concurrent.AsynchronousCallbackForTests;
19  import test.crispy.example.interceptor.WaitInterceptor;
20  import test.crispy.example.model.Kunde;
21  import test.crispy.example.model.Primitive;
22  import test.crispy.example.model.SubSubProblemNode;
23  import test.crispy.example.model.ValidationError;
24  import test.crispy.example.service.Calculator;
25  import test.crispy.example.service.CalculatorImpl;
26  import test.crispy.example.service.Echo;
27  import test.crispy.example.service.EchoImpl;
28  import test.crispy.example.service.MyService;
29  import test.crispy.example.service.MyServiceImpl;
30  
31  public class StaticBurlapTest extends TestCase {
32  
33  	private static MiniCauchoServer miniBurlapServer = null;
34  	private CompatibilityKit compatibilityKit = new CompatibilityKit();
35  
36  	public StaticBurlapTest() {
37  		if (miniBurlapServer == null) {
38  			miniBurlapServer = new MiniCauchoServer(MiniCauchoServer.SERVER_TYPE_BURLAP, 8093);
39  			miniBurlapServer.addService(Echo.class.getName(), EchoImpl.class.getName());
40  			miniBurlapServer.addService(Calculator.class.getName(), CalculatorImpl.class.getName());
41  			miniBurlapServer.addService("Echo", EchoImpl.class.getName());
42  			miniBurlapServer.addService("Calculator", CalculatorImpl.class.getName());			
43  			miniBurlapServer.addService(MyService.class.getName(), MyServiceImpl.class.getName());
44  			miniBurlapServer.start();
45  		}
46  		compatibilityKit.addProperty(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
47  	}
48  
49  	protected void setUp() throws Exception {
50  		super.setUp();
51  		compatibilityKit.removeProperty(Property.DYNAMIC_PROXY_CLASS);
52  		compatibilityKit.addProperty(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
53  	}
54  			
55      public void _testOverloadingObject() throws Exception {
56  		Properties prop = new Properties();
57      	prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
58      	prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
59      	
60  		ServiceManager manager = new ServiceManager(prop);
61  		Echo echo =  (Echo) manager.createService(Echo.class);
62  		Object o[] = echo.echoArray(new Object[] {"a", "b", "c"}); 
63  		assertTrue(o.length == 3);
64  		// eigentlich falsch (overloading klappt nicht -> ruft die falsche Methode auf)
65  		// 97 entsprincht 'a'
66  //		assertEquals(o[0], new Integer(97));
67  //		assertEquals(o[1], "b");
68  //		assertEquals(o[2], "c");
69  	}
70  
71      public void testEchoPrimitive() throws Exception {
72      	Properties prop = new Properties();
73      	prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
74      	prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
75      	
76          ServiceManager lvServiceManager = new ServiceManager(prop);
77          Echo lvEcho = (Echo) lvServiceManager.createService(Echo.class);
78          Primitive lvPrimitive = Primitive.createPrimitiveExample();
79          
80          Primitive lvPrimitiveAfter = lvEcho.echoPrimitive(lvPrimitive);
81          assertEquals(lvPrimitive, lvPrimitiveAfter);
82          assertNotSame(lvPrimitive, lvPrimitiveAfter);
83  	}
84  
85  	public void testCreateService() throws Exception {
86  		compatibilityKit.makeCreateService(compatibilityKit.createServiceManager());		
87  	}
88  
89  	public void testSimpleRemotePing() throws Exception {
90  		Properties prop = new Properties();
91      	prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
92      	prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
93      	
94  		ServiceManager manager = new ServiceManager(prop);
95  		Echo echo =  (Echo) manager.createService(Echo.class);
96  		String lvPing = echo.ping();
97  		assertEquals(lvPing, Echo.PING_STRING);
98  	}
99  	
100 	
101 	public void testSimpleRemoteInvocation() throws Exception {
102     	compatibilityKit.makeSimpleEchoTest(compatibilityKit.createServiceManager());
103 	}
104 
105     public void testSimpleDoubleRemoteInvocation() throws Exception {
106     	compatibilityKit.makeMultipleServiceTest();
107     }
108     
109     public void testComplexRemoteInvocation() throws Exception {
110     	compatibilityKit.makeComplexEchoTest(compatibilityKit.createServiceManager());
111     }
112 	
113     public void testCycleDetectionTest() throws Exception {
114 		compatibilityKit.makeCycleDetectionTest(compatibilityKit.createServiceManager());
115 	}
116     
117     public void testAddNode() throws Exception {
118     	compatibilityKit.makeAddNodeTest(compatibilityKit.createServiceManager());
119 	}
120     
121     public void testProxyInterceptor() throws Exception {
122     	compatibilityKit.addProperty(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
123     	compatibilityKit.makeSimpleProxyInterceptorTest();
124     }
125 
126     public void testMultiProxyInterceptor() throws Exception {
127     	compatibilityKit.addProperty(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
128     	compatibilityKit.makeMultiProxyInterceptorTest();
129     }
130 
131     public void testSimpleRemoteInvocationWithDynamicJdkProxy() throws Exception {
132     	compatibilityKit.addProperty(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
133     	compatibilityKit.makeSimpleEchoTest(compatibilityKit.createServiceManager());
134 	}
135 
136     public void testSimpleRemoteInvocationWithOutDynamicJdkProxy() throws Exception {
137         Properties prop = new Properties();
138         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
139         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
140         prop.put(Property.INTERCEPTOR_CLASS, WaitInterceptor.class.getName());
141         prop.put(Property.INTERCEPTOR_CLASS_2, StopWatchInterceptor.class.getName());		
142 		
143 		ServiceManager lvManager = new ServiceManager(prop);
144 		Calculator lvCalculator = (Calculator) lvManager.createService(Calculator.class);
145 		int lvResult = lvCalculator.add(2, 3);
146 		assertEquals(lvResult, 5);
147 		StopWatchInterceptor lvStopWatchInterceptor = (StopWatchInterceptor) lvManager.getInterceptorByPos(1);
148 		long lvStopTime = lvStopWatchInterceptor.getStopTimeInvokeMethod();
149 		assertTrue("StopTime is: " + lvStopTime, lvStopTime > 10);
150 		
151 		lvManager.removeInterceptorByPos(0);
152 		lvManager.removeInterceptorByPos(0);
153 		lvResult = lvCalculator.add(2, 3);
154 		assertEquals(lvStopTime, lvStopWatchInterceptor.getStopTimeInvokeMethod());
155 		assertEquals(lvResult, 5);
156 		
157 		lvStopWatchInterceptor.clearStopTimeInvokeMethod();
158 		lvResult = lvCalculator.add(3, 4);
159 		lvStopTime = lvStopWatchInterceptor.getStopTimeInvokeMethod();
160 		assertEquals(lvStopTime, 0);
161 		assertEquals(lvResult, 7);		
162     }
163     
164     public void testModifyService() throws Exception {
165     	compatibilityKit.addProperty(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
166 		compatibilityKit.makeModifyServiceTest(compatibilityKit.createServiceManager());
167 	}
168     
169     public void testAddLongs() throws Exception {
170     	Properties prop = new Properties();
171     	prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
172     	prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
173     	
174 		ServiceManager manager = new ServiceManager(prop);
175 		Calculator calc =  (Calculator) manager.createService(Calculator.class);
176 		assertEquals(calc.addLong(new Long(123l), new Long(124l)), new Long(247));
177 	}    
178     
179     public void testOverloading() throws Exception {
180 		Properties prop = new Properties();
181     	prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
182     	prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
183     	
184 		ServiceManager manager = new ServiceManager(prop);
185 		Calculator lvCalculator = (Calculator) manager.createService(Calculator.class);
186 		int lvIntResult = lvCalculator.add(2, 3);
187 		assertEquals(lvIntResult, 5);
188 		long lvLongResult = lvCalculator.add(21, 32);
189 		assertEquals(lvLongResult, 53);
190 
191 //		Overloading work not every time ???		
192 //		double lvDoubleResult = lvCalculator.add(2.3, 3.2);
193 //		assertEquals(lvDoubleResult, 5.5, 0);
194     }
195     
196     public void _testOverloadingInteger() throws Exception {
197 		Properties prop = new Properties();
198     	prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
199     	prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
200     	
201 		ServiceManager manager = new ServiceManager(prop);
202 		Echo echo =  (Echo) manager.createService(Echo.class);
203 		Integer i[] = echo.echoArray(new Integer[] {new Integer(1), new Integer(3), new Integer(5)});
204 		assertTrue(i.length == 3);
205 		assertEquals(i[0], new Integer(1));
206 		assertEquals(i[1], new Integer(3));
207 		assertEquals(i[2], new Integer(5));
208 	}
209     
210     public void _testOverloadingLong() throws Exception {
211 		Properties prop = new Properties();
212     	prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
213     	prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
214     	
215 		ServiceManager manager = new ServiceManager(prop);
216 		Echo echo =  (Echo) manager.createService(Echo.class);
217 		Long l[] = echo.echoArray(new Long[] {new Long(1), new Long(5)});
218 		assertTrue(l.length == 2);
219 		assertEquals(l[0], new Long(1));
220 		assertEquals(l[1], new Long(5));
221 	}
222 
223 
224     
225     
226     
227     public void testSetInvocationStrategy() throws Exception {
228         Properties prop = new Properties();
229         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
230         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
231         prop.put(Property.INVOCATION_STRATEGY, ClassWithOutPackageInvocationStrategy.class.getName());
232         
233 		
234 		ServiceManager lvManager = new ServiceManager(prop);
235 		Calculator lvCalculator = (Calculator) lvManager.createService(Calculator.class);
236 		int lvResult = lvCalculator.add(2, 3);
237 		assertEquals(lvResult, 5);
238 		
239 		Echo lvEcho = (Echo) lvManager.createService(Echo.class);
240 		String lvEchoString = "Hello Crispy ...";
241 		assertEquals(lvEchoString, lvEcho.echo(lvEchoString));
242 	}
243     
244     public void testThrowException() throws Exception {
245         Properties prop = new Properties();
246         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
247         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
248 		
249 		ServiceManager lvManager = new ServiceManager(prop);
250 		Echo lvEcho = (Echo) lvManager.createService(Echo.class);
251 		boolean throwException = false;
252 		try {
253 			lvEcho.throwException("A Test-Excption.");
254 		} catch (JUnitTestException e) {
255 			throwException = true;
256 		}
257 		assertTrue("No Exception thrown: " + throwException, throwException);
258 //		compatibilityKit.makeThrowException(lvManager);
259 	}
260 
261     public void testNullValueParamsWithException() throws Exception {
262         Properties prop = new Properties();
263         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
264         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
265         
266 		ServiceManager lvManager = new ServiceManager(prop);
267 
268 		Echo lvEcho = (Echo) lvManager.createService(Echo.class);
269 		String s = lvEcho.echo(null);
270 		assertNull(s);
271 	}
272 
273     public void testNullLongValueParams() throws Exception {
274         Properties prop = new Properties();
275         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
276         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
277         
278 		ServiceManager lvManager = new ServiceManager(prop);
279 
280 		Calculator lvCalculator = (Calculator) lvManager.createService(Calculator.class);
281 		Long lvLong = lvCalculator.addLong(null, null);
282 		assertNull(lvLong);
283 	}
284 
285     public void testNullComplexValueParams() throws Exception {
286         Properties prop = new Properties();
287         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
288         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
289 		
290 		ServiceManager lvManager = new ServiceManager(prop);
291 
292 		Echo lvEcho = (Echo) lvManager.createService(Echo.class);
293 		Kunde k = lvEcho.renameKunde(null, null);
294 		assertNull(k);
295 	}
296 
297     
298 	public void testTransferDate() throws Exception {
299 		Properties prop = new Properties();
300         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
301         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
302 		
303 		ServiceManager manager = new ServiceManager(prop);
304 		MyService lvMyService = (MyService) manager.createService(MyService.class);
305 		
306 		SubSubProblemNode lvNode = new SubSubProblemNode();
307 		Date d = new Date();
308 		lvNode.setDate(d);
309 		SubSubProblemNode lvNodeAfter = lvMyService.transferSubSubProblemNode(lvNode);
310 		assertNotNull(lvNodeAfter.getDate());
311 		assertEquals(lvNode.getDate(), lvNodeAfter.getDate());
312 	}
313 
314 	public void testNewInstanceWithImplementation() throws Exception {
315 		try {
316 			StaticBurlapProxy lvProxy = new StaticBurlapProxy();
317 			lvProxy.newInstance(EchoImpl.class);
318 			fail("New instance is not possible for a implementation. It must be a interface.");
319 		} catch (Exception e) {
320 			assertTrue(true);
321 		}
322 	}
323 
324 	
325 	
326 	public void testAsynchronousInvocation() throws Exception {
327 		Properties prop = new Properties();
328         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
329         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
330     	prop.put(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
331 		prop.put(Property.ASYNCHRONOUS_CALLBACK_CLASS, AsynchronousCallbackForTests.class.getName());
332 		
333 		ServiceManager manager = new ServiceManager(prop);
334 		Echo echo =  (Echo) manager.createService(Echo.class);
335 		String lvPing = echo.ping();
336 		assertNull(lvPing);
337 		
338         assertTrue(manager.isInvocationAsynchronous(Echo.class));
339         
340         Thread.sleep(300);
341         AsynchronousCallbackForTests lvAsynchronousCallbackForTests = (AsynchronousCallbackForTests) manager.getAsynchronousCallback(Echo.class);
342         assertNotNull(lvAsynchronousCallbackForTests);
343         
344         assertEquals("ping", lvAsynchronousCallbackForTests.getMethodName());
345         assertEquals(Echo.PING_STRING, lvAsynchronousCallbackForTests.getResult());
346         assertNull(lvAsynchronousCallbackForTests.getThrowable());
347 	}
348 	
349 	public void testAsynchronousInvocationWithMultyThreaded() throws Exception {
350 		Properties prop = new Properties();
351         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
352         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
353 		prop.put(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
354 		prop.put(Property.ASYNCHRONOUS_CALLBACK_CLASS, AsynchronousCallbackForTests.class.getName());
355 		prop.put(Property.ASYNCHRONOUS_MAX_SIZE_OF_THREADS, "3");
356 		
357 		ServiceManager manager = new ServiceManager(prop);
358 		Echo echo =  (Echo) manager.createService(Echo.class);
359 		String lvPing = echo.ping();
360 		assertNull(lvPing);
361 		
362         assertTrue(manager.isInvocationAsynchronous(Echo.class));
363         
364         Thread.sleep(500);
365         AsynchronousCallbackForTests lvAsynchronousCallbackForTests = (AsynchronousCallbackForTests) manager.getAsynchronousCallback(Echo.class);
366         assertNotNull(lvAsynchronousCallbackForTests);
367         
368         assertEquals("ping", lvAsynchronousCallbackForTests.getMethodName());
369         assertEquals(Echo.PING_STRING, lvAsynchronousCallbackForTests.getResult());
370         assertNull(lvAsynchronousCallbackForTests.getThrowable());
371 	}
372 
373 	public void testIndivualAsynchronousInvocationWithMultyThreaded() throws Exception {
374 		Properties prop = new Properties();
375         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
376         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
377         prop.put(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
378 
379 		ServiceManager manager = new ServiceManager(prop);
380 		AsynchronousCallbackForTests lvCallback = new AsynchronousCallbackForTests();
381 		Echo e = (Echo) manager.createService(Echo.class, lvCallback, null, 8);
382 		
383 		String lvEchoStr = null;
384 		for (int i=0;i<3;i++) {
385 			lvEchoStr = e.echo("Hello");
386 			assertNull(lvEchoStr);
387 		}
388 		
389 		Thread.sleep(500);
390         assertEquals("echo", lvCallback.getMethodName());
391         assertEquals("Hello", lvCallback.getResult());
392         assertNull(lvCallback.getThrowable());
393 		
394 	}
395 	
396 	public void testIndivualAsynchronousInvocationWithMultyThreadedWith2Services() throws Exception {
397 		Properties prop = new Properties();
398         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
399         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
400         prop.put(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
401 
402 		ServiceManager manager = new ServiceManager(prop);
403 		AsynchronousCallbackForTests lvCallback = new AsynchronousCallbackForTests();
404 		Echo lvEcho = (Echo) manager.createService(Echo.class, lvCallback, null, 8);
405 		Calculator lvCalculator =  (Calculator) manager.createService(Calculator.class, lvCallback, null, 8);
406 		
407 		assertNotNull(lvEcho);
408 		assertNotNull(lvCalculator);
409 		
410 		String lvEchoStr = null;
411 		int lvAddResult = -1;
412 		for (int i=0;i<3;i++) {
413 			lvEchoStr = lvEcho.echo("Hello");
414 			assertNull(lvEchoStr);
415 			lvAddResult = lvCalculator.add(123, 456);
416 			assertEquals(0, lvAddResult);
417 		}
418 	}
419 
420 	public void testIndivualAsynchronousInvocationWithMethodFilter() throws Exception {
421 		Properties prop = new Properties();
422         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
423         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
424         prop.put(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
425 
426 		ServiceManager manager = new ServiceManager(prop);
427 		AsynchronousCallbackForTests lvCallback = new AsynchronousCallbackForTests();
428 		Echo e = (Echo) manager.createService(Echo.class, lvCallback, new String[] { "doLongExecution" }, 4);
429 		
430 		String lvEchoStr = null;
431 		String lvLongExecution = null;
432 		for (int i=0;i<3;i++) {
433 			lvLongExecution = e.doLongExecution("Hello");
434 			assertNotNull(lvLongExecution);
435 			assertEquals("Hello", lvLongExecution);
436 			lvEchoStr = e.echo("Hello");
437 			assertNull(lvEchoStr);
438 		}
439 	}
440 
441 	
442 	public void testAddAndRemoveAsynchronousCallback() throws Exception {
443 		Properties prop = new Properties();
444         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
445         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
446         prop.put(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
447 
448 
449 		ServiceManager manager = new ServiceManager(prop);
450 		AsynchronousCallbackForTests lvCallback = new AsynchronousCallbackForTests();
451 		Echo e = (Echo) manager.createService(Echo.class, lvCallback, new String[] { "doLongExecution" }, 4);
452 		Calculator c =  (Calculator) manager.createService(Calculator.class, lvCallback, null, 4);
453 				
454 		String lvEchoStr = e.echo("Hello");
455 		assertNull(lvEchoStr);
456 		
457 		Long lvAddResult = c.addLong(new Long(1), new Long(3));
458 		assertNull(lvAddResult);
459 		
460 		assertTrue(manager.isInvocationAsynchronous(Calculator.class));
461 		manager.removeAsynchronousCallback(Calculator.class);
462 		assertFalse(manager.isInvocationAsynchronous(Calculator.class));
463 		
464 		lvEchoStr = e.echo("Hello2");
465 		assertNull(lvEchoStr);
466 		
467 		lvAddResult = c.addLong(new Long(2), new Long(3));
468 		assertNotNull(lvAddResult);
469 		assertEquals(new Long(5), lvAddResult);
470 		
471 		
472 		manager.removeAsynchronousCallback(Echo.class);
473 		
474 		lvEchoStr = e.echo("Hello3");
475 		assertNotNull(lvEchoStr);
476 		assertEquals("Hello3", lvEchoStr);
477 	}
478 
479 	public void testNotRemoteMethod() throws Exception {
480 		Properties prop = new Properties();
481         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
482         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
483         prop.put(Property.DYNAMIC_PROXY_CLASS, Property.VALUE_FOR_JDK_DYNAMIC_PROXY);
484         
485 		ServiceManager manager = new ServiceManager(prop);
486 		Calculator calc1 =  (Calculator) manager.createService(Calculator.class);
487 		Calculator calc2 =  (Calculator) manager.createService(Calculator.class);
488 		
489 		assertFalse(calc1.equals( calc2));
490 		assertFalse(calc1 == calc2);
491 		
492 		assertEquals(calc1.hashCode(), 0);
493 		assertEquals(calc2.hashCode(), 0);
494 		
495 		try {
496 			calc1.notify();	
497 			fail("Notify is not supported");
498 		} catch (Exception e) {
499 			assertTrue(true);
500 		}
501 
502 		try {
503 			calc1.notifyAll();	
504 			fail("NotifyAll is not supported");
505 		} catch (Exception e) {
506 			assertTrue(true);
507 		}
508 
509 		try {
510 			calc1.wait();	
511 			fail("Wait is not supported");
512 		} catch (Exception e) {
513 			assertTrue(true);
514 		}
515 
516 	}
517 
518 	public void testEquals() throws Exception {
519 		Properties prop = new Properties();
520         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
521         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
522         
523 		ServiceManager manager = new ServiceManager(prop);
524 		Calculator calc1 =  (Calculator) manager.createService(Calculator.class);
525 		Calculator calc2 =  (Calculator) manager.createService(Calculator.class);
526 		Echo echo =  (Echo) manager.createService(Echo.class);
527 		
528 		assertEquals(calc1, calc2);
529 		assertFalse(calc1.equals( echo));
530 	}
531 
532 	public void testRemoteMethodWithThrownExceptionWithValidationErrors() throws Exception {
533 		Properties prop = new Properties();
534         prop.put(Property.STATIC_PROXY_CLASS, StaticBurlapProxy.class.getName());
535         prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:8093/crispy/burlap");
536 
537     	
538 		ServiceManager manager = new ServiceManager(prop);
539 		Echo lvEcho = (Echo) manager.createService(Echo.class);
540 		
541 		List lvValidationErrors = new ArrayList();
542 		ValidationError lvError1 = new ValidationError(1, "Error 1");
543 		ValidationError lvError2 = new ValidationError(2, "Error 2");
544 		lvValidationErrors.add(lvError1);
545 		lvValidationErrors.add(lvError2);
546 		try {
547 			lvEcho.throwComplexException("JUnit-Test", lvValidationErrors);
548 			fail("The method throwComplexEception must be thrown a Exception");
549 		} catch (Exception e) {
550 			assertTrue(e instanceof JUnitTestException2);
551 			assertEquals(lvValidationErrors.size(), ((JUnitTestException2) e).getValidationErrors().size());
552 		}
553 	}
554 }