Package models

Examples of models.City


        }
    }

    @Test
    public void testEntity2NoBindingCollectionNoParams() {
        City city = null;
        Entity2 entity2 = null;
        try {
            entity2 = new Entity2();

            entity2.a = "testNewEntity2";
            entity2.b = true;
            entity2.c = 1;

            city = new City();
            city.name = "Name";
            city.save();

            entity2.city = city;
            entity2.cities = new ArrayList<City>();
            entity2.cities.add(city);
            entity2.save();

            Params params = new Params();

            Validation.clear();
            ParamNode rootParamNode = ParamNode.convert(params.all());
            entity2.edit(rootParamNode, "entity2");
            assertFalse(Validation.hasErrors());

            entity2.save();
            entity2.refresh();

            assertEquals(1, entity2.cities.size());
            assertEquals(city.name, entity2.cities.get(0).name);
        } finally {
            if (entity2 != null && entity2.id != null) {
                entity2.delete();
            }
            if (city != null && city.id != null) {
                city.delete();
            }
        }
    }
View Full Code Here


        }
    }

    @Test
    public void testEntity2NoBindingCollectionRootKeyNull() {
        City city = null;
        Entity2 entity2 = null;
        try {
            entity2 = new Entity2();

            entity2.a = "testNewEntity2";
            entity2.b = true;
            entity2.c = 1;

            city = new City();
            city.name = "Name";
            city.save();

            entity2.city = city;
            entity2.cities = new ArrayList<City>();
            entity2.cities.add(city);
            entity2.save();

            Params params = new Params();
            params.put("entity2", (String) null);

            Validation.clear();
            ParamNode rootParamNode = ParamNode.convert(params.all());
            entity2.edit(rootParamNode, "entity2");
            assertFalse(Validation.hasErrors());

            entity2.save();
            entity2.refresh();

            assertEquals(1, entity2.cities.size());
            assertEquals(city.name, entity2.cities.get(0).name);
        } finally {
            if (entity2 != null && entity2.id != null) {
                entity2.delete();
            }
            if (city != null && city.id != null) {
                city.delete();
            }
        }
    }
View Full Code Here

TOP

Related Classes of models.City

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.