public void testOnChangePropertyOfReferenceWithMultipleKeyAsListDescriptionInAggregateOfCollection() throws Exception { execute("CRUD.new"); execute("Collection.new", "viewObject=xava_view" + getSection() + "_deliveryPlaces"); assertValue("remarks", ""); Warehouse warehouse = new Warehouse(); warehouse.setNumber(1); warehouse.setZoneNumber(1); String warehouseKey = MetaModel.getForPOJO(warehouse).toString(warehouse); setValue("preferredWarehouse.KEY", warehouseKey); assertValue("remarks", "PREFERRED WAREHOUSE IS 1"); }
public void testCreateModifyAndReadWithDescriptionsListReference() throws Exception { // Create execute("CRUD.new"); setValue("number", "66"); setValue("description", "JUNIT PRODUCT"); setValue("family.number", "2"); assertNoErrors(); setValue("subfamily.number", "12"); Warehouse warehouseKey = new Warehouse(); warehouseKey.setNumber(1); warehouseKey.setZoneNumber(2); setValue("warehouse.KEY", toKeyString(warehouseKey)); setValue("unitPrice", "125.66"); assertNoErrors(); assertNoEditable("unitPriceInPesetas"); execute("CRUD.save"); assertNoErrors(); // Search for verify setValue("number", "66"); execute("CRUD.refresh"); assertNoErrors(); assertValue("number", "66"); assertValue("description", "JUNIT PRODUCT"); assertValue("family.number", "2"); assertValue("subfamily.number", "12"); assertValue("warehouse.KEY", toKeyString(warehouseKey)); assertValue("unitPrice", "125.66"); // Modify setValue("subfamily.number", "13"); execute("CRUD.save"); assertNoErrors(); assertValue("number", ""); assertValue("description", ""); // Verifying just modified setValue("number", "66"); execute("CRUD.refresh"); assertNoErrors(); assertValue("number", "66"); assertValue("description", "JUNIT PRODUCT"); assertValue("family.number", "2"); assertValue("subfamily.number", "13"); // Delete execute("CRUD.delete"); assertMessage("Product deleted successfully"); }
public void testFilterToDescriptionsListWithBaseConditionAndFilter() throws Exception { try { // warehouse has a filter zoneNumber <= 999 Warehouse.findByZoneNumberNumber(1000, 1); } catch (NoResultException ex) { fail("It needs a warehouse with zone number 1000"); } setConditionValues(new String[] {"cuatrero"}); execute("List.filter"); execute("List.viewDetail", "row=0"); assertLabelInCollection("deliveryPlaces", 3, "Name of Preferred warehouse"); assertValueInCollection("deliveryPlaces", 0, 3, "CENTRAL VALENCIA"); setConditionValues("deliveryPlaces", new String[] {"", "", "", "[.1.2.]"}); // execute("List.filter", "collection=deliveryPlaces"); // Not needed because // filterOnChange=true assertCollectionRowCount("deliveryPlaces", 0); setConditionValues("deliveryPlaces", new String[] {"", "", "", "[.1.1.]"}); // execute("List.filter", "collection=deliveryPlaces"); // Not needed because // filterOnChange=true assertCollectionNotEmpty("deliveryPlaces"); try { setConditionValues("deliveryPlaces", new String[] {"", "", "", "[.1.1000.]"}); } catch (IllegalArgumentException ex) { assertTrue(ex.getMessage().equals("No option found with value: [.1.1000.]")); } }
private void createProduct(int number, String description, int zone) throws Exception { Product2 p = new Product2(); p.setNumber(number); p.setDescription(description); Family2 f = new Family2(); f.setNumber(1); p.setFamily(f); Subfamily2 sf = new Subfamily2(); sf.setNumber(1); p.setSubfamily(sf); Warehouse w = new Warehouse(); w.setNumber(1); w.setZoneNumber(zone); p.setWarehouse(w); p.setUnitPrice(new BigDecimal("1.00")); XPersistence.getManager().persist(p); XPersistence.commit(); }
public void testReferencesAsDescriptionListUsesFilterOfDefaultTab() throws Exception { execute("CRUD.new"); execute("Product2.changeLimitZone"); Warehouse key1 = new Warehouse(); key1.setZoneNumber(1); key1.setNumber(1); Warehouse key2 = new Warehouse(); key2.setZoneNumber(1); key2.setNumber(2); Warehouse key3 = new Warehouse(); key3.setZoneNumber(1); key3.setNumber(3); String[][] warehouses = { {"", ""}, {toKeyString(key1), "CENTRAL VALENCIA"}, {toKeyString(key3), "VALENCIA NORTE"}, {toKeyString(key2), "VALENCIA SURETE"} }; assertValidValues("warehouse.KEY", warehouses); }
public void testOnChangeDescriptionsListReferenceMultipleKey() throws Exception { execute("CRUD.new"); assertNotExists("zoneOne"); Warehouse warehouseKeyZone1 = new Warehouse(); warehouseKeyZone1.setNumber(1); warehouseKeyZone1.setZoneNumber(1); setValue("warehouse.KEY", toKeyString(warehouseKeyZone1)); assertExists("zoneOne"); Warehouse warehouseKeyZone2 = new Warehouse(); warehouseKeyZone2.setNumber(1); warehouseKeyZone2.setZoneNumber(2); setValue("warehouse.KEY", toKeyString(warehouseKeyZone2)); assertNotExists("zoneOne"); createProduct(66, "JUNIT ZONE 1", 1); createProduct(67, "JUNIT ZONE 2", 2); setValue("number", "66"); execute("CRUD.refresh"); assertNoErrors(); assertValue("description", "JUNIT ZONE 1"); assertExists("zoneOne"); execute("CRUD.new"); setValue("number", "67"); execute("CRUD.refresh"); assertNoErrors(); assertValue("description", "JUNIT ZONE 2"); assertNotExists("zoneOne"); setValue("warehouse.KEY", ""); assertValue("warehouse.KEY", ""); deleteProduct(66); deleteProduct(67); }