@Test public void getDataStore() throws Exception { ViewEntity entity1 = getViewEntityMock(VERSION_1); ViewEntity entity2 = getViewEntityMock(VERSION_2); replay(entity1, entity2); ViewInstanceEntity instanceEntity1 = getViewInstanceEntityMock(entity1); ViewInstanceEntity instanceEntity2 = getViewInstanceEntityMock(entity2); replay(instanceEntity1, instanceEntity2); ViewDataMigrationContextImpl context = new TestViewDataMigrationContextImpl(instanceEntity1, instanceEntity2); Assert.assertNotSame(context.getCurrentDataStore(), context.getOriginDataStore()); }
protected DataStore getDataStore(ViewInstanceEntity instanceDefinition) { if (!dataStoreModules.containsKey(instanceDefinition)) { DataStoreModule module = new DataStoreModule(instanceDefinition,"ambari-view-migration"); dataStoreModules.put(instanceDefinition, module); } Injector injector = Guice.createInjector(dataStoreModules.get(instanceDefinition)); return injector.getInstance(DataStoreImpl.class); }
ViewDataMigrationContextImpl implements ViewDataMigrationContext { protected DataStore getDataStore(ViewInstanceEntity instanceDefinition) { if (!dataStoreModules.containsKey(instanceDefinition)) { DataStoreModule module = new DataStoreModule(instanceDefinition,"ambari-view-migration"); dataStoreModules.put(instanceDefinition, module); } Injector injector = Guice.createInjector(dataStoreModules.get(instanceDefinition)); return injector.getInstance(DataStoreImpl.class); } }
ViewDataMigrationContextImpl implements ViewDataMigrationContext { protected DataStore getDataStore(ViewInstanceEntity instanceDefinition) { if (!dataStoreModules.containsKey(instanceDefinition)) { DataStoreModule module = new DataStoreModule(instanceDefinition,"ambari-view-migration"); dataStoreModules.put(instanceDefinition, module); } Injector injector = Guice.createInjector(dataStoreModules.get(instanceDefinition)); return injector.getInstance(DataStoreImpl.class); } ViewDataMigrationContextImpl(ViewInstanceEntity originInstanceDefinition,
                                      ViewInstanceEntity currentInstanceDefinition); }
ViewDataMigrationContextImpl implements ViewDataMigrationContext { protected DataStore getDataStore(ViewInstanceEntity instanceDefinition) { if (!dataStoreModules.containsKey(instanceDefinition)) { DataStoreModule module = new DataStoreModule(instanceDefinition,"ambari-view-migration"); dataStoreModules.put(instanceDefinition, module); } Injector injector = Guice.createInjector(dataStoreModules.get(instanceDefinition)); return injector.getInstance(DataStoreImpl.class); } ViewDataMigrationContextImpl(ViewInstanceEntity originInstanceDefinition,
                                      ViewInstanceEntity currentInstanceDefinition); @Override int getCurrentDataVersion(); @Override int getOriginDataVersion(); @Override DataStore getOriginDataStore(); @Override DataStore getCurrentDataStore(); @Override @Transactional void putCurrentInstanceData(String user, String key, String value); @Override void copyAllObjects(Class originEntityClass, Class currentEntityClass); @Override @Transactional void copyAllObjects(Class originEntityClass, Class currentEntityClass, EntityConverter entityConverter); @Override void copyAllInstanceData(); @Override ViewInstanceEntity getOriginInstanceDefinition(); @Override Map<String, Class> getOriginEntityClasses(); @Override Map<String, Class> getCurrentEntityClasses(); @Override ViewInstanceEntity getCurrentInstanceDefinition(); @Override Map<String, Map<String, String>> getOriginInstanceDataByUser(); @Override @Transactional void putOriginInstanceData(String user, String key, String value); @Override Map<String, Map<String, String>> getCurrentInstanceDataByUser(); void closeMigration(); }
ViewDataMigrationContextImpl implements ViewDataMigrationContext { protected DataStore getDataStore(ViewInstanceEntity instanceDefinition) { if (!dataStoreModules.containsKey(instanceDefinition)) { DataStoreModule module = new DataStoreModule(instanceDefinition,"ambari-view-migration"); dataStoreModules.put(instanceDefinition, module); } Injector injector = Guice.createInjector(dataStoreModules.get(instanceDefinition)); return injector.getInstance(DataStoreImpl.class); } ViewDataMigrationContextImpl(ViewInstanceEntity originInstanceDefinition,
                                      ViewInstanceEntity currentInstanceDefinition); @Override int getCurrentDataVersion(); @Override int getOriginDataVersion(); @Override DataStore getOriginDataStore(); @Override DataStore getCurrentDataStore(); @Override @Transactional void putCurrentInstanceData(String user, String key, String value); @Override void copyAllObjects(Class originEntityClass, Class currentEntityClass); @Override @Transactional void copyAllObjects(Class originEntityClass, Class currentEntityClass, EntityConverter entityConverter); @Override void copyAllInstanceData(); @Override ViewInstanceEntity getOriginInstanceDefinition(); @Override Map<String, Class> getOriginEntityClasses(); @Override Map<String, Class> getCurrentEntityClasses(); @Override ViewInstanceEntity getCurrentInstanceDefinition(); @Override Map<String, Map<String, String>> getOriginInstanceDataByUser(); @Override @Transactional void putOriginInstanceData(String user, String key, String value); @Override Map<String, Map<String, String>> getCurrentInstanceDataByUser(); void closeMigration();  }