@Test public void testRewriteForTesting_Connection() throws Exception { NullConnection conn = new NullConnection(); StandaloneProducer service = new StandaloneProducer(conn, new NullMessageProducer()); StandaloneProducer rewritten = ((StandaloneProducer) rewriteConnectionsForTesting(service)); assertNotSame(conn, rewritten.getConnection()); }
public static Service rewriteConnectionsForTesting(Service service) throws CoreException { Service rewritten = service; if (rewritten instanceof ConnectedService) { ConnectedService connectedService = (ConnectedService) rewritten; connectedService.setConnection(cloneForTesting(connectedService.getConnection())); } if (rewritten instanceof ServiceCollection) { rewriteConnectionsForTesting((ServiceCollection) rewritten); } if (rewritten instanceof ServiceWrapper) { rewriteConnectionsForTesting((ServiceWrapper) rewritten); } return rewritten; }
ServiceUtil { public static Service rewriteConnectionsForTesting(Service service) throws CoreException { Service rewritten = service; if (rewritten instanceof ConnectedService) { ConnectedService connectedService = (ConnectedService) rewritten; connectedService.setConnection(cloneForTesting(connectedService.getConnection())); } if (rewritten instanceof ServiceCollection) { rewriteConnectionsForTesting((ServiceCollection) rewritten); } if (rewritten instanceof ServiceWrapper) { rewriteConnectionsForTesting((ServiceWrapper) rewritten); } return rewritten; } }
ServiceUtil { public static Service rewriteConnectionsForTesting(Service service) throws CoreException { Service rewritten = service; if (rewritten instanceof ConnectedService) { ConnectedService connectedService = (ConnectedService) rewritten; connectedService.setConnection(cloneForTesting(connectedService.getConnection())); } if (rewritten instanceof ServiceCollection) { rewriteConnectionsForTesting((ServiceCollection) rewritten); } if (rewritten instanceof ServiceWrapper) { rewriteConnectionsForTesting((ServiceWrapper) rewritten); } return rewritten; }  }
ServiceUtil { public static Service rewriteConnectionsForTesting(Service service) throws CoreException { Service rewritten = service; if (rewritten instanceof ConnectedService) { ConnectedService connectedService = (ConnectedService) rewritten; connectedService.setConnection(cloneForTesting(connectedService.getConnection())); } if (rewritten instanceof ServiceCollection) { rewriteConnectionsForTesting((ServiceCollection) rewritten); } if (rewritten instanceof ServiceWrapper) { rewriteConnectionsForTesting((ServiceWrapper) rewritten); } return rewritten; }  static Service[] discardNulls(Service... services); static Service rewriteConnectionsForTesting(Service service); }
ServiceUtil { public static Service rewriteConnectionsForTesting(Service service) throws CoreException { Service rewritten = service; if (rewritten instanceof ConnectedService) { ConnectedService connectedService = (ConnectedService) rewritten; connectedService.setConnection(cloneForTesting(connectedService.getConnection())); } if (rewritten instanceof ServiceCollection) { rewriteConnectionsForTesting((ServiceCollection) rewritten); } if (rewritten instanceof ServiceWrapper) { rewriteConnectionsForTesting((ServiceWrapper) rewritten); } return rewritten; }  static Service[] discardNulls(Service... services); static Service rewriteConnectionsForTesting(Service service);  }