Search in sources :

Example 6 with Box

use of uk.ac.bbsrc.tgac.miso.core.data.Box in project miso-lims by miso-lims.

the class BoxPageIT method testAddOneItemToBox.

@Test
public void testAddOneItemToBox() {
    final String position = "F06";
    // confirm values pre-add
    BoxPage page = getBoxPage(500L);
    BoxVisualization visualization = page.getVisualization();
    assertTrue("empty position is empty", visualization.isEmptyPosition(position));
    Box initial = (Box) getSession().get(BoxImpl.class, 500L);
    assertNull(initial.getBoxPositions().get(position));
    // add the item
    visualization.selectPosition(position);
    visualization.searchBoxables("TIB_SamStock");
    visualization.updatePosition(false);
    // confirm values post-add
    BoxPage again = getBoxPage(500L);
    assertFalse("checking that position is no longer empty", again.getVisualization().isEmptyPosition(position));
    Box box = (Box) getSession().get(BoxImpl.class, 500L);
    assertNotNull(box.getBoxPositions().get(position));
}
Also used : BoxVisualization(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxVisualization) BoxImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) BoxPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxPage) Test(org.junit.Test)

Example 7 with Box

use of uk.ac.bbsrc.tgac.miso.core.data.Box in project miso-lims by miso-lims.

the class BoxPageIT method testMoveItemWithinBox.

@Test
public void testMoveItemWithinBox() {
    final String initialPosition = "F10";
    final String finalPosition = "F12";
    Library lib = (Library) getSession().get(LibraryImpl.class, 505L);
    assertNotNull(lib);
    BoxableId libBoxableId = new BoxableId(lib.getEntityType(), lib.getId());
    // confirm positions pre-move
    Box initial = (Box) getSession().get(BoxImpl.class, 500L);
    BoxPosition itemAtInitialPosition = initial.getBoxPositions().get(initialPosition);
    assertNotNull(itemAtInitialPosition);
    assertNull(initial.getBoxPositions().get(finalPosition));
    assertEquals(libBoxableId, itemAtInitialPosition.getBoxableId());
    BoxPage page = getBoxPage(500L);
    BoxVisualization visualization = page.getVisualization();
    assertFalse("checking that library is in position F10", visualization.isEmptyPosition(initialPosition));
    assertTrue("checking which library is in position F10", visualization.getPositionTitle(initialPosition).contains(lib.getAlias()));
    assertTrue("checking that no tube is in position F12", visualization.isEmptyPosition(finalPosition));
    visualization.selectPosition(finalPosition);
    visualization.searchBoxables(lib.getIdentificationBarcode());
    visualization.updatePosition(false);
    // confirm positions post-move
    Box updated = (Box) getSession().get(BoxImpl.class, 500L);
    assertNull(updated.getBoxPositions().get(initialPosition));
    BoxPosition updatedAtFinalPosition = updated.getBoxPositions().get(finalPosition);
    assertNotNull(updatedAtFinalPosition);
    assertEquals(libBoxableId, updatedAtFinalPosition.getBoxableId());
    BoxPage afterSave = getBoxPage(500L);
    BoxVisualization afterVisualization = afterSave.getVisualization();
    assertTrue("checking that no tube is in position F10", afterVisualization.isEmptyPosition(initialPosition));
    assertFalse("checking that library is in position F12", afterVisualization.isEmptyPosition(finalPosition));
    assertTrue("checking which library is in position F12", afterVisualization.getPositionTitle(finalPosition).contains(lib.getAlias()));
}
Also used : BoxableId(uk.ac.bbsrc.tgac.miso.core.data.BoxableId) BoxVisualization(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxVisualization) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) BoxImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) BoxPosition(uk.ac.bbsrc.tgac.miso.core.data.BoxPosition) BoxPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxPage) Test(org.junit.Test)

Example 8 with Box

use of uk.ac.bbsrc.tgac.miso.core.data.Box in project miso-lims by miso-lims.

the class BoxPageIT method testAddMultipleTubes.

@Test
public void testAddMultipleTubes() {
    Library lib1 = (Library) getSession().get(LibraryImpl.class, 100001L);
    Library lib2 = (Library) getSession().get(LibraryImpl.class, 100002L);
    Library lib3 = (Library) getSession().get(LibraryImpl.class, 100003L);
    BoxPage page = getBoxPage(1L);
    BoxVisualization visualization = page.getVisualization();
    assertNull(lib1.getBox());
    assertNull(lib2.getBox());
    assertNull(lib3.getBox());
    assertTrue(visualization.isEmptyPosition("H10"));
    assertTrue(visualization.isEmptyPosition("H11"));
    assertTrue(visualization.isEmptyPosition("H12"));
    Map<String, String> updates = new HashMap<>();
    updates.put("H10", lib1.getName());
    updates.put("H11", lib2.getName());
    updates.put("H12", lib3.getName());
    visualization.updatePositions(updates, false);
    Box box = (Box) getSession().get(BoxImpl.class, 1L);
    assertTrue(visualization.getPositionTitle("H10").contains(lib1.getAlias()));
    assertEquals(new BoxableId(EntityType.LIBRARY, lib1.getId()), box.getBoxPositions().get("H10").getBoxableId());
    assertTrue(visualization.getPositionTitle("H11").contains(lib2.getAlias()));
    assertEquals(new BoxableId(EntityType.LIBRARY, lib2.getId()), box.getBoxPositions().get("H11").getBoxableId());
    assertTrue(visualization.getPositionTitle("H12").contains(lib3.getAlias()));
    assertEquals(new BoxableId(EntityType.LIBRARY, lib3.getId()), box.getBoxPositions().get("H12").getBoxableId());
}
Also used : BoxableId(uk.ac.bbsrc.tgac.miso.core.data.BoxableId) BoxVisualization(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxVisualization) HashMap(java.util.HashMap) LibraryImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryImpl) BoxImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) BoxPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxPage) Test(org.junit.Test)

