Examples of BasicTestDataLeaf


Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

            new DummyHttpServletRequest(), new DummyHttpServletResponse() );

    @Test
    public void testBasic() throws IOException
    {
        BasicTestDataLeaf leaf = new BasicTestDataLeaf();
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();
        RenderingEvent<BasicTestDataLeaf> event = new RenderingEvent<BasicTestDataLeaf>( RenderingEventType.POJO_CHILD, model, leaf,
            BasicTestDataLeaf.class, requestContext, new CoreSelector(
                        new DefaultEntityConfigurationRegistry() ) );
        new NavigationLinksListener().eventOccurred( event );
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

    public void testLotsOfData() throws IOException
    {
        ArrayList<BasicTestDataLeaf> input = new ArrayList<BasicTestDataLeaf>();
        for (int i = 0; i < MAX_RESULTS + 1; i++)
        {
            input.add( new BasicTestDataLeaf() );
        }
        ObjectListHierarchicalModelImpl model = new ObjectListHierarchicalModelImpl();
        resultTraverser.traverse( input, new CoreSelector(), model, requestContext );
    }
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

    }

    @Test
    public void testBasicSelector() throws IOException
    {
        BasicTestDataLeaf input = new BasicTestDataLeaf();
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        resultTraverser.traverse( input, resolver.getBaseSelector(), model, requestContext );

        Map<String, Object> objectTree = model.getUnderlyingModel();
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

    }

    @Test
    public void testBasicFieldSelector() throws IOException
    {
        BasicTestDataLeaf input = new BasicTestDataLeaf();
        input.setOther( "someValue" );
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        resultTraverser.traverse( input, resolver.resolveSelector( "other" ), model, requestContext );

        Map<String, Object> objectTree = model.getUnderlyingModel();
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

    @Test
    public void testStarFieldSelector() throws IOException
    {
        resolver.setStarResolvesToAll( true );
        BasicTestDataLeaf input = new BasicTestDataLeaf();
        input.setOther( "someValue" );
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        resultTraverser.traverse( input, resolver.resolveSelector( "*" ), model, requestContext );

        Map<String, Object> objectTree = model.getUnderlyingModel();
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

   
   
    @Test
    public void testBasicListField() throws IOException
    {
        BasicTestDataLeaf input = new BasicTestDataLeaf();
        List<String> list = Arrays.asList( "someValue", "aSecondValue" );
        input.setRandomStrings( list );
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        FieldSelector selector = new FieldSelector();
        selector.register( "randomStrings", new FieldSelector() );
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

    public void testBasicMapField() throws IOException
    {
        HashMap<Object,Object> map = new HashMap<Object, Object>();
        map.put("someKey", "someValue");
        map.put("anotherKey", "anotherValue");
        BasicTestDataLeaf input = new BasicTestDataLeaf();
        input.setId(10);
        input.setName("name");
        input.setOther("other");
        map.put("aThirdKey", input);
       
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        FieldSelector selector = new FieldSelector();
        selector.register( "anotherKey", new FieldSelector() );
        selector.register( "aThirdKey", new FieldSelector() );

        resultTraverser.traverse( map, new CompositeSelector( resolver.getBaseSelector(), selector ), model, requestContext );
        Map<String, Object> objectTree = model.getUnderlyingModel();
       
        // "someKey" should not be selected from map
        Assert.assertEquals( null, objectTree.get( "someKey" ) );
       
        // "anotherKey" should be selected from map and has primitive value
        Assert.assertEquals( "anotherValue", objectTree.get( "anotherKey" ) );
       
        // "aThirdKey" should be selected but only @Core fields of pojo
        Map<?,?> actualPojo = (Map<?,?>) objectTree.get("aThirdKey");
        Assert.assertEquals( input.getId(), actualPojo.get("id"));
        Assert.assertEquals( input.getName(), actualPojo.get("name"));
        Assert.assertEquals(null, actualPojo.get("other"));
    }
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

        Assert.assertEquals(null, actualPojo.get("other"));
    }

    @Test
    public void testNullValuesInList() throws IOException {
        BasicTestDataLeaf input = new BasicTestDataLeaf();
        List<String> list = Arrays.asList( "someValue", null, "aThirdValue" );
        input.setRandomStrings( list );
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        FieldSelector selector = new FieldSelector();
        selector.register( "randomStrings", new FieldSelector() );
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

    }

    @Test
    public void testBasicCombinedSelctor() throws IOException
    {
        BasicTestDataLeaf input = new BasicTestDataLeaf();
        input.setOther( "someValue" );
        ObjectMapHierarchicalModelImpl model = new ObjectMapHierarchicalModelImpl();

        FieldSelector fieldSelector = new FieldSelector();
        fieldSelector.register( "other", new FieldSelector() );
View Full Code Here

Examples of org.skyscreamer.yoga.test.model.basic.BasicTestDataLeaf

    @SuppressWarnings("unchecked")
    @Test
    public void testNodeCombinedSelector() throws IOException
    {
        BasicTestDataNode input = new BasicTestDataNode();
        input.setLeaf( new BasicTestDataLeaf() );
        input.setId( "fooId" );

        FieldSelector fieldSelector = new FieldSelector();
        fieldSelector.register( "leaf", new FieldSelector() );
        CompositeSelector selector = new CompositeSelector( resolver.getBaseSelector(), fieldSelector );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.