@Test public void testReplaceMeta() { NamedCluster namedCluster = mock( NamedCluster.class ); when( namedCluster.getName() ).thenReturn( namedClusterName ); when( namedCluster.getStorageScheme() ).thenReturn( storageScheme ); when( namedCluster.getHdfsHost() ).thenReturn( hdfsHost ); when( namedCluster.getHdfsPort() ).thenReturn( hdfsPort ); when( namedCluster.getHdfsUsername() ).thenReturn( hdfsUsername ); when( namedCluster.getHdfsPassword() ).thenReturn( hdfsPassword ); when( namedCluster.getJobTrackerHost() ).thenReturn( jobTrackerHost ); when( namedCluster.getJobTrackerPort() ).thenReturn( jobTrackerPort ); when( namedCluster.getZooKeeperHost() ).thenReturn( zookeeperHost ); when( namedCluster.getZooKeeperPort() ).thenReturn( zookeeperPort ); when( namedCluster.getOozieUrl() ).thenReturn( oozieUrl ); when( namedCluster.getKafkaBootstrapServers() ).thenReturn( kafkaBootstrapServers ); when( namedCluster.isMapr() ).thenReturn( isMapr ); long before = System.currentTimeMillis(); namedClusterBridge.replaceMeta( namedCluster ); long after = System.currentTimeMillis(); verify( legacyNamedCluster ).setName( namedClusterName ); verify( legacyNamedCluster ).setStorageScheme( storageScheme ); verify( legacyNamedCluster ).setHdfsHost( hdfsHost ); verify( legacyNamedCluster ).setHdfsPort( hdfsPort ); verify( legacyNamedCluster ).setHdfsUsername( hdfsUsername ); verify( legacyNamedCluster ).setHdfsPassword( hdfsPassword ); verify( legacyNamedCluster ).setJobTrackerHost( jobTrackerHost ); verify( legacyNamedCluster ).setJobTrackerPort( jobTrackerPort ); verify( legacyNamedCluster ).setZooKeeperHost( zookeeperHost ); verify( legacyNamedCluster ).setZooKeeperPort( zookeeperPort ); verify( legacyNamedCluster ).setOozieUrl( oozieUrl ); verify( legacyNamedCluster ).setKafkaBootstrapServers( kafkaBootstrapServers ); ArgumentCaptor<Long> argumentCaptor = ArgumentCaptor.forClass( long.class ); verify( legacyNamedCluster ).setLastModifiedDate( argumentCaptor.capture() ); Long modified = argumentCaptor.getValue(); assertTrue( "Expected lastModified to be between start and end timestamps", modified >= before && modified <= after ); }
@Override public void replaceMeta( NamedCluster nc ) { delegate.setName( nc.getName() ); delegate.setShimIdentifier( nc.getShimIdentifier() ); delegate.setHdfsHost( nc.getHdfsHost() ); delegate.setHdfsPort( nc.getHdfsPort() ); delegate.setHdfsUsername( nc.getHdfsUsername() ); delegate.setHdfsPassword( nc.getHdfsPassword() ); delegate.setJobTrackerHost( nc.getJobTrackerHost() ); delegate.setJobTrackerPort( nc.getJobTrackerPort() ); delegate.setZooKeeperHost( nc.getZooKeeperHost() ); delegate.setZooKeeperPort( nc.getZooKeeperPort() ); delegate.setOozieUrl( nc.getOozieUrl() ); delegate.setStorageScheme( nc.getStorageScheme() ); delegate.setLastModifiedDate( System.currentTimeMillis() ); delegate.setGatewayUrl( nc.getGatewayUrl() ); delegate.setGatewayUsername( nc.getGatewayUsername() ); delegate.setGatewayPassword( nc.getGatewayPassword() ); delegate.setUseGateway( nc.isUseGateway() ); delegate.setKafkaBootstrapServers( nc.getKafkaBootstrapServers() ); for ( NamedClusterSiteFile ncsf : nc.getSiteFiles() ) { delegate.getSiteFiles().add( ncsf.copy() ); } }
NamedClusterBridgeImpl implements NamedCluster { @Override public void replaceMeta( NamedCluster nc ) { delegate.setName( nc.getName() ); delegate.setShimIdentifier( nc.getShimIdentifier() ); delegate.setHdfsHost( nc.getHdfsHost() ); delegate.setHdfsPort( nc.getHdfsPort() ); delegate.setHdfsUsername( nc.getHdfsUsername() ); delegate.setHdfsPassword( nc.getHdfsPassword() ); delegate.setJobTrackerHost( nc.getJobTrackerHost() ); delegate.setJobTrackerPort( nc.getJobTrackerPort() ); delegate.setZooKeeperHost( nc.getZooKeeperHost() ); delegate.setZooKeeperPort( nc.getZooKeeperPort() ); delegate.setOozieUrl( nc.getOozieUrl() ); delegate.setStorageScheme( nc.getStorageScheme() ); delegate.setLastModifiedDate( System.currentTimeMillis() ); delegate.setGatewayUrl( nc.getGatewayUrl() ); delegate.setGatewayUsername( nc.getGatewayUsername() ); delegate.setGatewayPassword( nc.getGatewayPassword() ); delegate.setUseGateway( nc.isUseGateway() ); delegate.setKafkaBootstrapServers( nc.getKafkaBootstrapServers() ); for ( NamedClusterSiteFile ncsf : nc.getSiteFiles() ) { delegate.getSiteFiles().add( ncsf.copy() ); } } }
NamedClusterBridgeImpl implements NamedCluster { @Override public void replaceMeta( NamedCluster nc ) { delegate.setName( nc.getName() ); delegate.setShimIdentifier( nc.getShimIdentifier() ); delegate.setHdfsHost( nc.getHdfsHost() ); delegate.setHdfsPort( nc.getHdfsPort() ); delegate.setHdfsUsername( nc.getHdfsUsername() ); delegate.setHdfsPassword( nc.getHdfsPassword() ); delegate.setJobTrackerHost( nc.getJobTrackerHost() ); delegate.setJobTrackerPort( nc.getJobTrackerPort() ); delegate.setZooKeeperHost( nc.getZooKeeperHost() ); delegate.setZooKeeperPort( nc.getZooKeeperPort() ); delegate.setOozieUrl( nc.getOozieUrl() ); delegate.setStorageScheme( nc.getStorageScheme() ); delegate.setLastModifiedDate( System.currentTimeMillis() ); delegate.setGatewayUrl( nc.getGatewayUrl() ); delegate.setGatewayUsername( nc.getGatewayUsername() ); delegate.setGatewayPassword( nc.getGatewayPassword() ); delegate.setUseGateway( nc.isUseGateway() ); delegate.setKafkaBootstrapServers( nc.getKafkaBootstrapServers() ); for ( NamedClusterSiteFile ncsf : nc.getSiteFiles() ) { delegate.getSiteFiles().add( ncsf.copy() ); } } NamedClusterBridgeImpl( org.pentaho.di.core.namedcluster.model.NamedCluster delegate ); @VisibleForTesting  NamedClusterBridgeImpl( org.pentaho.di.core.namedcluster.model.NamedCluster delegate, NamedClusterManager namedClusterManager ); }
NamedClusterBridgeImpl implements NamedCluster { @Override public void replaceMeta( NamedCluster nc ) { delegate.setName( nc.getName() ); delegate.setShimIdentifier( nc.getShimIdentifier() ); delegate.setHdfsHost( nc.getHdfsHost() ); delegate.setHdfsPort( nc.getHdfsPort() ); delegate.setHdfsUsername( nc.getHdfsUsername() ); delegate.setHdfsPassword( nc.getHdfsPassword() ); delegate.setJobTrackerHost( nc.getJobTrackerHost() ); delegate.setJobTrackerPort( nc.getJobTrackerPort() ); delegate.setZooKeeperHost( nc.getZooKeeperHost() ); delegate.setZooKeeperPort( nc.getZooKeeperPort() ); delegate.setOozieUrl( nc.getOozieUrl() ); delegate.setStorageScheme( nc.getStorageScheme() ); delegate.setLastModifiedDate( System.currentTimeMillis() ); delegate.setGatewayUrl( nc.getGatewayUrl() ); delegate.setGatewayUsername( nc.getGatewayUsername() ); delegate.setGatewayPassword( nc.getGatewayPassword() ); delegate.setUseGateway( nc.isUseGateway() ); delegate.setKafkaBootstrapServers( nc.getKafkaBootstrapServers() ); for ( NamedClusterSiteFile ncsf : nc.getSiteFiles() ) { delegate.getSiteFiles().add( ncsf.copy() ); } } NamedClusterBridgeImpl( org.pentaho.di.core.namedcluster.model.NamedCluster delegate ); @VisibleForTesting  NamedClusterBridgeImpl( org.pentaho.di.core.namedcluster.model.NamedCluster delegate, NamedClusterManager namedClusterManager ); static org.pentaho.di.core.namedcluster.model.NamedCluster fromOsgiNamedCluster( NamedCluster namedCluster ); @Override String getName(); @Override void setName( String name ); @Override void replaceMeta( NamedCluster nc ); String getStorageScheme(); void setStorageScheme( String storageScheme ); @Override String getHdfsHost(); @Override void setHdfsHost( String hdfsHost ); @Override String getHdfsPort(); @Override void setHdfsPort( String hdfsPort ); @Override String getHdfsUsername(); @Override void setHdfsUsername( String hdfsUsername ); @Override String getHdfsPassword(); @Override void setHdfsPassword( String hdfsPassword ); @Override String getJobTrackerHost(); @Override void setJobTrackerHost( String jobTrackerHost ); @Override String getJobTrackerPort(); @Override void setJobTrackerPort( String jobTrackerPort ); @Override String getZooKeeperHost(); @Override void setZooKeeperHost( String zooKeeperHost ); @Override String getZooKeeperPort(); @Override void setZooKeeperPort( String zooKeeperPort ); @Override String getOozieUrl(); @Override void setOozieUrl( String oozieUrl ); @Override long getLastModifiedDate(); @Override void setLastModifiedDate( long lastModifiedDate ); @Override boolean isMapr(); @Override void setMapr( boolean mapr ); @Override String getShimIdentifier(); @Override void setShimIdentifier( String shimIdentifier ); @Override NamedCluster clone(); @Override String processURLsubstitution( String incomingURL, IMetaStore metastore, VariableSpace variableSpace ); @Override void initializeVariablesFrom( VariableSpace variableSpace ); @Override void copyVariablesFrom( VariableSpace variableSpace ); @Override void shareVariablesWith( VariableSpace variableSpace ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace variableSpace ); @Override void setVariable( String s, String s1 ); @Override String getVariable( String s, String s1 ); @Override String getVariable( String s ); @Override boolean getBooleanValueOfVariable( String s, boolean b ); @Override String[] listVariables(); @Override String environmentSubstitute( String s ); @Override String[] environmentSubstitute( String[] strings ); @Override void injectVariables( Map<String, String> map ); @Override String fieldSubstitute( String s, RowMetaInterface rowMetaInterface, Object[] objects ); @Override String toString(); @Override String toXmlForEmbed( String rootTag ); @Override NamedCluster fromXmlForEmbed( Node node ); @Override String getGatewayUrl(); @Override void setGatewayUrl( String gatewayUrl ); @Override String getGatewayUsername(); @Override void setGatewayUsername( String gatewayUsername ); @Override String getGatewayPassword(); @Override void setGatewayPassword( String gatewayPassword ); @Override void setUseGateway( boolean selection ); @Override boolean isUseGateway(); @Override String getKafkaBootstrapServers(); @Override void setKafkaBootstrapServers( String kafkaBootstrapServers ); @Override String decodePassword( String password ); @Override String encodePassword( String password ); @Override List<NamedClusterSiteFile> getSiteFiles(); @Override void setSiteFiles( List<NamedClusterSiteFile> siteFiles ); @Override void addSiteFile( String fileName, String content ); @Override InputStream getSiteFileInputStream( String siteFileName ); }
NamedClusterBridgeImpl implements NamedCluster { @Override public void replaceMeta( NamedCluster nc ) { delegate.setName( nc.getName() ); delegate.setShimIdentifier( nc.getShimIdentifier() ); delegate.setHdfsHost( nc.getHdfsHost() ); delegate.setHdfsPort( nc.getHdfsPort() ); delegate.setHdfsUsername( nc.getHdfsUsername() ); delegate.setHdfsPassword( nc.getHdfsPassword() ); delegate.setJobTrackerHost( nc.getJobTrackerHost() ); delegate.setJobTrackerPort( nc.getJobTrackerPort() ); delegate.setZooKeeperHost( nc.getZooKeeperHost() ); delegate.setZooKeeperPort( nc.getZooKeeperPort() ); delegate.setOozieUrl( nc.getOozieUrl() ); delegate.setStorageScheme( nc.getStorageScheme() ); delegate.setLastModifiedDate( System.currentTimeMillis() ); delegate.setGatewayUrl( nc.getGatewayUrl() ); delegate.setGatewayUsername( nc.getGatewayUsername() ); delegate.setGatewayPassword( nc.getGatewayPassword() ); delegate.setUseGateway( nc.isUseGateway() ); delegate.setKafkaBootstrapServers( nc.getKafkaBootstrapServers() ); for ( NamedClusterSiteFile ncsf : nc.getSiteFiles() ) { delegate.getSiteFiles().add( ncsf.copy() ); } } NamedClusterBridgeImpl( org.pentaho.di.core.namedcluster.model.NamedCluster delegate ); @VisibleForTesting  NamedClusterBridgeImpl( org.pentaho.di.core.namedcluster.model.NamedCluster delegate, NamedClusterManager namedClusterManager ); static org.pentaho.di.core.namedcluster.model.NamedCluster fromOsgiNamedCluster( NamedCluster namedCluster ); @Override String getName(); @Override void setName( String name ); @Override void replaceMeta( NamedCluster nc ); String getStorageScheme(); void setStorageScheme( String storageScheme ); @Override String getHdfsHost(); @Override void setHdfsHost( String hdfsHost ); @Override String getHdfsPort(); @Override void setHdfsPort( String hdfsPort ); @Override String getHdfsUsername(); @Override void setHdfsUsername( String hdfsUsername ); @Override String getHdfsPassword(); @Override void setHdfsPassword( String hdfsPassword ); @Override String getJobTrackerHost(); @Override void setJobTrackerHost( String jobTrackerHost ); @Override String getJobTrackerPort(); @Override void setJobTrackerPort( String jobTrackerPort ); @Override String getZooKeeperHost(); @Override void setZooKeeperHost( String zooKeeperHost ); @Override String getZooKeeperPort(); @Override void setZooKeeperPort( String zooKeeperPort ); @Override String getOozieUrl(); @Override void setOozieUrl( String oozieUrl ); @Override long getLastModifiedDate(); @Override void setLastModifiedDate( long lastModifiedDate ); @Override boolean isMapr(); @Override void setMapr( boolean mapr ); @Override String getShimIdentifier(); @Override void setShimIdentifier( String shimIdentifier ); @Override NamedCluster clone(); @Override String processURLsubstitution( String incomingURL, IMetaStore metastore, VariableSpace variableSpace ); @Override void initializeVariablesFrom( VariableSpace variableSpace ); @Override void copyVariablesFrom( VariableSpace variableSpace ); @Override void shareVariablesWith( VariableSpace variableSpace ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace variableSpace ); @Override void setVariable( String s, String s1 ); @Override String getVariable( String s, String s1 ); @Override String getVariable( String s ); @Override boolean getBooleanValueOfVariable( String s, boolean b ); @Override String[] listVariables(); @Override String environmentSubstitute( String s ); @Override String[] environmentSubstitute( String[] strings ); @Override void injectVariables( Map<String, String> map ); @Override String fieldSubstitute( String s, RowMetaInterface rowMetaInterface, Object[] objects ); @Override String toString(); @Override String toXmlForEmbed( String rootTag ); @Override NamedCluster fromXmlForEmbed( Node node ); @Override String getGatewayUrl(); @Override void setGatewayUrl( String gatewayUrl ); @Override String getGatewayUsername(); @Override void setGatewayUsername( String gatewayUsername ); @Override String getGatewayPassword(); @Override void setGatewayPassword( String gatewayPassword ); @Override void setUseGateway( boolean selection ); @Override boolean isUseGateway(); @Override String getKafkaBootstrapServers(); @Override void setKafkaBootstrapServers( String kafkaBootstrapServers ); @Override String decodePassword( String password ); @Override String encodePassword( String password ); @Override List<NamedClusterSiteFile> getSiteFiles(); @Override void setSiteFiles( List<NamedClusterSiteFile> siteFiles ); @Override void addSiteFile( String fileName, String content ); @Override InputStream getSiteFileInputStream( String siteFileName );  }