Search in sources :

Example 6 with Project

use of io.elastest.etm.model.Project in project elastest-torm by elastest.

the class ModelsTest method executionTest.

@Test
public void executionTest() {
    Project project = new Project(3l, "name", new ArrayList<TJob>(), new ArrayList<SutSpecification>());
    SutSpecification sut = new SutSpecification(34l, "name", "specification", "description", project, new ArrayList<>(), SutTypeEnum.REPOSITORY, false, null, InstrumentedByEnum.WITHOUT, null, ManagedDockerType.IMAGE, CommandsOptionEnum.DEFAULT);
    TJob tjob = new TJob(34l, "name", "imageName", sut, project, false, "execDashboardConfig", null);
    List<Parameter> params = new ArrayList<>();
    params.add(new Parameter(45l, "param1", "value1", tjob, null));
    tjob.setParameters(params);
    TJobExecution exec = new TJobExecution(45l, 34543534l, ResultEnum.SUCCESS);
    List<Parameter> paramsExec = new ArrayList<>();
    paramsExec.add(new Parameter(45l, "param1", "value1", tjob, exec));
    exec.setParameters(paramsExec);
    TJobExecution exec2 = new TJobExecution(45l, 34543534l, ResultEnum.SUCCESS);
    List<Parameter> paramsExec2 = new ArrayList<>();
    paramsExec2.add(new Parameter(45l, "param1", "value1", tjob, exec2));
    exec2.setParameters(paramsExec2);
    exec.setTjob(tjob);
    exec2.setTjob(tjob);
    SutExecution sutExec = new SutExecution(45l, sut, "ssss", DeployStatusEnum.DEPLOYED);
    SutExecution sutExec2 = new SutExecution(45l, sut, "ssss", DeployStatusEnum.DEPLOYED);
    exec.setSutExecution(sutExec);
    exec2.setSutExecution(sutExec2);
    assertEquals(exec, exec2);
    assertEquals(exec.hashCode(), exec2.hashCode());
}
Also used : Project(io.elastest.etm.model.Project) TJobExecution(io.elastest.etm.model.TJobExecution) SutExecution(io.elastest.etm.model.SutExecution) ArrayList(java.util.ArrayList) Parameter(io.elastest.etm.model.Parameter) SutSpecification(io.elastest.etm.model.SutSpecification) TJob(io.elastest.etm.model.TJob) Test(org.junit.jupiter.api.Test)

Example 7 with Project

use of io.elastest.etm.model.Project in project elastest-torm by elastest.

the class ProjectService method deleteProject.

public void deleteProject(Long projectId) {
    Project project = projectRepository.findOne(projectId);
    projectRepository.delete(project);
}
Also used : Project(io.elastest.etm.model.Project)

Example 8 with Project

use of io.elastest.etm.model.Project in project elastest-torm by elastest.

the class HelloWorldLoader method createHelloWorldProject.

@PostConstruct
public void createHelloWorldProject() {
    if (projectService.getProjectByName(PROJECT_NAME) == null) {
        // Create Hello World Project
        Project project = new Project();
        project.setName(PROJECT_NAME);
        project = projectService.createProject(project);
        // Create Hello World TJob associated with the Hellow project
        TJob tJob = new TJob();
        tJob.setProject(project);
        tJob.setName(TJOB_NAME);
        tJob.setResultsPath(TEST_RESULTS_PATH);
        tJob.setImageName(BASE_IMAGE);
        tJob.setCommands(TJOB_COMMANDS);
        tJob.setExecDashboardConfigPath(EXEC_DASHBOARD_CONFIG);
        tJobService.createTJob(tJob);
    }
}
Also used : Project(io.elastest.etm.model.Project) TJob(io.elastest.etm.model.TJob) PostConstruct(javax.annotation.PostConstruct)

Example 9 with Project

use of io.elastest.etm.model.Project in project elastest-torm by elastest.

the class ModelsTest method tTobTest.

@Test
public void tTobTest() {
    Project project = new Project(3l, "name", new ArrayList<TJob>(), new ArrayList<SutSpecification>());
    Project project2 = new Project(3l, "name", new ArrayList<TJob>(), new ArrayList<SutSpecification>());
    SutSpecification sut = new SutSpecification(34l, "name", "specification", "description", project, new ArrayList<>(), SutTypeEnum.REPOSITORY, false, null, InstrumentedByEnum.WITHOUT, null, ManagedDockerType.IMAGE, CommandsOptionEnum.DEFAULT);
    SutSpecification sut2 = new SutSpecification(34l, "name", "specification", "description", project2, new ArrayList<>(), SutTypeEnum.REPOSITORY, false, null, InstrumentedByEnum.WITHOUT, null, ManagedDockerType.IMAGE, CommandsOptionEnum.DEFAULT);
    TJob tjob = new TJob(34l, "name", "imageName", sut, project, false, "execDashboardConfig", null);
    TJob tjob2 = new TJob(34l, "name", "imageName", sut2, project2, false, "execDashboardConfig", null);
    assertEquals(tjob, tjob2);
    assertEquals(tjob.hashCode(), tjob2.hashCode());
}
Also used : Project(io.elastest.etm.model.Project) SutSpecification(io.elastest.etm.model.SutSpecification) TJob(io.elastest.etm.model.TJob) Test(org.junit.jupiter.api.Test)

Example 10 with Project

use of io.elastest.etm.model.Project in project elastest-torm by elastest.

the class ElastestConfigTest method tJob.

@Bean
TJob tJob() {
    TJob tJob = new TJob();
    tJob.setId(0L);
    tJob.setImageName("elastest/test-etm-test1");
    tJob.setName("SimpleTest");
    tJob.setResultsPath("/app1TestJobsJenkins/target/surefire-reports/");
    Project project = new Project();
    project.setId(1L);
    project.setName("TestProject1");
    tJob.setProject(project);
    return tJob;
}
Also used : Project(io.elastest.etm.model.Project) TJob(io.elastest.etm.model.TJob) Bean(org.springframework.context.annotation.Bean)

Aggregations

Project (io.elastest.etm.model.Project)12 Test (org.junit.jupiter.api.Test)6 TJob (io.elastest.etm.model.TJob)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 HashMap (java.util.HashMap)3 HttpEntity (org.springframework.http.HttpEntity)3 HttpHeaders (org.springframework.http.HttpHeaders)3 SutSpecification (io.elastest.etm.model.SutSpecification)2 TestSupportServices (io.elastest.etm.api.model.TestSupportServices)1 Parameter (io.elastest.etm.model.Parameter)1 SutExecution (io.elastest.etm.model.SutExecution)1 TJobExecution (io.elastest.etm.model.TJobExecution)1 ExternalProject (io.elastest.etm.model.external.ExternalProject)1 ExternalTJob (io.elastest.etm.model.external.ExternalTJob)1 ArrayList (java.util.ArrayList)1 PostConstruct (javax.annotation.PostConstruct)1 HTTPException (javax.xml.ws.http.HTTPException)1 Bean (org.springframework.context.annotation.Bean)1