@Test public void testCopy() { TransExecutionConfiguration tec = new TransExecutionConfiguration(); tec.setPassedBatchId( null ); //CHECKSTYLE IGNORE AvoidNestedBlocks FOR NEXT 3 LINES { TransExecutionConfiguration tecCopy = (TransExecutionConfiguration) tec.clone(); assertEquals( "clone-copy", tec.getPassedBatchId(), tecCopy.getPassedBatchId() ); } tec.setPassedBatchId( 0L ); //CHECKSTYLE IGNORE AvoidNestedBlocks FOR NEXT 3 LINES { TransExecutionConfiguration tecCopy = (TransExecutionConfiguration) tec.clone(); assertEquals( "clone-copy", tec.getPassedBatchId(), tecCopy.getPassedBatchId() ); } tec.setPassedBatchId( 5L ); //CHECKSTYLE IGNORE AvoidNestedBlocks FOR NEXT 3 LINES { TransExecutionConfiguration tecCopy = (TransExecutionConfiguration) tec.clone(); assertEquals( "clone-copy", tec.getPassedBatchId(), tecCopy.getPassedBatchId() ); } }
protected Trans createTrans( TransConfiguration transConfiguration ) throws UnknownParamException { TransMeta transMeta = transConfiguration.getTransMeta(); TransExecutionConfiguration transExecutionConfiguration = transConfiguration.getTransExecutionConfiguration(); transMeta.setLogLevel( transExecutionConfiguration.getLogLevel() ); transMeta.injectVariables( transExecutionConfiguration.getVariables() ); copyParameters( transMeta, transExecutionConfiguration.getParams() ); getServletLogging( carteObjectId, transExecutionConfiguration.getLogLevel() ); trans.setMetaStore( transformationMap.getSlaveServerConfig().getMetaStore() ); if ( transExecutionConfiguration.isSetLogfile() ) { String realLogFilename = transExecutionConfiguration.getLogFileName(); try { FileUtil.createParentFolder( AddTransServlet.class, realLogFilename, transExecutionConfiguration .isCreateParentFolder(), trans.getLogChannel(), trans ); final LogChannelFileWriter logChannelFileWriter = new LogChannelFileWriter( servletLoggingObject.getLogChannelId(), KettleVFS.getFileObject( realLogFilename ), transExecutionConfiguration.isSetAppendLogfile() ); logChannelFileWriter.startLogging(); final Repository repository = transExecutionConfiguration.getRepository(); final Long passedBatchId = transExecutionConfiguration.getPassedBatchId(); if ( passedBatchId != null ) { trans.setPassedBatchId( passedBatchId );
@GET @Path( "/prepare/{id : .+}" ) @Produces( { MediaType.APPLICATION_JSON } ) public TransformationStatus prepareTransformation( @PathParam( "id" ) String id ) { Trans trans = CarteResource.getTransformation( id ); try { CarteObjectEntry entry = CarteResource.getCarteObjectEntry( id ); TransConfiguration transConfiguration = CarteSingleton.getInstance().getTransformationMap().getConfiguration( entry ); TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration(); // Set the appropriate logging, variables, arguments, replay date, ... // etc. trans.setArguments( executionConfiguration.getArgumentStrings() ); trans.setReplayDate( executionConfiguration.getReplayDate() ); trans.setSafeModeEnabled( executionConfiguration.isSafeModeEnabled() ); trans.setGatheringMetrics( executionConfiguration.isGatheringMetrics() ); trans.injectVariables( executionConfiguration.getVariables() ); trans.setPreviousResult( executionConfiguration.getPreviousResult() ); trans.prepareExecution( null ); } catch ( KettleException e ) { e.printStackTrace(); } return getTransformationStatus( id ); }
public void executeTransformation() { executeTransformation( getActiveTransformation(), true, false, false, false, false, transExecutionConfiguration.getReplayDate(), false, transExecutionConfiguration.getLogLevel() ); }
public TransConfiguration( Node configNode ) throws KettleException { Node trecNode = XMLHandler.getSubNode( configNode, TransExecutionConfiguration.XML_TAG ); transExecutionConfiguration = new TransExecutionConfiguration( trecNode ); Node transNode = XMLHandler.getSubNode( configNode, TransMeta.XML_TAG ); transMeta = new TransMeta( transNode, transExecutionConfiguration.getRepository() ); }
boolean doFallback = true; SlaveServer remoteSlaveServer = null; TransExecutionConfiguration executionConfiguration = new TransExecutionConfiguration(); if ( !Utils.isEmpty( runConfiguration ) ) { runConfiguration = environmentSubstitute( runConfiguration ); log.logBasic( BaseMessages.getString( PKG, "JobTrans.RunConfig.Message" ), runConfiguration ); executionConfiguration.setRunConfiguration( runConfiguration ); try { ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.SpoonTransBeforeStart.id, new Object[] { if ( !executionConfiguration.isExecutingLocally() && !executionConfiguration.isExecutingRemotely() && !executionConfiguration.isExecutingClustered() ) { result.setResult( true ); return result; clustering = executionConfiguration.isExecutingClustered(); remoteSlaveServer = executionConfiguration.getRemoteServer(); doFallback = false; } catch ( KettleException e ) { executionConfiguration.setClusterPosting( true ); executionConfiguration.setClusterPreparing( true ); executionConfiguration.setClusterStarting( true ); executionConfiguration.setClusterShowingTransformation( false ); executionConfiguration.setSafeModeEnabled( false ); executionConfiguration.setRepository( rep ); executionConfiguration.setLogLevel( transLogLevel ); executionConfiguration.setPreviousResult( previousResult ); executionConfiguration.setVariables( transMeta );
executionConfiguration.setExecutingLocally( true ); executionConfiguration.setExecutingRemotely( false ); executionConfiguration.setExecutingClustered( false ); executionConfiguration.setRepository( spoon.rep ); executionConfiguration.setSafeModeEnabled( safe ); debugAnswer = transDebugDialog.open(); if ( debugAnswer != TransDebugDialog.DEBUG_CANCEL ) { executionConfiguration.setExecutingLocally( true ); executionConfiguration.setExecutingRemotely( false ); executionConfiguration.setExecutingClustered( false ); } else { String[] fields = spoon.variables.getRowMeta().getFieldNames(); Map<String, String> variableMap = new HashMap<String, String>(); variableMap.putAll( executionConfiguration.getVariables() ); // the default for ( int idx = 0; idx < fields.length; idx++ ) { String value = executionConfiguration.getVariables().get( fields[idx] ); if ( Utils.isEmpty( value ) ) { value = data[idx].toString(); executionConfiguration.setVariables( variableMap ); executionConfiguration.getUsedVariables( transMeta ); executionConfiguration.getUsedArguments( transMeta, spoon.getArguments() ); executionConfiguration.setReplayDate( replayDate ); executionConfiguration.setLogLevel( logLevel );
DefaultLogLevel.setLogLevel( executionConfiguration.getLogLevel() ); transMeta.injectVariables( executionConfiguration.getVariables() ); Map<String, String> paramMap = executionConfiguration.getParams(); Set<String> keys = paramMap.keySet(); for ( String key : keys ) { if ( executionConfiguration.isClearingLog() ) { transLogDelegate.clearLog(); SimpleLoggingObject spoonLoggingObject = new SimpleLoggingObject( "SPOON", LoggingObjectType.SPOON, null ); spoonLoggingObject.setContainerObjectId( spoonLogObjectId ); spoonLoggingObject.setLogLevel( executionConfiguration.getLogLevel() ); trans.setParent( spoonLoggingObject ); trans.setLogLevel( executionConfiguration.getLogLevel() ); trans.setReplayDate( executionConfiguration.getReplayDate() ); trans.setRepository( executionConfiguration.getRepository() ); trans.setMonitored( true ); log.logBasic( BaseMessages.getString( PKG, "TransLog.Log.TransformationOpened" ) ); Map<String, String> arguments = executionConfiguration.getArguments(); final String[] args; if ( arguments != null ) { trans.setSafeModeEnabled( executionConfiguration.isSafeModeEnabled() ); trans.setGatheringMetrics( executionConfiguration.isGatheringMetrics() );
Repository repository, IMetaStore metaStore ) throws KettleException { String carteObjectId; SlaveServer slaveServer = executionConfiguration.getRemoteServer(); executionConfiguration.getVariables().putAll( vars ); slaveServer.injectVariables( executionConfiguration.getVariables() ); slaveServer.getLogChannel().setLogLevel( executionConfiguration.getLogLevel() ); if ( executionConfiguration.isPassingExport() ) { TransExecutionConfiguration clonedConfiguration = (TransExecutionConfiguration) executionConfiguration.clone(); clonedConfiguration.setRepository( null ); TopLevelResource topLevelResource = ResourceUtil.serializeResourceExportInterface( tempFile.getName().toString(), transMeta, transMeta, repository, metaStore, clonedConfiguration.getXML(), CONFIGURATION_IN_EXPORT_FILENAME );
@Test public void testConnectRepository() throws KettleException { TransExecutionConfiguration transExecConf = new TransExecutionConfiguration(); final RepositoriesMeta repositoriesMeta = mock( RepositoriesMeta.class ); final RepositoryMeta repositoryMeta = mock( RepositoryMeta.class ); transExecConf.setRepository( initialRepo ); transExecConf.connectRepository( repositoriesMeta, "notFound", "username", "password" ); assertEquals( "Repository Changed", initialRepo, transExecConf.getRepository() ); transExecConf.connectRepository( repositoriesMeta, mockRepo, "username", "" ); assertEquals( "Repository Changed", initialRepo, transExecConf.getRepository() ); transExecConf.connectRepository( repositoriesMeta, mockRepo, "username", "password" ); assertEquals( "Repository didn't change", repository, transExecConf.getRepository() ); assertTrue( "Repository not connected", connectionSuccess[0] );
jet.setFollowingAbortRemotely( wFollowingAbortRemotely.getSelection() ); TransExecutionConfiguration executionConfiguration = new TransExecutionConfiguration(); executionConfiguration.setRunConfiguration( jet.getRunConfiguration() ); try { ExtensionPointHandler.callExtensionPoint( jobEntry.getLogChannel(), KettleExtensionPoint.SpoonTransBeforeStart.id, jet.setClustering( executionConfiguration.isExecutingClustered() ); if ( executionConfiguration.getRemoteServer() != null ) { jet.setRemoteSlaveServerName( executionConfiguration.getRemoteServer().getName() ); jet.setLoggingRemoteWork( executionConfiguration.isLogRemoteExecutionLocally() );
this.lastTransDebugMeta = transDebugMeta; log.setLogLevel( executionConfiguration.getLogLevel() ); if ( log.isDetailed() ) { log.logDetailed( BaseMessages.getString( PKG, "TransLog.Log.DoPreview" ) ); Map<String, String> arguments = executionConfiguration.getArguments(); if ( arguments != null ) { args = convertArguments( arguments ); transMeta.injectVariables( executionConfiguration.getVariables() ); Map<String, String> paramMap = executionConfiguration.getParams(); Set<String> keys = paramMap.keySet(); for ( String key : keys ) { if ( executionConfiguration.isClearingLog() ) { transLogDelegate.clearLog(); trans.setSafeModeEnabled( executionConfiguration.isSafeModeEnabled() ); trans.setPreview( true ); trans.setGatheringMetrics( executionConfiguration.isGatheringMetrics() ); trans.setMetaStore( spoon.getMetaStore() ); trans.prepareExecution( args );
@Test public void testCopyXml() throws Exception { TransExecutionConfiguration tec = new TransExecutionConfiguration(); final Long passedBatchId0 = null; final long passedBatchId1 = 0L; final long passedBatchId2 = 5L; tec.setPassedBatchId( passedBatchId0 ); String xml = tec.getXML(); Document doc = XMLHandler.loadXMLString( xml ); Node node = XMLHandler.getSubNode( doc, TransExecutionConfiguration.XML_TAG ); TransExecutionConfiguration tecCopy = new TransExecutionConfiguration( node ); assertEquals( "xml-copy", tec.getPassedBatchId(), tecCopy.getPassedBatchId() ); tec.setPassedBatchId( passedBatchId1 ); String xml = tec.getXML(); Document doc = XMLHandler.loadXMLString( xml ); Node node = XMLHandler.getSubNode( doc, TransExecutionConfiguration.XML_TAG ); TransExecutionConfiguration tecCopy = new TransExecutionConfiguration( node ); assertEquals( "xml-copy", tec.getPassedBatchId(), tecCopy.getPassedBatchId() ); tec.setPassedBatchId( passedBatchId2 ); String xml = tec.getXML(); Document doc = XMLHandler.loadXMLString( xml ); Node node = XMLHandler.getSubNode( doc, TransExecutionConfiguration.XML_TAG ); TransExecutionConfiguration tecCopy = new TransExecutionConfiguration( node ); assertEquals( "xml-copy", tec.getPassedBatchId(), tecCopy.getPassedBatchId() );
TransExecutionConfiguration transExecutionConfiguration = transConfiguration.getTransExecutionConfiguration(); transMeta.setLogLevel( transExecutionConfiguration.getLogLevel() ); LogChannelInterface log = CarteSingleton.getInstance().getLog(); if ( log.isDetailed() ) { log.logDetailed( "Logging level set to " + log.getLogLevel().getDescription() ); transMeta.injectVariables( transExecutionConfiguration.getVariables() ); Map<String, String> params = transExecutionConfiguration.getParams(); for ( String param : params.keySet() ) { String value = params.get( param ); final Repository repository = transConfiguration.getTransExecutionConfiguration().getRepository(); new SimpleLoggingObject( getClass().getName(), LoggingObjectType.CARTE, null ); servletLoggingObject.setContainerObjectId( carteObjectId ); servletLoggingObject.setLogLevel( executionConfiguration.getLogLevel() );
TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration(); LogLevel logLevel = LogLevel.getLogLevelForCode( levelOption ); transExecutionConfiguration.setLogLevel( logLevel ); TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration ); trans.injectVariables( transConfiguration.getTransExecutionConfiguration().getVariables() );
@Test public void testDefaultPassedBatchId() { TransExecutionConfiguration tec = new TransExecutionConfiguration(); assertEquals( "default passedBatchId value must be null", null, tec.getPassedBatchId() ); }
if ( masterSteps.size() > 0 ) { // If there is something that needs to be done on the master... masterServer = transSplitter.getMasterServer(); if ( executionConfiguration.isClusterPosting() ) { TransConfiguration transConfiguration = new TransConfiguration( master, executionConfiguration ); Map<String, String> variables = transConfiguration.getTransExecutionConfiguration().getVariables(); variables.put( Const.INTERNAL_VARIABLE_CLUSTER_SIZE, Integer.toString( slaves.length ) ); variables.put( Const.INTERNAL_VARIABLE_CLUSTER_MASTER, "Y" ); Map<String, String> params = transConfiguration.getTransExecutionConfiguration().getParams(); TransMeta ot = transSplitter.getOriginalTransformation(); for ( String param : ot.listParameters() ) { if ( executionConfiguration.isClusterPosting() ) { Runnable runnable = new Runnable() { @Override if ( executionConfiguration.isClusterPosting() ) { if ( executionConfiguration.isClusterPreparing() ) { if ( executionConfiguration.isClusterStarting() ) {
Document configDoc = XMLHandler.loadXMLFile( configUrl ); TransExecutionConfiguration executionConfiguration = new TransExecutionConfiguration( XMLHandler.getSubNode( configDoc, TransExecutionConfiguration.XML_TAG ) ); servletLoggingObject.setLogLevel( executionConfiguration.getLogLevel() );
delegationListener.transformationDelegationStarted( executorTrans, new TransExecutionConfiguration() );
TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration(); LogLevel logLevel = LogLevel.getLogLevelForCode( levelOption ); transExecutionConfiguration.setLogLevel( logLevel ); TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration );