/** * The method provides the functionality to convert an instance (parent) to an instance of a subclass to the * provided parent. * @param parent The parent that will be converted into a subtype of the provided parent * @return A new instance of the parent, but as a subtype of the parent */ @Override public RestProject convertType(Project parent) { return new RestProject(parent); }
private RestProject createRestProject(String name) { RestProject restProject = new RestProject(); restProject.setName(name); return restProject; } }
public static RestProject generateRestProject(){ final RestProject project = new RestProject(); project.setId("REST PROJECT"); project.setName("Project name"); project.setDescription("Project description"); project.setCreated(new Date()); project.setUpdated(new Date()); project.setApplications(new ArrayList<RestApplication>()); return project; }
public static RestProject generateFullRestProject(){ final RestProject project = new RestProject(); project.setId("REST PROJECT"); project.setName("Project name"); project.setDescription("Project description"); project.setCreated(new Date()); project.setUpdated(new Date()); project.setApplications(new ArrayList<RestApplication>()); for(int applicationIndex = 0; applicationIndex < 3; applicationIndex++){ final RestApplication restApplication = RestApplicationGenerator.generateRestApplication(); restApplication.setResources(new ArrayList<RestResource>()); project.getApplications().add(restApplication); for(int resourceIndex = 0; resourceIndex < 3; resourceIndex++){ final RestResource restResource = RestResourceGenerator.generateRestResource(); restResource.setMethods(new ArrayList<RestMethod>()); restApplication.getResources().add(restResource); for(int methodIndex = 0; methodIndex < 3; methodIndex++){ final RestMethod restMethod = RestMethodGenerator.generateRestMethod(); restMethod.setMockResponses(new ArrayList<RestMockResponse>()); restResource.getMethods().add(restMethod); for(int responseIndex = 0; responseIndex < 3; responseIndex++){ final RestMockResponse restMockResponse = RestMockResponseGenerator.generateRestMockResponse(); restMethod.getMockResponses().add(restMockResponse); } } } } return project; }
@Test @Ignore public void testProcess(){ final RestProject restProject = new RestProject(); restProject.setApplications(new ArrayList<RestApplication>()); Mockito.when(repository.findOne(Mockito.anyString())).thenReturn(restProject); final List<RestApplication> restApplications = new ArrayList<RestApplication>(); for(int index = 0; index < 3; index++){ final RestApplication restApplication = RestApplicationGenerator.generateRestApplication(); restApplications.add(restApplication); } /* final CreateRestApplicationsInput input = new CreateRestApplicationsInput(restProject.getId(), restApplications); final ServiceTask<CreateRestApplicationsInput> serviceTask = new ServiceTask<CreateRestApplicationsInput>(input); service.process(serviceTask); Mockito.verify(repository, Mockito.timeout(1)).save(Mockito.any(RestProject.class)); */ }
public static RestProject convert(RestProjectV1 projectV1){ RestProject project = new RestProject(); project.setCreated(projectV1.getCreated()); project.setUpdated(projectV1.getUpdated());