@Test public void testRewriteForTesting_NoConnection() throws Exception { NullService nullService = new NullService(); JdbcServiceList jdbcService = new JdbcServiceList(); StatelessServiceWrapper stateless = new StatelessServiceWrapper(new StandaloneProducer()); assertTrue(nullService == rewriteConnectionsForTesting(nullService)); assertTrue(jdbcService == rewriteConnectionsForTesting(jdbcService)); assertTrue(stateless == rewriteConnectionsForTesting(stateless)); ServiceList nestedList = new ServiceList(); ServiceList list = new ServiceList(); list.add(nestedList); assertTrue(list == rewriteConnectionsForTesting(list)); }
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);  }