Package models

Examples of models.ArticlesDto


        EntityManager entityManager = entitiyManagerProvider.get();
       
        TypedQuery<Article> query= entityManager.createQuery("SELECT x FROM Article x", Article.class);
        List<Article> articles = query.getResultList();       

        ArticlesDto articlesDto = new ArticlesDto();
        articlesDto.articles = articles;
       
        return articlesDto;
       
    }
View Full Code Here


        EntityManager entityManager = entitiyManagerProvider.get();
       
        TypedQuery<Article> query= entityManager.createQuery("SELECT x FROM Article x", Article.class);
        List<Article> articles = query.getResultList();       

        ArticlesDto articlesDto = new ArticlesDto();
        articlesDto.articles = articles;
       
        return articlesDto;
       
    }
View Full Code Here

    @Inject
    ArticleDao articleDao;

    public Result getArticlesJson() {

        ArticlesDto articlesDto = articleDao.getAllArticles();

        return Results.json().render(articlesDto);

    }
View Full Code Here

   
    }

    public Result getArticlesXml() {

        ArticlesDto articlesDto = articleDao.getAllArticles();

        return Results.xml().render(articlesDto);

    }
View Full Code Here

       
        Response response = sayAndMakeRequest(
                Request.GET().url(
                        testServerUrl().path(GET_ARTICLES_URL.replace("{username}", "bob@gmail.com"))));

        ArticlesDto articlesDto = getGsonWithLongToDateParsing().fromJson(response.payload, ArticlesDto.class);

        sayAndAssertThat("We get back all 3 articles of that user",
                articlesDto.articles.size(),
                CoreMatchers.is(3));
View Full Code Here

       
        Response response = sayAndMakeRequest(
                Request.GET().url(
                        testServerUrl().path(GET_ARTICLES_URL.replace("{username}", "bob@gmail.com"))));

        ArticlesDto articlesDto = getGsonWithLongToDateParsing().fromJson(response.payload, ArticlesDto.class);

        sayAndAssertThat("We get back all 3 articles of that user",
                articlesDto.articles.size(),
                CoreMatchers.is(3));
View Full Code Here

       
        say("Retrieving all articles of a user is a GET request to " + GET_ARTICLES_URL);
       
        ApiResponse apiResponse = makeGetRequest(buildUri(GET_ARTICLES_URL.replace("{username}", "bob@gmail.com")));

        ArticlesDto articlesDto = getGsonWithLongToDateParsing().fromJson(apiResponse.payload, ArticlesDto.class);

        assertEqualsAndSay(3, articlesDto.articles.size(), "We get back all 3 articles of that user");

        // /////////////////////////////////////////////////////////////////////
        // Post new article:
View Full Code Here

        // /////////////////////////////////////////////////////////////////////
        String response = ninjaTestBrowser.makeJsonRequest(getServerAddress()
                + "api/bob@gmail.com/articles.json");
        System.out.println("response: " + response);

        ArticlesDto articlesDto = getGsonWithLongToDateParsing().fromJson(
                response, ArticlesDto.class);

        assertEquals(3, articlesDto.articles.size());

        // /////////////////////////////////////////////////////////////////////
View Full Code Here

        // and then configure, for example:
        module.setDefaultUseWrapper(false);
        XmlMapper xmlMapper = new XmlMapper(module);
       

        ArticlesDto articlesDto = xmlMapper.readValue(response, ArticlesDto.class);

        assertEquals(3, articlesDto.articles.size());

        // /////////////////////////////////////////////////////////////////////
        // Post new article:
View Full Code Here

    @Inject
    ArticleDao articleDao;

    public Result getArticlesJson() {

        ArticlesDto articlesDto = articleDao.getAllArticles();

        return Results.json().render(articlesDto);

    }
View Full Code Here

TOP

Related Classes of models.ArticlesDto

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.