Package org.zanata.rest.dto

Examples of org.zanata.rest.dto.Glossary


            return response.build();
        }

        List<HGlossaryEntry> hGlosssaryEntries = glossaryDAO.getEntries();

        Glossary glossary = new Glossary();
        transferEntriesResource(hGlosssaryEntries, glossary);

        return Response.ok(glossary).build();
    }
View Full Code Here


            return response.build();
        }

        List<HGlossaryEntry> hGlosssaryEntries =
                glossaryDAO.getEntriesByLocaleId(locale);
        Glossary glossary = new Glossary();

        transferEntriesLocaleResource(hGlosssaryEntries, glossary, locale);

        return Response.ok(glossary).build();
    }
View Full Code Here

        assertThat(glossaryEntries.size(), is(0));
    }

    @Test
    public void putGlossary() {
        Glossary glossary = new Glossary();
        GlossaryEntry glossaryEntry1 = new GlossaryEntry();
        glossaryEntry1.setSrcLang(LocaleId.EN_US);
        glossaryEntry1.setSourcereference("TEST SOURCE REF DATA");

        GlossaryTerm glossaryTerm1 = new GlossaryTerm();
        glossaryTerm1.setLocale(LocaleId.EN_US);
        glossaryTerm1.setContent("TEST DATA 1 EN_US");
        glossaryTerm1.getComments().add("COMMENT 1");

        GlossaryTerm glossaryTerm2 = new GlossaryTerm();
        glossaryTerm2.setLocale(LocaleId.DE);
        glossaryTerm2.setContent("TEST DATA 2 DE");
        glossaryTerm2.getComments().add("COMMENT 2");

        glossaryEntry1.getGlossaryTerms().add(glossaryTerm1);
        glossaryEntry1.getGlossaryTerms().add(glossaryTerm2);

        GlossaryEntry glossaryEntry2 = new GlossaryEntry();
        glossaryEntry2.setSrcLang(LocaleId.EN_US);
        glossaryEntry2.setSourcereference("TEST SOURCE REF DATA2");

        GlossaryTerm glossaryTerm3 = new GlossaryTerm();
        glossaryTerm3.setLocale(LocaleId.EN_US);
        glossaryTerm3.setContent("TEST DATA 3 EN_US");
        glossaryTerm3.getComments().add("COMMENT 3");

        GlossaryTerm glossaryTerm4 = new GlossaryTerm();
        glossaryTerm4.setLocale(LocaleId.DE);
        glossaryTerm4.setContent("TEST DATA 4 DE");
        glossaryTerm4.getComments().add("COMMENT 4");

        glossaryEntry2.getGlossaryTerms().add(glossaryTerm3);
        glossaryEntry2.getGlossaryTerms().add(glossaryTerm4);

        glossary.getGlossaryEntries().add(glossaryEntry1);
        glossary.getGlossaryEntries().add(glossaryEntry2);

        ClientResponse<String> response = glossaryService.put(glossary);

        assertThat(response.getStatus(), is(Status.CREATED.getStatusCode()));
View Full Code Here

        // eq("glossary-delete"));
    }

    @Test
    public void testPutGlossaries() {
        Glossary glossary = new Glossary();
        GlossaryEntry glossaryEntry1 = new GlossaryEntry();
        glossaryEntry1.setSrcLang(LocaleId.EN_US);
        glossaryEntry1.setSourcereference("TEST SOURCE REF DATA");

        GlossaryTerm glossaryTerm1 = new GlossaryTerm();
        glossaryTerm1.setLocale(LocaleId.EN_US);
        glossaryTerm1.setContent("test data content 1 (source lang)");
        glossaryTerm1.getComments().add("COMMENT 1");

        glossaryEntry1.getGlossaryTerms().add(glossaryTerm1);

        glossary.getGlossaryEntries().add(glossaryEntry1);

        ClientResponse<String> response = glossaryService.put(glossary);

        ClientResponse<Glossary> response1 = glossaryService.getEntries();
        assertThat(response1.getEntity().getGlossaryEntries().size(),
View Full Code Here

            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(), is(200));
                assertJaxbUnmarshal(response, Glossary.class);

                Glossary glossary = jaxbUnmarshal(response, Glossary.class);
                assertThat(glossary.getGlossaryEntries().size(), is(1));

                // Glossary Entry
                GlossaryEntry entry = glossary.getGlossaryEntries().get(0);
                assertThat(entry.getSourcereference(), is("source reference"));
                assertThat(entry.getSrcLang(), is(LocaleId.EN_US));
                assertThat(entry.getGlossaryTerms().size(), is(3));

                // Expected / Actual glossary terms
View Full Code Here

            @Override
            protected void onResponse(ClientResponse response) {
                assertThat(response.getStatus(), is(200));
                assertJsonUnmarshal(response, Glossary.class);

                Glossary glossary = jsonUnmarshal(response, Glossary.class);
                assertThat(glossary.getGlossaryEntries().size(), is(1));

                // Glossary Entry
                GlossaryEntry entry = glossary.getGlossaryEntries().get(0);
                assertThat(entry.getSourcereference(), is("source reference"));
                assertThat(entry.getSrcLang(), is(LocaleId.EN_US));
                assertThat(entry.getGlossaryTerms().size(), is(3));

                // Expected / Actual glossary terms
View Full Code Here

    }

    @Test
    @RunAsClient
    public void putXml() throws Exception {
        final Glossary glossary = this.getSampleGlossary();

        new ResourceRequest(getRestEndpointUrl("/glossary"), "PUT",
                getAuthorizedEnvironment()) {
            @Override
            protected void prepareRequest(ClientRequest request) {
View Full Code Here

            }
        }.run();
    }

    private Glossary getSampleGlossary() {
        Glossary glossary = new Glossary();
        GlossaryEntry glossaryEntry1 = new GlossaryEntry();
        glossaryEntry1.setSrcLang(LocaleId.EN_US);
        glossaryEntry1.setSourcereference("TEST SOURCE REF DATA");

        GlossaryTerm glossaryTerm1 = new GlossaryTerm();
        glossaryTerm1.setLocale(LocaleId.EN_US);
        glossaryTerm1.setContent("TEST DATA 1 EN_US");
        glossaryTerm1.getComments().add("COMMENT 1");

        GlossaryTerm glossaryTerm2 = new GlossaryTerm();
        glossaryTerm2.setLocale(LocaleId.DE);
        glossaryTerm2.setContent("TEST DATA 2 DE");
        glossaryTerm2.getComments().add("COMMENT 2");

        glossaryEntry1.getGlossaryTerms().add(glossaryTerm1);
        glossaryEntry1.getGlossaryTerms().add(glossaryTerm2);

        GlossaryEntry glossaryEntry2 = new GlossaryEntry();
        glossaryEntry2.setSrcLang(LocaleId.EN_US);
        glossaryEntry2.setSourcereference("TEST SOURCE REF DATA2");

        GlossaryTerm glossaryTerm3 = new GlossaryTerm();
        glossaryTerm3.setLocale(LocaleId.EN_US);
        glossaryTerm3.setContent("TEST DATA 3 EN_US");
        glossaryTerm3.getComments().add("COMMENT 3");

        GlossaryTerm glossaryTerm4 = new GlossaryTerm();
        glossaryTerm4.setLocale(LocaleId.DE);
        glossaryTerm4.setContent("TEST DATA 4 DE");
        glossaryTerm4.getComments().add("COMMENT 4");

        glossaryEntry2.getGlossaryTerms().add(glossaryTerm3);
        glossaryEntry2.getGlossaryTerms().add(glossaryTerm4);

        glossary.getGlossaryEntries().add(glossaryEntry1);
        glossary.getGlossaryEntries().add(glossaryEntry2);

        return glossary;
    }
View Full Code Here

TOP

Related Classes of org.zanata.rest.dto.Glossary

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.