Example 9 with Box

use of uk.ac.bbsrc.tgac.miso.core.data.Box in project miso-lims by miso-lims.

the class BoxPageIT method testDiscardTube.

@Test
public void testDiscardTube() {
    final String position = "C01";
    // confirm values pre-save
    BoxPage page = getBoxPage(500L);
    BoxVisualization visualization = page.getVisualization();
    assertFalse("check that position C01 is full", visualization.isEmptyPosition(position));
    assertTrue("check that title matches LDI name", visualization.getPositionTitle(position).contains("TIB_0001_nn_n_PE_404_WG"));
    Box initial = (Box) getSession().get(BoxImpl.class, 500L);
    assertNotNull(initial.getBoxPositions().get(position));
    LibraryAliquot initialLD = (LibraryAliquot) getSession().get(LibraryAliquot.class, 504L);
    assertFalse("check that boxable is not discarded", initialLD.isDiscarded());
    assertFalse("check that boxable location is not EMPTY", "EMPTY".equals(BoxUtils.makeLocationLabel(initialLD)));
    // discard the tube
    visualization.selectPosition(position);
    visualization.discardTube();
    // confirm values post-discard
    BoxPage newPage = getBoxPage(500L);
    BoxVisualization newVisualization = newPage.getVisualization();
    assertTrue("check that position C01 is now empty", newVisualization.isEmptyPosition(position));
    Box box = (Box) getSession().get(BoxImpl.class, 500L);
    assertNull(box.getBoxPositions().get(position));
    LibraryAliquot boxable = (LibraryAliquot) getSession().get(LibraryAliquot.class, 504L);
    assertTrue("check that boxable is discarded", boxable.isDiscarded());
    assertEquals("check that boxable volume is null", 0, boxable.getVolume().compareTo(BigDecimal.ZERO));
    assertEquals("check that boxable location is empty", "EMPTY", BoxUtils.makeLocationLabel(boxable));
}
Also used : BoxVisualization(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxVisualization) BoxImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) BoxPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxPage) Test(org.junit.Test)

Example 10 with Box

use of uk.ac.bbsrc.tgac.miso.core.data.Box in project miso-lims by miso-lims.

the class BoxPageIT method testSaveNewBox.

@Test
public void testSaveNewBox() {
    // Goal: save one new box
    BoxPage page = getBoxPage(null);
    assertNotNull(page);
    Map<Field, String> unsaved = new HashMap<>();
    unsaved.put(Field.ALIAS, "New Box");
    unsaved.put(Field.BARCODE, "newbarcode");
    unsaved.put(Field.DESCRIPTION, "Test");
    unsaved.put(Field.USE, "Storage");
    unsaved.put(Field.SIZE, "10×10 Storage");
    unsaved.put(Field.LOCATION, "Here");
    page.setFields(unsaved);
    assertEquals("Box ID is unsaved", "", page.getField(Field.ID));
    assertFieldValues("changes pre-save", unsaved, page);
    BoxPage savedPage = page.clickSave();
    assertFieldValues("changes post-save", unsaved, savedPage);
    Box box = (Box) getSession().get(BoxImpl.class, Long.valueOf(savedPage.getField(Field.ID)));
    assertNotEquals("Box ID is now a number", "Unsaved", box.getId());
    assertEquals("confirm box alias", unsaved.get(Field.ALIAS), box.getAlias());
    assertEquals("confirm box barcode", unsaved.get(Field.BARCODE), box.getIdentificationBarcode());
    assertEquals("confirm box description", unsaved.get(Field.DESCRIPTION), box.getDescription());
    assertEquals("confirm box use", unsaved.get(Field.USE), box.getUse().getAlias());
    assertEquals("confirm box size", unsaved.get(Field.SIZE), box.getSize().getLabel());
    assertEquals("confirm box location", unsaved.get(Field.LOCATION), box.getLocationBarcode());
}
Also used : Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxPage.Field) HashMap(java.util.HashMap) BoxImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl) Box(uk.ac.bbsrc.tgac.miso.core.data.Box) BoxPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxPage) Test(org.junit.Test)

Aggregations

Box (uk.ac.bbsrc.tgac.miso.core.data.Box)65 Test (org.junit.Test)23 BoxPosition (uk.ac.bbsrc.tgac.miso.core.data.BoxPosition)21 BoxImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.BoxImpl)17 BoxableId (uk.ac.bbsrc.tgac.miso.core.data.BoxableId)16 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)12 PostMapping (org.springframework.web.bind.annotation.PostMapping)11 BoxPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxPage)11 BoxableView (uk.ac.bbsrc.tgac.miso.core.data.impl.view.box.BoxableView)10 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)9 BoxVisualization (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.BoxVisualization)9 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 List (java.util.List)8 IOException (java.io.IOException)7 Set (java.util.Set)7 Collectors (java.util.stream.Collectors)7 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)7 Autowired (org.springframework.beans.factory.annotation.Autowired)6 GetMapping (org.springframework.web.bind.annotation.GetMapping)6