use of ca.corefacility.bioinformatics.irida.model.project.Project in project irida by phac-nml.
the class ProjectEventHandlerTest method testDelegateUserRemoved.
@Test
public void testDelegateUserRemoved() {
Class<? extends ProjectEvent> clazz = UserRemovedProjectEvent.class;
Project project = new Project();
User user = new User();
Object[] args = { project, user };
MethodEvent methodEvent = new MethodEvent(clazz, null, args);
when(eventRepository.save(any(ProjectEvent.class))).thenReturn(new UserRemovedProjectEvent(project, user));
handler.delegate(methodEvent);
ArgumentCaptor<ProjectEvent> captor = ArgumentCaptor.forClass(ProjectEvent.class);
verify(eventRepository).save(captor.capture());
ProjectEvent event = captor.getValue();
assertTrue(event instanceof UserRemovedProjectEvent);
verify(projectRepository).save(any(Project.class));
}
use of ca.corefacility.bioinformatics.irida.model.project.Project in project irida by phac-nml.
the class ProjectEventHandlerTest method testOtherEvent.
@Test
public void testOtherEvent() {
Class<? extends ProjectEvent> clazz = ProjectEvent.class;
Project project = new Project();
User user = new User();
Object[] args = { project, user };
MethodEvent methodEvent = new MethodEvent(clazz, null, args);
handler.delegate(methodEvent);
verifyZeroInteractions(eventRepository);
}
use of ca.corefacility.bioinformatics.irida.model.project.Project in project irida by phac-nml.
the class ProjectTest method testNullProjectName.
@Test
public void testNullProjectName() {
Project p = new Project();
p.setName(null);
Set<ConstraintViolation<Project>> violations = validator.validate(p);
assertEquals("Wrong number of violations.", 2, violations.size());
}
use of ca.corefacility.bioinformatics.irida.model.project.Project in project irida by phac-nml.
the class ProjectTest method testEmptyProjectName.
@Test
public void testEmptyProjectName() {
Project p = new Project();
p.setName("");
Set<ConstraintViolation<Project>> violations = validator.validate(p);
assertEquals("Wrong number of violations.", 1, violations.size());
}
use of ca.corefacility.bioinformatics.irida.model.project.Project in project irida by phac-nml.
the class ProjectServiceImplIT method testShareSamplesWithOwner.
@Test
@WithMockUser(username = "user1", roles = "USER")
public void testShareSamplesWithOwner() {
Project source = projectService.read(2L);
Project destination = projectService.read(10L);
Sample sample1 = sampleService.read(1L);
Set<Sample> samples = Sets.newHashSet(sample1);
List<ProjectSampleJoin> copiedSamples = projectService.shareSamples(source, destination, samples, true);
assertEquals(samples.size(), copiedSamples.size());
copiedSamples.forEach(j -> {
assertTrue("Project should be owner for sample", j.isOwner());
});
assertNotNull("Samples should still exist in source project", projectSampleJoinRepository.readSampleForProject(source, sample1));
assertNotNull("Sample should exist in destination project", projectSampleJoinRepository.readSampleForProject(destination, sample1));
}
Aggregations