public static SlaveServerTransStatus fromXML( String xml ) throws KettleException { Document document = XMLHandler.loadXMLString( xml ); SlaveServerTransStatus status = new SlaveServerTransStatus( XMLHandler.getSubNode( document, XML_TAG ) ); return status; }
public SlaveServerTransStatus getTransStatus( String transName, String carteObjectId, int startLogLineNr, boolean sendResultXmlWithStatus ) throws Exception { String query = GetTransStatusServlet.CONTEXT_PATH + "/?name=" + URLEncoder.encode( transName, "UTF-8" ) + "&id=" + Const.NVL( carteObjectId, "" ) + "&xml=Y&from=" + startLogLineNr; if ( sendResultXmlWithStatus ) { query = query + "&" + GetTransStatusServlet.SEND_RESULT + "=Y"; } String xml = execService( query, true ); return SlaveServerTransStatus.fromXML( xml ); }
public SlaveServerTransStatus findTransStatus( String transName, String id ) { for ( int i = 0; i < transStatusList.size(); i++ ) { SlaveServerTransStatus transStatus = transStatusList.get( i ); if ( transStatus.getTransName().equalsIgnoreCase( transName ) && ( Utils.isEmpty( id ) || transStatus.getId().equals( id ) ) ) { return transStatus; } } return null; }
new SlaveServerTransStatus( transName, entry.getId(), trans.getStatus() ); transStatus.setFirstLoggingLineNr( startLineNr ); transStatus.setLastLoggingLineNr( lastLineNr ); transStatus.setLogDate( trans.getLogDate() ); if ( ( baseStep.isRunning() ) || baseStep.getStatus() != StepExecutionStatus.STATUS_EMPTY ) { StepStatus stepStatus = new StepStatus( baseStep ); transStatus.getStepStatusList().add( stepStatus ); transStatus.setLoggingString( loggingString ); transStatus.setResult( trans.getResult() ); transStatus.setPaused( trans.isPaused() ); String xml = transStatus.getXML( sendResultXmlWithStatus ); data = xml.getBytes( Charset.forName( Const.XML_ENCODING ) ); out = response.getOutputStream(); out.write( data ); out.flush(); if ( finishedOrStopped && ( transStatus.isFinished() || transStatus.isStopped() ) && logId != null && !dontUseCache ) { cache.put( logId, xml, startLineNr );
try { if ( log.isDetailed() ) { log.logDetailed( "Getting transformation status for [{0}] on server [{1}]", transStatus.getTransName(), SpoonSlave.this.slaveServer ); transStatus.getTransName(), transStatus.getId(), 0 ); if ( log.isDetailed() ) { log.logDetailed( "Finished receiving transformation status for [{0}] from server [{1}]", transStatus .getTransName(), SpoonSlave.this.slaveServer ); List<StepStatus> stepStatusList = ts.getStepStatusList(); transStatus.setStepStatusList( stepStatusList ); String logging = ts.getLoggingString(); transStatus.setErrorDescription( "Unable to access transformation details : " + Const.CR + Const.getStackTracker( e ) );
@Test public void testWithDate() throws KettleException { String transName = "testWithDate"; String id = UUID.randomUUID().toString(); String status = Trans.STRING_FINISHED; Date logDate = new Date(); SlaveServerTransStatus ts = new SlaveServerTransStatus( transName, id, status ); ts.setLogDate( logDate ); String resultXML = ts.getXML(); Node newTransStatus = XMLHandler.getSubNode( XMLHandler.loadXMLString( resultXML ), SlaveServerTransStatus.XML_TAG ); assertEquals( "The XML document should match after rebuilding from XML", resultXML, SlaveServerTransStatus.fromXML( resultXML ).getXML() ); assertEquals( "There should be one \"log_date\" node in the XML", 1, XMLHandler.countNodes( newTransStatus, "log_date" ) ); assertEquals( "The \"log_date\" node should match the original value", XMLHandler.date2string( logDate ), XMLHandler.getTagValue( newTransStatus, "log_date" ) ); }
for ( SlaveServerTransStatus transStatus : transStatusList ) { TreeItem transItem = new TreeItem( transParentItem, SWT.NONE ); transItem.setText( 0, transStatus.getTransName() ); transItem.setText( 9, transStatus.getStatusDescription() ); transItem.setText( 13, Const.NVL( transStatus.getId(), "" ) ); transItem.setText( 14, Const.NVL( XMLHandler.date2string( transStatus.getLogDate() ), "" ) ); transItem.setImage( GUIResource.getInstance().getImageTransGraph() ); transItem.setData( "transStatus", transStatus );
@Test public void testGetXML() throws KettleException { SlaveServerTransStatus transStatus = new SlaveServerTransStatus(); RowMetaAndData rowMetaAndData = new RowMetaAndData(); String testData = "testData"; rowMetaAndData.addValue( new ValueMetaString(), testData ); List<RowMetaAndData> rows = new ArrayList<>(); rows.add( rowMetaAndData ); Result result = new Result(); result.setRows( rows ); transStatus.setResult( result ); //PDI-15781 Assert.assertFalse( transStatus.getXML().contains( testData ) ); //PDI-17061 Assert.assertTrue( transStatus.getXML( true ).contains( testData ) ); } }
@Test public void testNoDate() throws KettleException { String transName = "testNullDate"; String id = UUID.randomUUID().toString(); String status = Trans.STRING_FINISHED; SlaveServerTransStatus ts = new SlaveServerTransStatus( transName, id, status ); String resultXML = ts.getXML(); Node newTransStatus = XMLHandler.getSubNode( XMLHandler.loadXMLString( resultXML ), SlaveServerTransStatus.XML_TAG ); assertEquals( "The XML document should match after rebuilding from XML", resultXML, SlaveServerTransStatus.fromXML( resultXML ).getXML() ); assertEquals( "There should be one \"log_date\" node in the XML", 1, XMLHandler.countNodes( newTransStatus, "log_date" ) ); assertTrue( "The \"log_date\" node should have a null value", Utils.isEmpty( XMLHandler.getTagValue( newTransStatus, "log_date" ) ) ); }
String status = trans.getStatus(); SlaveServerTransStatus sstatus = new SlaveServerTransStatus( entry.getName(), entry.getId(), status ); sstatus.setLogDate( trans.getLogDate() ); sstatus.setPaused( trans.isPaused() ); serverStatus.getTransStatusList().add( sstatus );
try { transStatus = remoteSlaveServer.getTransStatus( transMeta.getName(), carteObjectId, 0 ); if ( !transStatus.isRunning() ) { Result remoteResult = transStatus.getResult(); result.clear(); result.add( remoteResult ); if ( transStatus == null || transStatus.isRunning() ) { remoteSlaveServer.stopTransformation( transMeta.getName(), transStatus.getId() ); remoteSlaveServer.cleanupTransformation( transMeta.getName(), transStatus.getId() );
protected void testXmlRoundTrip() throws KettleException { SlaveServerTransStatus metaToSave = createMeta(); Map<String, FieldLoadSaveValidator<?>> validatorMap = createValidatorMapAndInvokeSetters( xmlAttributes, metaToSave ); String xml = metaToSave.getXML(); SlaveServerTransStatus metaLoaded = SlaveServerTransStatus.fromXML( xml ); validateLoadedMeta( xmlAttributes, validatorMap, metaToSave, metaLoaded ); } }
SlaveServerTransStatus transStatus = slaveServers[ s ].getTransStatus( slaves[ s ].getName(), carteObjectId, 0 ); if ( transStatus.isRunning() ) { if ( log.isDetailed() ) { log.logDetailed( "Slave transformation on '" + slaveServers[ s ] + "' is still running." ); errors += transStatus.getNrStepErrors(); } catch ( Exception e ) { errors += 1; SlaveServerTransStatus transStatus = masterServer.getTransStatus( masterTransMeta.getName(), carteObjectId, 0 ); if ( transStatus.isRunning() ) { if ( log.isDetailed() ) { log.logDetailed( "Master transformation is still running." ); Result result = transStatus.getResult( transSplitter.getOriginalTransformation() ); errors += result.getNrErrors(); } catch ( Exception e ) {
public boolean isFinished() { return getStatusDescription().equalsIgnoreCase( Trans.STRING_FINISHED ) || getStatusDescription().equalsIgnoreCase( Trans.STRING_FINISHED_WITH_ERRORS ); }
try { SlaveServerTransStatus transStatus = remoteSlaveServer.getTransStatus( transName, carteObjectId, 0 ); if ( transStatus.isRunning() ) { if ( log.isDetailed() ) { log.logDetailed( transName, "Remote transformation is still running." ); Result result = transStatus.getResult(); errors += result.getNrErrors(); } catch ( Exception e ) {
Result transResult = transStatus.getResult( slaves[ s ] ); log.logBasic( transStatus.getLoggingString() ); Result transResult = transStatus.getResult( master ); log.logBasic( transStatus.getLoggingString() );
public String getXML() throws KettleException { // See PDI-15781 boolean sendResultXmlWithStatus = EnvUtil.getSystemProperty( "KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS", "N" ).equalsIgnoreCase( "Y" ); return getXML( sendResultXmlWithStatus ); }