@Test public void testDupeNamedClusterNullNc() { hadoopClusterDelegate.dupeNamedCluster( metaStore, null, shell ); verifyNoMoreInteractions( metaStore, shell ); }
public void dupeNamedCluster( IMetaStore metaStore, NamedCluster nc, Shell shell ) { if ( metaStore == null ) { metaStore = spoon.getMetaStore(); } if ( nc == null ) { return; } NamedCluster newNamedCluster = nc.clone(); String duplicateName = BaseMessages.getString( Spoon.class, SPOON_VARIOUS_DUPE_NAME ) + nc.getName(); newNamedCluster.setName( duplicateName ); NamedClusterDialogImpl namedClusterDialogImpl = commonDialogFactory .createNamedClusterDialog( shell, namedClusterService, runtimeTestActionService, runtimeTester, newNamedCluster ); namedClusterDialogImpl.setNewClusterCheck( true ); String newClusterName = namedClusterDialogImpl.open(); if ( newClusterName == null ) { return; } try { XmlMetaStore xmlMetaStore = getXmlMetastore( metaStore ); if ( xmlMetaStore != null ) { if ( newNamedCluster.getName() != null ) { delNamedCluster( metaStore, newNamedCluster ); } File sourceClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + nc.getName() ); File newClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + newClusterName ); saveNamedCluster( metaStore, newNamedCluster ); FileUtils.copyDirectory( sourceClusterConfigDir, newClusterConfigDir ); if ( !nc.getShimIdentifier().equals( newNamedCluster.getShimIdentifier() ) ) { addConfigProperties( newNamedCluster ); } } } catch ( Exception e ) { commonDialogFactory.createErrorDialog( spoon.getShell(), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_TITLE ), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_MESSAGE, nc.getName() ), e ); spoon.refreshTree(); return; } spoon.refreshTree( STRING_NAMED_CLUSTERS ); }
HadoopClusterDelegateImpl extends SpoonDelegate { public void dupeNamedCluster( IMetaStore metaStore, NamedCluster nc, Shell shell ) { if ( metaStore == null ) { metaStore = spoon.getMetaStore(); } if ( nc == null ) { return; } NamedCluster newNamedCluster = nc.clone(); String duplicateName = BaseMessages.getString( Spoon.class, SPOON_VARIOUS_DUPE_NAME ) + nc.getName(); newNamedCluster.setName( duplicateName ); NamedClusterDialogImpl namedClusterDialogImpl = commonDialogFactory .createNamedClusterDialog( shell, namedClusterService, runtimeTestActionService, runtimeTester, newNamedCluster ); namedClusterDialogImpl.setNewClusterCheck( true ); String newClusterName = namedClusterDialogImpl.open(); if ( newClusterName == null ) { return; } try { XmlMetaStore xmlMetaStore = getXmlMetastore( metaStore ); if ( xmlMetaStore != null ) { if ( newNamedCluster.getName() != null ) { delNamedCluster( metaStore, newNamedCluster ); } File sourceClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + nc.getName() ); File newClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + newClusterName ); saveNamedCluster( metaStore, newNamedCluster ); FileUtils.copyDirectory( sourceClusterConfigDir, newClusterConfigDir ); if ( !nc.getShimIdentifier().equals( newNamedCluster.getShimIdentifier() ) ) { addConfigProperties( newNamedCluster ); } } } catch ( Exception e ) { commonDialogFactory.createErrorDialog( spoon.getShell(), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_TITLE ), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_MESSAGE, nc.getName() ), e ); spoon.refreshTree(); return; } spoon.refreshTree( STRING_NAMED_CLUSTERS ); } }
HadoopClusterDelegateImpl extends SpoonDelegate { public void dupeNamedCluster( IMetaStore metaStore, NamedCluster nc, Shell shell ) { if ( metaStore == null ) { metaStore = spoon.getMetaStore(); } if ( nc == null ) { return; } NamedCluster newNamedCluster = nc.clone(); String duplicateName = BaseMessages.getString( Spoon.class, SPOON_VARIOUS_DUPE_NAME ) + nc.getName(); newNamedCluster.setName( duplicateName ); NamedClusterDialogImpl namedClusterDialogImpl = commonDialogFactory .createNamedClusterDialog( shell, namedClusterService, runtimeTestActionService, runtimeTester, newNamedCluster ); namedClusterDialogImpl.setNewClusterCheck( true ); String newClusterName = namedClusterDialogImpl.open(); if ( newClusterName == null ) { return; } try { XmlMetaStore xmlMetaStore = getXmlMetastore( metaStore ); if ( xmlMetaStore != null ) { if ( newNamedCluster.getName() != null ) { delNamedCluster( metaStore, newNamedCluster ); } File sourceClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + nc.getName() ); File newClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + newClusterName ); saveNamedCluster( metaStore, newNamedCluster ); FileUtils.copyDirectory( sourceClusterConfigDir, newClusterConfigDir ); if ( !nc.getShimIdentifier().equals( newNamedCluster.getShimIdentifier() ) ) { addConfigProperties( newNamedCluster ); } } } catch ( Exception e ) { commonDialogFactory.createErrorDialog( spoon.getShell(), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_TITLE ), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_MESSAGE, nc.getName() ), e ); spoon.refreshTree(); return; } spoon.refreshTree( STRING_NAMED_CLUSTERS ); } HadoopClusterDelegateImpl( Spoon spoon, NamedClusterService namedClusterService,
                                    RuntimeTestActionService runtimeTestActionService, RuntimeTester runtimeTester );  HadoopClusterDelegateImpl( Spoon spoon, NamedClusterService namedClusterService,
                                    RuntimeTestActionService runtimeTestActionService, RuntimeTester runtimeTester,
                                    CommonDialogFactory commonDialogFactory ); }
HadoopClusterDelegateImpl extends SpoonDelegate { public void dupeNamedCluster( IMetaStore metaStore, NamedCluster nc, Shell shell ) { if ( metaStore == null ) { metaStore = spoon.getMetaStore(); } if ( nc == null ) { return; } NamedCluster newNamedCluster = nc.clone(); String duplicateName = BaseMessages.getString( Spoon.class, SPOON_VARIOUS_DUPE_NAME ) + nc.getName(); newNamedCluster.setName( duplicateName ); NamedClusterDialogImpl namedClusterDialogImpl = commonDialogFactory .createNamedClusterDialog( shell, namedClusterService, runtimeTestActionService, runtimeTester, newNamedCluster ); namedClusterDialogImpl.setNewClusterCheck( true ); String newClusterName = namedClusterDialogImpl.open(); if ( newClusterName == null ) { return; } try { XmlMetaStore xmlMetaStore = getXmlMetastore( metaStore ); if ( xmlMetaStore != null ) { if ( newNamedCluster.getName() != null ) { delNamedCluster( metaStore, newNamedCluster ); } File sourceClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + nc.getName() ); File newClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + newClusterName ); saveNamedCluster( metaStore, newNamedCluster ); FileUtils.copyDirectory( sourceClusterConfigDir, newClusterConfigDir ); if ( !nc.getShimIdentifier().equals( newNamedCluster.getShimIdentifier() ) ) { addConfigProperties( newNamedCluster ); } } } catch ( Exception e ) { commonDialogFactory.createErrorDialog( spoon.getShell(), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_TITLE ), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_MESSAGE, nc.getName() ), e ); spoon.refreshTree(); return; } spoon.refreshTree( STRING_NAMED_CLUSTERS ); } HadoopClusterDelegateImpl( Spoon spoon, NamedClusterService namedClusterService,
                                    RuntimeTestActionService runtimeTestActionService, RuntimeTester runtimeTester );  HadoopClusterDelegateImpl( Spoon spoon, NamedClusterService namedClusterService,
                                    RuntimeTestActionService runtimeTestActionService, RuntimeTester runtimeTester,
                                    CommonDialogFactory commonDialogFactory ); void dupeNamedCluster( IMetaStore metaStore, NamedCluster nc, Shell shell ); void delNamedCluster( IMetaStore metaStore, NamedCluster namedCluster ); String editNamedCluster( IMetaStore metaStore, NamedCluster namedCluster, Shell shell ); String newNamedCluster( VariableSpace variableSpace, IMetaStore metaStore, Shell shell ); }
