@Test public void test2() throws Exception { ObjectViews views = this.unmarshal("com/axelor/meta/WSTest.xml", ObjectViews.class); MetaStore.resister(views); Action action = MetaStore.getAction("export.sale.order"); Map<String, Object> context = Maps.newHashMap(); context.put("name", "SO001"); context.put("orderDate", new LocalDate()); context.put("customer", ImmutableMap.of("name", "John Smith")); List<Object> items = Lists.newArrayList(); context.put("items", items); items.add( ImmutableMap.of("product", ImmutableMap.of("name", "PC1"), "price", 250, "quantity", 1)); items.add( ImmutableMap.of("product", ImmutableMap.of("name", "PC2"), "price", 550, "quantity", 1)); items.add( ImmutableMap.of("product", ImmutableMap.of("name", "Laptop"), "price", 690, "quantity", 1)); ActionHandler handler = createHandler("export.sale.order", context); action.evaluate(handler); }
@Before public void setUp() { try { views = this.unmarshal("com/axelor/meta/Contact.xml", ObjectViews.class); } catch (Exception e) { throw Throwables.propagate(e); } assertNotNull(views); assertNotNull(views.getActions()); MetaStore.resister(views); ensureContact(); }
@Test public void test1() throws Exception { ObjectViews views = this.unmarshal("com/axelor/meta/WSTest.xml", ObjectViews.class); List<Action> actions = views.getActions(); Assert.assertNotNull(actions); Assert.assertEquals(4, actions.size()); MetaStore.resister(views); Action action = MetaStore.getAction("data.import.1"); Map<String, Object> context = Maps.newHashMap(); DateTime dt = new DateTime(); dt = dt.plus(Period.days(20)); context.put("dt", dt); ActionHandler handler = createHandler("data.import.1", context); action.evaluate(handler); }