Package play.mvc.Scope

Examples of play.mvc.Scope.Params


    }

    @Test
    public void testParamsPut() {
        mockRequestAndResponse();
        Params params = new Params();
        params.put("param1", "test");
        params.put("param1.test", "test2");
       
        params.put("param1.object", "obj");
        params.put("param1.object.param1", "param1");
        params.put("param1.object.param2", "param2");
        params.put("param1.object.param2.3", "param3");
       
        assertEquals(6, params.all().size());
       
        assertTrue(params._contains("param1"));
        assertTrue(params._contains("param1.object"));    
        assertTrue(params._contains("param1.test"));      
        assertTrue(params._contains("param1.object.param1"));
        assertTrue(params._contains("param1.object.param2"));
        assertTrue(params._contains("param1.object.param2.3"));
    }
View Full Code Here


    }
   
    @Test
    public void testParamsRemove() {
        mockRequestAndResponse();
        Params params = new Params();
        params.put("param1", "test");
        params.put("param1.test", "test2");
       
        params.put("param1.object", "obj");
        params.put("param1.object.param1", "param1");
        params.put("param1.object.param2", "param2");
        params.put("param1.object.param2.3", "param3");
       
        assertEquals(6, params.all().size());
       
        params.remove("param1.object.param2");
   
        assertTrue(params._contains("param1"));
        assertTrue(params._contains("param1.test"));
        assertTrue(params._contains("param1.object"));
        assertTrue(params._contains("param1.object.param1"));
        assertFalse(params._contains("param1.object.param2"));
        assertTrue(params._contains("param1.object.param2.3"));
       
        assertEquals(5, params.all().size());
    }
View Full Code Here

    }
   
    @Test
    public void testParamsRemove2() {
        mockRequestAndResponse();
        Params params = new Params();
        params.put("param1", "test");
        params.put("param1.test", "test2");
       
        params.put("param1.object", "obj");
        params.put("param1.object.param1", "param1");
        params.put("param1.object.param2", "param2");
        params.put("param1.object.param2.3", "param3");
       
        assertEquals(6, params.all().size());
       
        params.remove("param1.object");
   
        assertTrue(params._contains("param1"));
        assertTrue(params._contains("param1.test"));
        assertFalse(params._contains("param1.object"));
        assertTrue(params._contains("param1.object.param1"));
        assertTrue(params._contains("param1.object.param2"));
        assertTrue(params._contains("param1.object.param2.3"));
       
        assertEquals(5, params.all().size());
    }
View Full Code Here

    }
   
    @Test
    public void testParamsRemoveStartWith() {
        mockRequestAndResponse();
        Params params = new Params();
        params.put("param1", "test");
        params.put("param1.test", "test2");
       
        params.put("param1.object", "obj");
        params.put("param1.object.param1", "param1");
        params.put("param1.object.param2", "param2");
        params.put("param1.object.param2.3", "param3");
       
        assertEquals(6, params.all().size());
       
        params.removeStartWith("param1.object");
   
        assertTrue(params._contains("param1"));
        assertTrue(params._contains("param1.test"));
        assertFalse(params._contains("param1.object"));      
        assertFalse(params._contains("param1.object.param1"));
        assertFalse(params._contains("param1.object.param2"));
        assertFalse(params._contains("param1.object.param2.3"));
       
        assertEquals(2, params.all().size());
    }
View Full Code Here

        City city = null;
        Entity2 entity2 = null;
        try {
            entity2 = new Entity2();

            Params params = new Params();
            params.put("entity2.a", "testNewEntity2");
            params.put("entity2.b", "true");
            params.put("entity2.c", "1");

            city = new City();
            city.name = "Name";
            city.save();
            params.put("entity2.city.id", city.getId().toString());
            params.put("entity2.city.name", "changeNameOfA");

            params.put("entity2.cities.id", city.getId().toString());

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

            entity2.save();
            entity2.refresh();
View Full Code Here

  City city = null;
        Entity2 entity2 = null;
        try {
            entity2 = new Entity2();

            Params params = new Params();
            params.put("entity2.a", "testNewEntity2");
            params.put("entity2.b", "true");
            params.put("entity2.c", "1");

            city = new City();
            city.name = "Name";
            city.save();
            params.put("entity2.city.id", city.getId().toString());
            params.put("entity2.city.name", "changeNameOfA");

            params.put("entity2.cities.id", city.getId().toString());

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

            entity2.save();
View Full Code Here

            entity2.city = city;
            entity2.cities = null;
            entity2.save();

            // edit gateway
            Params params = new Params();
            params.put("entity2.cities", city.getId().toString());

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

            // Here we have a problem has the payment gateways can be modified
            assertFalse(Validation.hasErrors());
View Full Code Here

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

            // edit gateway
            Params params = new Params();
            params.put("entity2.cities", (String) null);

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

            // Here we have a problem has the payment gateways can be modified
            assertFalse(Validation.hasErrors());
View Full Code Here

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

            // Try with id but set to empty
            Params params = new Params();
            params.put("entity2.cities.id", "");

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

            entity2.save();
            entity2.refresh();
View Full Code Here

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

            // Try with id but set to null
            Params params = new Params();
            params.put("entity2.cities.id", (String) null);

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

            entity2.save();
            entity2.refresh();
View Full Code Here

TOP

Related Classes of play.mvc.Scope.Params

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.