@Test public void testExport() throws Exception { final int N = 3; Integer[] counts = new Integer[N]; for (int i = 0; i < N; i++) { counts[i] = i; } Object[][] combinations = ArrayUtils.combinations(new Object[][] { counts, counts, booleanAxis}); int i = 0; while (i < combinations.length) { int exportCount = (Integer) combinations[i][0]; int unexportCount = (Integer) combinations[i][1]; boolean force = (Boolean) combinations[i][2]; LoggingWatchDataSourceImpl impl = new LoggingWatchDataSourceImpl( "watch", null, EmptyConfiguration.INSTANCE); List<WatchDataSource> proxies = new ArrayList<WatchDataSource>(); for (int j = 0; j < exportCount; j++) { proxies.add(impl.export()); } for (int j = 0; j < unexportCount; j++) { impl.unexport(force); } if (exportCount > 0 && unexportCount == 0 ) { Assert.assertNotNull(impl.getProxy()); } else { Assert.assertNull(impl.getProxy()); } WatchDataSource proxy = impl.export(); Assert.assertNotNull(proxy); assertValidProxy(proxy, impl); Assert.assertSame(proxy, impl.getProxy()); if (proxies.size() > 0) { assertAllSame(proxies); if (unexportCount == 0) { Assert.assertSame(proxies.get(0), proxy); } else { Assert.assertNotSame(proxies.get(0), proxy); } } assertAddCalculableWorks(impl, 10, true); impl.close(); i++; } }
public WatchDataSource export() throws RemoteException { if(exported && proxy!=null) return(proxy); if(config != null) { try { exporter = ExporterConfig.getExporter(config, COMPONENT, "watchDataSourceExporter"); } catch(Exception e) { logger.error("Getting watchDataSourceExporter", e); } } proxy = (WatchDataSource)exporter.export(this); exported = true; return (proxy); }
WatchDataSourceImpl implements WatchDataSource, ServerProxyTrust { public WatchDataSource export() throws RemoteException { if(exported && proxy!=null) return(proxy); if(config != null) { try { exporter = ExporterConfig.getExporter(config, COMPONENT, "watchDataSourceExporter"); } catch(Exception e) { logger.error("Getting watchDataSourceExporter", e); } } proxy = (WatchDataSource)exporter.export(this); exported = true; return (proxy); } }
WatchDataSourceImpl implements WatchDataSource, ServerProxyTrust { public WatchDataSource export() throws RemoteException { if(exported && proxy!=null) return(proxy); if(config != null) { try { exporter = ExporterConfig.getExporter(config, COMPONENT, "watchDataSourceExporter"); } catch(Exception e) { logger.error("Getting watchDataSourceExporter", e); } } proxy = (WatchDataSource)exporter.export(this); exported = true; return (proxy); } WatchDataSourceImpl();  WatchDataSourceImpl(String id, Configuration config); }
WatchDataSourceImpl implements WatchDataSource, ServerProxyTrust { public WatchDataSource export() throws RemoteException { if(exported && proxy!=null) return(proxy); if(config != null) { try { exporter = ExporterConfig.getExporter(config, COMPONENT, "watchDataSourceExporter"); } catch(Exception e) { logger.error("Getting watchDataSourceExporter", e); } } proxy = (WatchDataSource)exporter.export(this); exported = true; return (proxy); } WatchDataSourceImpl();  WatchDataSourceImpl(String id, Configuration config); void initialize(); WatchDataSource export(); WatchDataSource getProxy(); void setConfiguration(Configuration config); void unexport(boolean force); String getID(); void setID(String id); void setMaxSize(int size); void clear(); int getMaxSize(); int getCurrentSize(); @SuppressWarnings("unchecked") void addCalculable(Calculable calculable); Calculable[] getCalculable(); Calculable[] getCalculable(String id); Calculable[] getCalculable(long from, long to); Calculable getLastCalculable(); ThresholdValues getThresholdValues(); void setThresholdValues(ThresholdValues tValues); void close(); void setView(String viewClass); String getView(); TrustVerifier getProxyVerifier(); boolean addWatchDataReplicator(WatchDataReplicator replicator); boolean removeWatchDataReplicator(WatchDataReplicator replicator); WatchDataReplicator[] getWatchDataReplicators(); }
WatchDataSourceImpl implements WatchDataSource, ServerProxyTrust { public WatchDataSource export() throws RemoteException { if(exported && proxy!=null) return(proxy); if(config != null) { try { exporter = ExporterConfig.getExporter(config, COMPONENT, "watchDataSourceExporter"); } catch(Exception e) { logger.error("Getting watchDataSourceExporter", e); } } proxy = (WatchDataSource)exporter.export(this); exported = true; return (proxy); } WatchDataSourceImpl();  WatchDataSourceImpl(String id, Configuration config); void initialize(); WatchDataSource export(); WatchDataSource getProxy(); void setConfiguration(Configuration config); void unexport(boolean force); String getID(); void setID(String id); void setMaxSize(int size); void clear(); int getMaxSize(); int getCurrentSize(); @SuppressWarnings("unchecked") void addCalculable(Calculable calculable); Calculable[] getCalculable(); Calculable[] getCalculable(String id); Calculable[] getCalculable(long from, long to); Calculable getLastCalculable(); ThresholdValues getThresholdValues(); void setThresholdValues(ThresholdValues tValues); void close(); void setView(String viewClass); String getView(); TrustVerifier getProxyVerifier(); boolean addWatchDataReplicator(WatchDataReplicator replicator); boolean removeWatchDataReplicator(WatchDataReplicator replicator); WatchDataReplicator[] getWatchDataReplicators(); final static int DEFAULT_COLLECTION_SIZE; final static int MAX_COLLECTION_SIZE; }