Package org.zanata.rest.dto.resource

Examples of org.zanata.rest.dto.resource.TranslationsResource


        getZero();
        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        tft1.setRevision(1);
        expectDocs(true, false, doc1);
        expectTarget1(target1);
    }
View Full Code Here


        getZero();
        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        tft1.setRevision(1);
        expectDocs(true, false, doc1);
        expectTarget1(target1);
        Resource doc2 = postDoc2(false);
        doc2.setRevision(1);
        TextFlow tf2 = doc2.getTextFlows().get(0);
        tf2.setRevision(1);
        TranslationsResource target2 = putTarget2();
        TextFlowTarget tft2 = target2.getTextFlowTargets().get(0);
        tft2.setTextFlowRevision(1);
        tft2.setRevision(1);
        expectDocs(true, false, doc1, doc2);
        expectTarget1(target1);
        expectTarget2(target2);
View Full Code Here

        getZero();
        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        Resource doc2 = postDoc2(false);
        doc2.setRevision(1);
        TextFlow tf2 = doc2.getTextFlows().get(0);
        tf2.setRevision(1);
        TranslationsResource target2 = putTarget2();
        TextFlowTarget tft2 = target2.getTextFlowTargets().get(0);
        tft2.setTextFlowRevision(1);
        expectDocs(true, false, doc1, doc2);
        tft1.setRevision(1);
        tft2.setRevision(1);
        expectTarget1(target1);
View Full Code Here

        getZero();
        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        expectDocs(true, false, doc1);
        tft1.setRevision(1);
        expectTarget1(target1);
        deleteDoc1(); // doc1 becomes obsolete
View Full Code Here

        getZero();
        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        tft1.setRevision(1);
        expectDocs(true, false, doc1);
        expectTarget1(target1);
        putDoc1(false); // docRev still 1
View Full Code Here

        getZero();
        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        expectDocs(true, false, doc1);
        tft1.setRevision(1);
        expectTarget1(target1);
        deleteDoc1(); // doc1 becomes obsolete
        getZero();
        dontExpectTarget1();
        Resource doc1a = putDoc1a(false); // doc1 resurrected, rev 2
        doc1a.setRevision(2);
        TextFlow tf1a = doc1a.getTextFlows().get(0);
        tf1a.setRevision(doc1a.getRevision());
        TranslationsResource target1a = putTarget1a();
        TextFlowTarget tft1a = target1a.getTextFlowTargets().get(0);
        tft1a.setTextFlowRevision(tf1a.getRevision());
        tft1a.setRevision(1);
        expectDocs(true, false, doc1a);
        dontExpectTarget1();
        expectTarget1a(target1a);
View Full Code Here

    @Test
    public void putPoPotGet() throws Exception {
        getZero();
        Resource po1 = putPo1();
        expectDocs(false, false, po1);
        TranslationsResource poTarget1 = putPoTarget1();
        expectTarget(false, po1.getName(), DE, poTarget1);
    }
View Full Code Here

        getZero();
        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        tft1.setRevision(1);
        expectDocs(true, false, doc1);
        expectTarget1(target1);
        // this should completely replace doc1's textflow FOOD with HELLO
        Resource doc1a = putDoc1a(false);
        doc1a.setRevision(2);
        TextFlow tf1a = doc1a.getTextFlows().get(0);
        tf1a.setRevision(2);
        TranslationsResource target1a = putTarget1a();
        TextFlowTarget tft1a = target1a.getTextFlowTargets().get(0);
        tft1a.setTextFlowRevision(2);
        tft1a.setRevision(1);
        expectDocs(true, false, doc1a);
        dontExpectTarget1();
        expectTarget1a(target1a);
View Full Code Here

        // Get the translations with PO headers
        ClientResponse<TranslationsResource> response =
                transResource.getTranslations("my.txt", de_DE, new StringSet(
                        "gettext"), true, null);

        TranslationsResource translations = response.getEntity();
        assertThat(translations.getExtensions().size(), greaterThan(0));

        // List of custom Zanata headers that should be present
        final String[] requiredHeaders =
                new String[] { HeaderFields.KEY_LastTranslator,
                        HeaderFields.KEY_PoRevisionDate,
                        HeaderFields.KEY_LanguageTeam, "X-Generator",
                        HeaderFields.KEY_Language };

        for (String reqHeader : requiredHeaders) {
            boolean headerFound = false;
            for (HeaderEntry entry : translations.getExtensions()
                    .findByType(PoTargetHeader.class).getEntries()) {
                if (entry.getKey().equals(reqHeader)) {
                    headerFound = true;
                }
            }

            assertThat("PO Target Header '" + reqHeader
                    + "' was not present when pulling translations.",
                    headerFound, is(true));
        }

        // Since it is a first push with no headers, the Last Translator and
        // Last Revision Date header should be empty
        for (HeaderEntry entry : translations.getExtensions()
                .findByType(PoTargetHeader.class).getEntries()) {
            if (entry.getKey().equals(HeaderFields.KEY_LastTranslator)
                    || entry.getKey().equals(HeaderFields.KEY_PoRevisionDate)) {
                assertThat(entry.getValue().trim(), is(""));
            }
View Full Code Here

        // Get the translations with PO headers
        ClientResponse<TranslationsResource> response =
                transResource.getTranslations("my.txt", de_DE, new StringSet(
                        "gettext"), true, null);

        TranslationsResource translations = response.getEntity();
        assertThat(translations.getTextFlowTargets().size(), is(0)); // Expecting
                                                                     // no
                                                                     // translations

        // Make sure the headers are populated
        PoTargetHeader header =
                translations.getExtensions(true).findByType(
                        PoTargetHeader.class);
        assertThat(header, notNullValue());
        assertThat(header.getEntries().size(), greaterThan(0));

        // Make sure the header values are empty since the system does not have
View Full Code Here

TOP

Related Classes of org.zanata.rest.dto.resource.TranslationsResource

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.