Package org.broadleafcommerce.openadmin.web.rulebuilder.dto

Examples of org.broadleafcommerce.openadmin.web.rulebuilder.dto.DataWrapper


        Entity[] entities = new Entity[1];
        Entity entity = new Entity();
        entity.setProperties(properties);
        entities[0] = entity;

        DataWrapper dataWrapper = translator.createRuleData(entities, "matchRule", null, null, orderFieldService);
        assert(dataWrapper.getData().size() == 1);
        assert(dataWrapper.getData().get(0).getQuantity() == null);
        assert(dataWrapper.getData().get(0).getGroupOperator().equals(BLCOperator.AND.name()));
        assert(dataWrapper.getData().get(0).getGroups().size()==2);

        assert(dataWrapper.getData().get(0).getGroups().get(0) instanceof ExpressionDTO);
        ExpressionDTO e1 = (ExpressionDTO) dataWrapper.getData().get(0).getGroups().get(0);
        assert(e1.getName().equals("subTotal"));
        assert(e1.getOperator().equals(BLCOperator.GREATER_OR_EQUAL.name()));
        assert(e1.getValue().equals("100"));

        assert(dataWrapper.getData().get(0).getGroups().get(1) != null);
        DataDTO d1 = dataWrapper.getData().get(0).getGroups().get(1);
        assert(d1.getGroupOperator().equals(BLCOperator.OR.name()));
        assert(d1.getGroups().get(0) instanceof ExpressionDTO);
        ExpressionDTO d1e1 = (ExpressionDTO) d1.getGroups().get(0);
        assert(d1e1.getName().equals("currency.defaultFlag"));
        assert(d1e1.getOperator().equals(BLCOperator.EQUALS.name()));
View Full Code Here


        Entity[] entities = new Entity[2];
        entities[0] = e1;
        entities[1] = e2;

        DataWrapper dataWrapper = translator.createRuleData(entities, "orderItemMatchRule", "quantity", "id", orderItemFieldService);
        assert(dataWrapper.getData().size() == 2);

        assert(dataWrapper.getData().get(0).getQuantity() == 1);
        assert(dataWrapper.getData().get(0).getGroupOperator().equals(BLCOperator.AND.name()));
        assert(dataWrapper.getData().get(0).getGroups().size()==1);
        assert(dataWrapper.getData().get(0).getGroups().get(0) instanceof ExpressionDTO);
        ExpressionDTO exp1 = (ExpressionDTO) dataWrapper.getData().get(0).getGroups().get(0);
        assert(exp1.getName().equals("category.name"));
        assert(exp1.getOperator().equals(BLCOperator.EQUALS.name()));
        assert(exp1.getValue().equals("test category"));

        assert(dataWrapper.getData().get(1).getQuantity() == 2);
        assert(dataWrapper.getData().get(1).getGroupOperator().equals(BLCOperator.NOT.name()));
        assert(dataWrapper.getData().get(1).getGroups().size()==2);

        assert(dataWrapper.getData().get(1).getGroups().get(0) instanceof ExpressionDTO);
        ExpressionDTO expd1e1 = (ExpressionDTO) dataWrapper.getData().get(1).getGroups().get(0);
        assert(expd1e1.getName().equals("product.manufacturer"));
        assert(expd1e1.getOperator().equals(BLCOperator.EQUALS.name()));
        assert(expd1e1.getValue().equals("test manufacturer"));

        assert(dataWrapper.getData().get(1).getGroups().get(1) instanceof ExpressionDTO);
        ExpressionDTO expd1e2 = (ExpressionDTO) dataWrapper.getData().get(1).getGroups().get(1);
        assert(expd1e2.getName().equals("product.model"));
        assert(expd1e2.getOperator().equals(BLCOperator.EQUALS.name()));
        assert(expd1e2.getValue().equals("test model"));
    }
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.openadmin.web.rulebuilder.dto.DataWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.