Search in sources :

Example 1 with PrefixPropertyGenerator

use of objectFaker.propertyGenerator.PrefixPropertyGenerator in project scheduling by ow2-proactive.

the class GetJobResultCommandTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    DataFaker<JobResultData> jobResultFaker = new DataFaker<JobResultData>(JobResultData.class);
    jobResultFaker.setGenerator("id.readableName", new PrefixPropertyGenerator("job", 1));
    jobResultFaker.setGenerator("allResults.key", new PrefixPropertyGenerator("task", 1));
    jobResultFaker.setGenerator("allResults.value.id.readableName", new PrefixPropertyGenerator("task", 1));
    jobResultFaker.setGenerator("allResults.value.serializedValue", new FixedPropertyGenerator(ObjectByteConverter.serializableToBase64String("Hello")));
    jobResult = jobResultFaker.fake();
    DataFaker<TaskResultData> taskResultsDataFaker = new DataFaker<TaskResultData>(TaskResultData.class);
    taskResultsDataFaker.setGenerator("id.readableName", new PrefixPropertyGenerator("task", 4));
    taskResultsDataFaker.setGenerator("serializedValue", new FixedPropertyGenerator(ObjectByteConverter.serializableToBase64String("Hello")));
    taskResults = taskResultsDataFaker.fakeList(3);
}
Also used : PrefixPropertyGenerator(objectFaker.propertyGenerator.PrefixPropertyGenerator) JobResultData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobResultData) DataFaker(objectFaker.DataFaker) TaskResultData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskResultData) FixedPropertyGenerator(objectFaker.propertyGenerator.FixedPropertyGenerator) Before(org.junit.Before)

Example 2 with PrefixPropertyGenerator

use of objectFaker.propertyGenerator.PrefixPropertyGenerator in project scheduling by ow2-proactive.

the class AbstractSchedulerCommandTest method setUp.

public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    jobIdFaker = new DataFaker<JobIdData>(JobIdData.class);
    jobIdFaker.setGenerator("readableName", new PrefixPropertyGenerator("job", 1));
    when(context.getRestClient()).thenReturn(restClient);
    when(restClient.getScheduler()).thenReturn(restApi);
    when(context.resultStack()).thenReturn(stack);
    capturedOutput = new ByteArrayOutputStream();
    userInput = new StringBuffer();
    ScriptEngineManager mgr = new ScriptEngineManager();
    engine = mgr.getEngineByExtension("js");
    when(context.getEngine()).thenReturn(engine);
    when(context.getProperty(eq(AbstractIModeCommand.TERMINATE), any(Class.class), anyBoolean())).thenReturn(false);
    // Mockito.when(ApplicationContextImpl.currentContext()).thenReturn(context);
    ApplicationContextImpl.mockCurrentContext(context.newApplicationContextHolder());
}
Also used : PrefixPropertyGenerator(objectFaker.propertyGenerator.PrefixPropertyGenerator) JobIdData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobIdData) ScriptEngineManager(javax.script.ScriptEngineManager) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 3 with PrefixPropertyGenerator

use of objectFaker.propertyGenerator.PrefixPropertyGenerator in project scheduling by ow2-proactive.

the class ListTaskStatesCommandTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    JobIdData jobId = jobIdFaker.fake();
    taskStateFaker = new DataFaker<TaskStateData>(TaskStateData.class);
    taskStateFaker.setGenerator("taskInfo.jobId", new FixedPropertyGenerator<JobIdData>(jobId));
    taskStateFaker.setGenerator("taskInfo.taskId.readableName", new PrefixPropertyGenerator("task", 1));
    taskStateFaker.setGenerator("name", new PrefixPropertyGenerator("task", 1));
    taskStateFaker.setGenerator("tag", new FixedPropertyGenerator("LOOP-T2-1"));
    this.taskData = this.taskStateFaker.fakeList(6);
    this.taskDataFiltered = new ArrayList<>();
    this.taskDataFiltered.add(this.taskData.get(0));
    this.taskDataFiltered.add(this.taskData.get(1));
    this.taskDataFiltered.add(this.taskData.get(2));
}
Also used : PrefixPropertyGenerator(objectFaker.propertyGenerator.PrefixPropertyGenerator) JobIdData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobIdData) TaskStateData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskStateData) FixedPropertyGenerator(objectFaker.propertyGenerator.FixedPropertyGenerator) Before(org.junit.Before)

Aggregations

PrefixPropertyGenerator (objectFaker.propertyGenerator.PrefixPropertyGenerator)3 FixedPropertyGenerator (objectFaker.propertyGenerator.FixedPropertyGenerator)2 Before (org.junit.Before)2 JobIdData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobIdData)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ScriptEngineManager (javax.script.ScriptEngineManager)1 DataFaker (objectFaker.DataFaker)1 JobResultData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobResultData)1 TaskResultData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskResultData)1 TaskStateData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskStateData)1