@Test public void testCopyInternalModel() throws Exception { System.out.println("copyInternalModel"); AcmeRuntimeAggregator instance = new AcmeRuntimeAggregator(systemConfig, new DummyDatabaseConnector()); double value1 = 99.9; double value2 = 0.0; IModelInstance<IAcmeSystem> modelInstance = instance.getInternalModel(); IAcmeSystem system = modelInstance.getModelInstance(); IAcmeProperty prop = (IAcmeProperty) system.getComponent("Server0").getProperty("load"); assertNotNull(prop); IAcmePropertyValue val1 = StandaloneLanguagePackHelper.defaultLanguageHelper().propertyValueFromString( Double.toString(value1), new RegionManager()); IAcmeCommand command = system.getCommandFactory().propertyValueSetCommand(prop, val1); command.execute(); IModelInstance<IAcmeSystem> copyModelInstance = instance.copyInternalModel(); assertNotNull(copyModelInstance); IAcmePropertyValue val2 = StandaloneLanguagePackHelper.defaultLanguageHelper().propertyValueFromString( Double.toString(value2), new RegionManager()); command = system.getCommandFactory().propertyValueSetCommand(prop, val2); command.execute(); IAcmePropertyValue origValue = prop.getValue(); assertNotNull(origValue); IAcmeSystem copySystem = copyModelInstance.getModelInstance(); assertNotNull(copySystem); IAcmeProperty copyProp = (IAcmeProperty) copySystem.getComponent("Server0").getProperty("load"); assertNotNull(copyProp); IAcmePropertyValue copyVal = copyProp.getValue(); assertNotNull(copyVal); assertEquals(val2, origValue); assertEquals(val1, copyVal); }
@Override public IModelInstance<IAcmeSystem> copyInternalModel() throws RainbowCopyException { synchronized (copyLock) { return internalModel.copyModelInstance("Acme"); } }
AcmeRuntimeAggregator implements IRuntimeAggregator<IAcmeSystem> { @Override public IModelInstance<IAcmeSystem> copyInternalModel() throws RainbowCopyException { synchronized (copyLock) { return internalModel.copyModelInstance("Acme"); } } }
AcmeRuntimeAggregator implements IRuntimeAggregator<IAcmeSystem> { @Override public IModelInstance<IAcmeSystem> copyInternalModel() throws RainbowCopyException { synchronized (copyLock) { return internalModel.copyModelInstance("Acme"); } } AcmeRuntimeAggregator(ISystemConfiguration config);  AcmeRuntimeAggregator(ISystemConfiguration config,
            IDatabaseConnector dbConn); }
AcmeRuntimeAggregator implements IRuntimeAggregator<IAcmeSystem> { @Override public IModelInstance<IAcmeSystem> copyInternalModel() throws RainbowCopyException { synchronized (copyLock) { return internalModel.copyModelInstance("Acme"); } } AcmeRuntimeAggregator(ISystemConfiguration config);  AcmeRuntimeAggregator(ISystemConfiguration config,
            IDatabaseConnector dbConn); @Override void start(); @Override void stop(); @Override IModelInstance<IAcmeSystem> getInternalModel(); @Override IModelInstance<IAcmeSystem> copyInternalModel(); @Override IEventBuffer getEventBuffer(); @Override synchronized void processEvent(String channel, IRainbowMessage event); }
AcmeRuntimeAggregator implements IRuntimeAggregator<IAcmeSystem> { @Override public IModelInstance<IAcmeSystem> copyInternalModel() throws RainbowCopyException { synchronized (copyLock) { return internalModel.copyModelInstance("Acme"); } } AcmeRuntimeAggregator(ISystemConfiguration config);  AcmeRuntimeAggregator(ISystemConfiguration config,
            IDatabaseConnector dbConn); @Override void start(); @Override void stop(); @Override IModelInstance<IAcmeSystem> getInternalModel(); @Override IModelInstance<IAcmeSystem> copyInternalModel(); @Override IEventBuffer getEventBuffer(); @Override synchronized void processEvent(String channel, IRainbowMessage event);  }