use of eu.ggnet.dwoss.stock.ee.entity.StockTransactionStatus in project dwoss by gg-net.
the class StockTransactionFormaterTryout method start.
@Override
public void start(Stage primaryStage) throws Exception {
Stock s1 = new Stock(0, "Lager0");
Stock s2 = new Stock(1, "Lager1");
StockTransaction st1 = new StockTransaction(StockTransactionType.ROLL_IN);
st1.setDestination(s1);
st1.addStatus(new StockTransactionStatus(StockTransactionStatusType.PREPARED, new Date()));
st1.addStatus(new StockTransactionStatus(StockTransactionStatusType.COMPLETED, new Date()));
st1.setComment("Bla Bla");
st1.addUnit(new StockUnit("123456", "Acer Aspire 4412", 1));
st1.addUnit(new StockUnit("AA231", "Der Apfel", 0));
WebView view = new WebView();
view.getEngine().loadContent(StockTransactionFormater.toHtml(st1));
primaryStage.setScene(new Scene(new BorderPane(view)));
primaryStage.show();
}
use of eu.ggnet.dwoss.stock.ee.entity.StockTransactionStatus in project dwoss by gg-net.
the class StockTransactionUtilTest method testEqualMessage.
@Test
public void testEqualMessage() {
StockTransaction t1 = new StockTransaction();
StockTransaction t2 = new StockTransaction();
Stock s1 = new Stock(1);
Stock s2 = new Stock(2);
t1.setSource(s1);
t2.setSource(s1);
t1.setDestination(s2);
t2.setDestination(s2);
t1.setType(StockTransactionType.TRANSFER);
t2.setType(StockTransactionType.TRANSFER);
t1.addStatus(new StockTransactionStatus(PREPARED, new Date()));
t2.addStatus(new StockTransactionStatus(PREPARED, new Date()));
assertNull(StockTransactionUtil.equalStateMessage(t1, t2));
t1.setSource(s2);
assertNotNull(StockTransactionUtil.equalStateMessage(t1, t2));
t1.setSource(s1);
assertNull(StockTransactionUtil.equalStateMessage(t1, t2));
t1.setDestination(s1);
assertNotNull(StockTransactionUtil.equalStateMessage(t1, t2));
t1.setDestination(s2);
assertNull(StockTransactionUtil.equalStateMessage(t1, t2));
t1.setType(StockTransactionType.ROLL_IN);
assertNotNull(StockTransactionUtil.equalStateMessage(t1, t2));
t1.setType(StockTransactionType.TRANSFER);
assertNull(StockTransactionUtil.equalStateMessage(t1, t2));
t2.addStatus(new StockTransactionStatus(FAILED, new Date()));
assertNotNull(StockTransactionUtil.equalStateMessage(t1, t2));
}
use of eu.ggnet.dwoss.stock.ee.entity.StockTransactionStatus in project dwoss by gg-net.
the class StockTransactionEmoIT method testRequestDestroyPrepared.
@Test
public void testRequestDestroyPrepared() throws Exception {
List<Stock> stocks = gen.makeStocksAndLocations(2);
StockTransactionEmo stockTransactionEmo = new StockTransactionEmo(em);
utx.begin();
em.joinTransaction();
StockTransaction st1 = stockTransactionEmo.requestDestroyPrepared(stocks.get(0).getId(), "Hugo", "Ein toller Komentar");
assertNotNull(st1);
utx.commit();
utx.begin();
em.joinTransaction();
StockTransaction st2 = stockTransactionEmo.requestDestroyPrepared(stocks.get(0).getId(), "Hugo", "Ein toller Komentar");
assertNotNull(st2);
assertEquals(st1.getId(), st2.getId());
st2.addStatus(new StockTransactionStatus(COMPLETED, new Date()));
utx.commit();
utx.begin();
em.joinTransaction();
StockTransaction st3 = stockTransactionEmo.requestDestroyPrepared(stocks.get(0).getId(), "Hugo", "Ein toller Komentar");
assertNotNull(st3);
assertFalse(st1.getId() == st3.getId());
utx.commit();
}
use of eu.ggnet.dwoss.stock.ee.entity.StockTransactionStatus in project dwoss by gg-net.
the class StockUnitEaoIT method testFindByNoTransaction.
@Test
public void testFindByNoTransaction() throws Exception {
utx.begin();
em.joinTransaction();
Stock s = new Stock(0, "TEEEEEEEEEEEEEEST");
em.persist(s);
StockLocation sl = new StockLocation("Lagerplatz");
s.addStockLocation(sl);
StockUnit s1 = new StockUnit("G1", 1);
StockUnit s2 = new StockUnit("G2", 2);
StockUnit s3 = new StockUnit("G3", 3);
StockUnit s4 = new StockUnit("G4", 4);
s.addUnit(s1, sl);
s.addUnit(s2, sl);
s.addUnit(s3, sl);
s.addUnit(s4, sl);
em.persist(s);
em.persist(new Stock(1, "TEEEEEEEEEST2"));
LogicTransaction lt = new LogicTransaction();
lt.setDossierId(1);
lt.add(s4);
em.persist(lt);
StockTransaction st = new StockTransaction(StockTransactionType.TRANSFER);
st.setSource(s);
st.addStatus(new StockTransactionStatus(StockTransactionStatusType.PREPARED, new Date()));
em.persist(st);
st.addPosition(new StockTransactionPosition(s1));
utx.commit();
List<StockUnit> sts = sus.findByNoTransaction();
assertEquals(2, sts.size());
}
use of eu.ggnet.dwoss.stock.ee.entity.StockTransactionStatus in project dwoss by gg-net.
the class ValidationTest method testStockUnit.
@Test
public void testStockUnit() {
StockUnit su = new StockUnit("Bla", 0);
Set<? extends ConstraintViolation> violations = validator.validate(su);
if (violations.isEmpty())
fail("No violation, but StockUnit has neither Stock nor Position");
Stock s = new Stock(1, "Teststock");
su.setStock(s);
violations = validator.validate(su);
if (!violations.isEmpty())
fail("Violation, but StockUnit has Stock. msg: " + buildMessage(violations));
su.setStock(null);
violations = validator.validate(su);
if (violations.isEmpty())
fail("No violation, but StockUnit has neither Stock nor Position");
StockTransactionPosition stp = new StockTransactionPosition(su);
if (validator.validate(su).isEmpty())
fail("No violation, but StockUnit has invalid Position");
StockTransaction t = new StockTransaction();
t.addPosition(stp);
if (validator.validate(su).isEmpty())
fail("No violation, but StockTransaction is still invalid (no status, no type)");
t.addStatus(new StockTransactionStatus(StockTransactionStatusType.PREPARED, new Date()));
if (validator.validate(su).isEmpty())
fail("No violation, but StockTransaction is still invalid (no type)");
t.setType(StockTransactionType.TRANSFER);
violations = validator.validate(su);
if (!violations.isEmpty())
fail("Violation, but StockUnit has valid Position and Transaction. msg: " + buildMessage(violations));
su.setStock(s);
violations = validator.validate(su);
if (!violations.isEmpty())
fail("Violation, Special Case: StockUnit has Stock and Transaction(Prepared) which is ok. msg: " + buildMessage(violations));
t.addStatus(new StockTransactionStatus(StockTransactionStatusType.COMMISSIONED, new Date()));
if (validator.validate(su).isEmpty())
fail("No violation, but now StockUnit has Stock and StockTransaction( not prepared), which is not ok.");
}
Aggregations