use of eu.ggnet.dwoss.stock.transactions.CreateSimpleAction in project dwoss by gg-net.
the class CreateSimpleActionTryout method tryout.
@Test
public void tryout() throws InterruptedException {
JPanel p = new JPanel();
JButton b = new JButton("Press to close");
b.setPreferredSize(new Dimension(200, 50));
CountDownLatch l = new CountDownLatch(1);
b.addActionListener(e -> {
l.countDown();
});
p.add(new JButton(new CreateSimpleAction()));
p.add(b);
Dl.remote().add(StockAgent.class, new StockAgent() {
@Override
public <T> List<T> findAll(Class<T> entityClass) {
if (entityClass.equals(Stock.class))
return (List<T>) Arrays.asList(new Stock(0, "Rotes Lager"), new Stock(1, "Blaues Lager"));
return null;
}
@Override
public List<StockUnit> findStockUnitsByRefurbishIdEager(List<String> refurbishIds) {
if (refurbishIds.contains("1")) {
Stock s = new Stock(0, "Lager1");
StockUnit s1 = new StockUnit("1", "Gerät Eins", 1);
s1.setStock(s);
return Arrays.asList(s1);
}
return Collections.EMPTY_LIST;
}
// <editor-fold defaultstate="collapsed" desc="Unused Methodes">
@Override
public StockUnit findStockUnitByUniqueUnitIdEager(Integer uniqueUnitId) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public StockUnit findStockUnitByRefurbishIdEager(String refurbishId) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<StockTransaction> findStockTransactionEager(StockTransactionType type, StockTransactionStatusType statusType) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<StockTransaction> findStockTransactionEager(StockTransactionType type, StockTransactionStatusType statusType, int start, int amount) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T persist(T t) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T merge(T t) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> void delete(T t) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public StockTransaction findOrCreateRollInTransaction(int stockId, String userName, String comment) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> long count(Class<T> entityClass) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> List<T> findAll(Class<T> entityClass, int start, int amount) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> List<T> findAllEager(Class<T> entityClass) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> List<T> findAllEager(Class<T> entityClass, int start, int amount) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T findById(Class<T> entityClass, Object id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T findById(Class<T> entityClass, Object id, LockModeType lockModeType) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T findByIdEager(Class<T> entityClass, Object id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T> T findByIdEager(Class<T> entityClass, Object id, LockModeType lockModeType) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Dl.remote().add(StockTransactionProcessor.class, new StockTransactionProcessor() {
@Override
public SortedMap<Integer, String> perpareTransfer(List<StockUnit> stockUnits, int destinationStockId, String arranger, String comment) throws UserInfoException {
SortedMap<Integer, String> r = new TreeMap<>();
r.put(1, "1");
return r;
}
// <editor-fold defaultstate="collapsed" desc="Unused Methodes">
@Override
public List<Integer> rollIn(List<StockTransaction> detachtedTransactions, String arranger) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void cancel(StockTransaction transaction, String arranger, String comment) throws UserInfoException {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void commission(List<StockTransaction> transactions, String picker, String deliverer) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void receive(List<StockTransaction> transactions, String deliverer, String reciever) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeFromPreparedTransaction(String refurbishId, String arranger, String comment) throws UserInfoException {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Guardian guardianMock = mock(Guardian.class);
given(guardianMock.getUsername()).willAnswer(i -> "Testuser");
Dl.local().add(Guardian.class, guardianMock);
UiCore.startSwing(() -> p);
l.await();
}
Aggregations