On Friday, September 2, 2011 4:11:19 PM UTC+2, Magno Machado wrote: > > Even if I use new instances for the requestfactory interface, transport, > service layer and etc for each test, it would still share the services > between one test and another? >
Yes, because the cache is done in 'static' fields in the CachingServiceLayer. It's easy to workaround it, but still too bad that it has to be done! In your test case: private static final Field methodCacheField; static { Class<?> serviceLayerCacheClass; try { serviceLayerCacheClass = Class.forName("com.google.gwt.requestfactory.server.ServiceLayerCache"); methodCacheField = serviceLayerCacheClass.getDeclaredField("methodCache"); methodCacheField.setAccessible(true); } catch (Exception e) { throw new ExceptionInInitializerError(e); } } ... // in your @Before or setUp() method ServiceLayer serviceLayer; synchronized (methodCacheField.getDeclaringClass()) { // Make sure we won't use the cache from someone else (a new one will be created, empty) methodCacheField.set(null, null); serviceLayer = ServiceLayer.create(<your ServiceLayerDecorators here, if any>); // Make sure we do not share our cache with someone else either. methodCacheField.set(null, null); } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/W4L1Z0UNZVIJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.