HadoopClusterDelegateImpl extends SpoonDelegate { public void dupeNamedCluster( IMetaStore metaStore, NamedCluster nc, Shell shell ) { if ( metaStore == null ) { metaStore = spoon.getMetaStore(); } if ( nc == null ) { return; } NamedCluster newNamedCluster = nc.clone(); String duplicateName = BaseMessages.getString( Spoon.class, SPOON_VARIOUS_DUPE_NAME ) + nc.getName(); newNamedCluster.setName( duplicateName ); NamedClusterDialogImpl namedClusterDialogImpl = commonDialogFactory .createNamedClusterDialog( shell, namedClusterService, runtimeTestActionService, runtimeTester, newNamedCluster ); namedClusterDialogImpl.setNewClusterCheck( true ); String newClusterName = namedClusterDialogImpl.open(); if ( newClusterName == null ) { return; } try { XmlMetaStore xmlMetaStore = getXmlMetastore( metaStore ); if ( xmlMetaStore != null ) { if ( newNamedCluster.getName() != null ) { delNamedCluster( metaStore, newNamedCluster ); } File sourceClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + nc.getName() ); File newClusterConfigDir = new File( getNamedClusterConfigsRootDir( xmlMetaStore ) + "/" + newClusterName ); saveNamedCluster( metaStore, newNamedCluster ); FileUtils.copyDirectory( sourceClusterConfigDir, newClusterConfigDir ); if ( !nc.getShimIdentifier().equals( newNamedCluster.getShimIdentifier() ) ) { addConfigProperties( newNamedCluster ); } } } catch ( Exception e ) { commonDialogFactory.createErrorDialog( spoon.getShell(), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_TITLE ), BaseMessages.getString( PKG, SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_MESSAGE, nc.getName() ), e ); spoon.refreshTree(); return; } spoon.refreshTree( STRING_NAMED_CLUSTERS ); } HadoopClusterDelegateImpl( Spoon spoon, NamedClusterService namedClusterService,
                                    RuntimeTestActionService runtimeTestActionService, RuntimeTester runtimeTester );  HadoopClusterDelegateImpl( Spoon spoon, NamedClusterService namedClusterService,
                                    RuntimeTestActionService runtimeTestActionService, RuntimeTester runtimeTester,
                                    CommonDialogFactory commonDialogFactory ); void dupeNamedCluster( IMetaStore metaStore, NamedCluster nc, Shell shell ); void delNamedCluster( IMetaStore metaStore, NamedCluster namedCluster ); String editNamedCluster( IMetaStore metaStore, NamedCluster namedCluster, Shell shell ); String newNamedCluster( VariableSpace variableSpace, IMetaStore metaStore, Shell shell ); static final String SPOON_DIALOG_ERROR_DELETING_NAMED_CLUSTER_TITLE; static final String SPOON_DIALOG_ERROR_DELETING_NAMED_CLUSTER_MESSAGE; static final String SPOON_VARIOUS_DUPE_NAME; static final String SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_TITLE; static final String SPOON_DIALOG_ERROR_SAVING_NAMED_CLUSTER_MESSAGE; static Class<?> PKG; static final String STRING_NAMED_CLUSTERS; static final String SPOON_DIALOG_ERROR_ADDING_NEW_CONFIGURATION_FOR_CLUSTER_TITLE; static final String SPOON_DIALOG_ERROR_ADDING_NEW_CONFIGURATION_FOR_CLUSTER_MESSAGE; static final String SPOON_DIALOG_ERROR_RENAMING_PREVIOUS_CLUSTER_CONFIG_TITLE; static final String SPOON_DIALOG_ERROR_RENAMING_PREVIOUS_CLUSTER_CONFIG_MESSAGE; }