@Before public void before() { transformationMap = new TransformationMap(); }
@Test public void getHostServerSocketPorts() { transformationMap.allocateServerSocketPort( 1, TEST_HOST, CLUSTERED_RUN_ID, TEST_TRANSFORMATION_NAME, TEST_SOURCE_SLAVE_NAME, TEST_SOURCE_STEP_NAME, TEST_SOURCE_STEP_COPY, TEST_TARGET_SLAVE_NAME, TEST_TARGET_STEP_NAME, TEST_TARGET_STEP_COPY ); List<SocketPortAllocation> actualResult = transformationMap.getHostServerSocketPorts( TEST_HOST ); assertNotNull( actualResult ); assertEquals( 1, actualResult.size() ); }
@Override public Object call() throws Exception { transformationMap.deallocateServerSocketPorts( entry ); transformationMap.deallocateServerSocketPort( port, hostname ); return null; } }
entry = getTransformationMap().getFirstCarteObjectEntry( transName ); if ( entry == null ) { trans = null; } else { id = entry.getId(); trans = getTransformationMap().getTransformation( entry ); trans = getTransformationMap().getTransformation( entry );
entry = getTransformationMap().getFirstCarteObjectEntry( transName ); if ( entry == null ) { trans = null; } else { id = entry.getId(); trans = getTransformationMap().getTransformation( entry ); trans = getTransformationMap().getTransformation( entry ); getTransformationMap().deallocateServerSocketPorts( transName, id ); } catch ( Exception e ) { TransConfiguration transConfiguration = getTransformationMap().getConfiguration( entry ); if ( transConfiguration != null ) { TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration();
@Override public int compare( CarteObjectEntry o1, CarteObjectEntry o2 ) { Trans t1 = getTransformationMap().getTransformation( o1 ); Trans t2 = getTransformationMap().getTransformation( o2 ); Date d1 = t1.getLogDate(); Date d2 = t2.getLogDate(); // if both transformations have last log date, desc sort by log date if ( d1 != null && d2 != null ) { int logDateCompare = d2.compareTo( d1 ); if ( logDateCompare != 0 ) { return logDateCompare; } } return o1.compareTo( o2 ); } };
boolean error = false; getTransformationMap().deallocateServerSocketPorts( transName, id ); message = BaseMessages.getString( PKG, "TransStatusServlet.Log.TransServerSocketPortsReleased", transName ); entry = getTransformationMap().getFirstCarteObjectEntry( transName ); if ( entry == null ) { trans = null; } else { id = entry.getId(); trans = getTransformationMap().getTransformation( entry ); trans = getTransformationMap().getTransformation( entry );
List<CarteObjectEntry> transEntries = getTransformationMap().getTransformationObjects(); List<CarteObjectEntry> jobEntries = getJobMap().getJobObjects(); Trans trans = getTransformationMap().getTransformation( entry ); String status = trans.getStatus(); String name = transEntries.get( i ).getName(); String id = transEntries.get( i ).getId(); Trans trans = getTransformationMap().getTransformation( transEntries.get( i ) ); String status = trans.getStatus(); String trClass = evenRow ? "cellTableEvenRow" : "cellTableOddRow"; // alternating row color SlaveServerConfig serverConfig = getTransformationMap().getSlaveServerConfig(); if ( serverConfig != null ) { String maxLines = "";
entry = getTransformationMap().getFirstCarteObjectEntry( transName ); if ( entry == null ) { trans = null; } else { id = entry.getId(); trans = getTransformationMap().getTransformation( entry ); trans = getTransformationMap().getTransformation( entry ); TransConfiguration transConfiguration = getTransformationMap().getConfiguration( entry );
entry = getTransformationMap().getFirstCarteObjectEntry( transName ); if ( entry == null ) { trans = null; } else { id = entry.getId(); trans = getTransformationMap().getTransformation( entry ); trans = getTransformationMap().getTransformation( entry ); getTransformationMap().removeTransformation( entry );
when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING_TO_TEST ); when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter ); when( mockTransformationMap.getTransformation( any( CarteObjectEntry.class ) ) ).thenReturn( mockTrans ); when( mockTransformationMap.getConfiguration( any( CarteObjectEntry.class ) ) ).thenReturn( mockTransConf ); when( mockTransConf.getTransExecutionConfiguration() ).thenReturn( mockTransExecutionConf ); when( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
@GET @Path( "/configDetails" ) @Produces( { MediaType.APPLICATION_JSON } ) public List<NVPair> getConfigDetails() { SlaveServerConfig serverConfig = CarteSingleton.getInstance().getTransformationMap().getSlaveServerConfig(); List<NVPair> list = new ArrayList<NVPair>(); list.add( new NVPair( "maxLogLines", "" + serverConfig.getMaxLogLines() ) ); list.add( new NVPair( "maxLogLinesAge", "" + serverConfig.getMaxLogTimeoutMinutes() ) ); list.add( new NVPair( "maxObjectsAge", "" + serverConfig.getObjectTimeoutMinutes() ) ); list.add( new NVPair( "configFile", "" + serverConfig.getFilename() ) ); return list; }
for ( CarteObjectEntry entry : transformationMap.getTransformationObjects() ) { Trans trans = transformationMap.getTransformation( entry ); transformationMap.removeTransformation( entry );
final Repository repository = transformationMap.getSlaveServerConfig().getRepository(); final TransMeta transMeta = loadTrans( repository, transOption ); getTransformationMap().addTransformation( trans.getName(), carteObjectId, trans, transConfiguration );
@Override public SocketPortAllocation call() throws Exception { return transformationMap.allocateServerSocketPort( portRangeStart, hostname, clusteredRunId, transformationName, sourceSlaveName, sourceStepName, sourceStepCopy, targetSlaveName, targetStepName, targetStepCopy ); } }
SlaveSequence slaveSequence = getTransformationMap().getSlaveSequence( name ); if ( slaveSequence == null && getTransformationMap().isAutomaticSlaveSequenceCreationAllowed() ) { slaveSequence = getTransformationMap().createSlaveSequence( name );
transformationMap = new TransformationMap(); transformationMap.setSlaveServerConfig( config ); jobMap = new JobMap(); jobMap.setSlaveServerConfig( config );
@Test public void getHostServerSocketPortsWithoutAllocatedPorts() { List<SocketPortAllocation> actualResult = transformationMap.getHostServerSocketPorts( TEST_HOST ); assertNotNull( actualResult ); assertTrue( actualResult.isEmpty() ); }
@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 ); }
trans.setSocketRepository( getSocketRepository() ); getTransformationMap().addTransformation( transMeta.getName(), carteObjectId, trans, transConfiguration ); trans.setContainerObjectId( carteObjectId );