Package org.zanata.model

Examples of org.zanata.model.HDocument


        assertRawDocument(newRawDoc, existingDoc.getRawDocument());
    }

    @Test
    public void testCopyTextFlow() throws Exception {
        HDocument dummyDoc = getDummyDocument();
        HTextFlow existingTextFlow = textFlowDAO.findById(1L);
        HTextFlow newTextFlow =
                service.copyTextFlow(dummyDoc, existingTextFlow);

        assertTextFlow(false, existingTextFlow, newTextFlow, dummyDoc);
View Full Code Here


        dummyVersion.setSlug(newVersionSlug);
        return dummyVersion;
    }

    private HDocument getDummyDocument() {
        HDocument dummyDoc = new HDocument();
        dummyDoc.setDocId("dummy-doc");
        return dummyDoc;
    }
View Full Code Here

        HProjectIteration version =
                projectIterationDAO.getBySlug("same-project", "same-version");
        assert version != null;

        HDocument hDoc = version.getDocuments().get("/same/document0");

        HTextFlow textFlow = hDoc.getTextFlows().get(0);
        Optional<HTextFlowTarget> match =
                service.searchBestMatchTransMemory(textFlow,
                        LocaleId.DE,
                        hDoc.getSourceLocaleId(), true, true,
                        true);
        Assert.assertTrue(match.isPresent());
        checkTargetContents(match.get(), "most recent content");
    }
View Full Code Here

                iterationDAO.getBySlug(execution.getProject(), execution.getVersion());

        assert queryProjIter != null;

        // Create the document
        HDocument queryDoc = new HDocument();
        queryDoc.setContentType(ContentType.TextPlain);
        queryDoc.setLocale(sourceLocale);
        queryDoc.setProjectIteration(queryProjIter);
        queryDoc.setFullPath(execution.getDocument());

        // Create the text Flow
        HTextFlow queryTextFlow = new HTextFlow();
        // TODO test that the query textflow is excluded from results
        // (when the query textflow has been persisted and indexed)
View Full Code Here

        makeLocale(LocaleId.ES);
        // makeLocale(new LocaleId("zh"));
        // makeLocale(new LocaleId("ja"));
        // makeLocale(new LocaleId("pl"));

        HDocument oldDoc =
                getEntityMakerBuilder()
                        .reuseEntity(enUS).build()
                        .makeAndPersist(getEm(), HDocument.class);

        HProject theProject = oldDoc.getProjectIteration().getProject();

        copyTransTargetDoc = getEntityMakerBuilder().reuseEntities(theProject,
                enUS).build()
                .makeAndPersist(getEm(), HDocument.class);
        // ensure two documents are from different version but same project
View Full Code Here

            boolean expectHashChange) throws Exception {
        String docHash =
                documentDAO.getTranslatedDocumentStateHash(PROJECT_SLUG,
                        ITERATION_SLUG, DOC_ID, as);
        // Translate something in the document
        HDocument doc =
                documentDAO.getByProjectIterationAndDocId(PROJECT_SLUG,
                        ITERATION_SLUG, DOC_ID);
        mutator.apply(doc);

        // force a flush on the DB
View Full Code Here

        ProjectIterationDAO projectIterationDAO =
                getSeamAutowire().autowire(ProjectIterationDAO.class);
        HProjectIteration iteration =
                projectIterationDAO.getBySlug(projectSlug, iter);
        Map<String, HDocument> allDocuments = iteration.getAllDocuments();
        HDocument hDocument = allDocuments.get(docID);
        // FIXME hDocument is coming back null
        // Assert.assertNotNull(hDocument);
        // Assert.assertTrue(hDocument.isObsolete());
    }
View Full Code Here

        ProjectIterationDAO projectIterationDAO =
                getSeamAutowire().autowire(ProjectIterationDAO.class);
        HProjectIteration iteration =
                projectIterationDAO.getBySlug(projectSlug, iter);
        Map<String, HDocument> allDocuments = iteration.getAllDocuments();
        HDocument hDocument = allDocuments.get(docID);
        // FIXME hDocument is coming back null
        // HTextFlow hResource = hDocument.getAllTextFlows().get(resourceID);
        // Assert.assertNotNull(hResource);
        // Assert.assertTrue(hResource.isObsolete());
    }
View Full Code Here

        String iterSlug = "iterslug";
        boolean requireReview = true;
        HProjectIteration iter = createIter(iterSlug, proj, requireReview);

        List<HTextFlow> textFlows = Arrays.asList(new HTextFlow());
        HDocument doc = createDoc(iter, textFlows);

        when(documentDAO.findById(doc.getId())).thenReturn(doc);

        HLocale de = new HLocale(LocaleId.DE);
        List<HLocale> localeList = Arrays.asList(de);
        when(localeServiceImpl.getSupportedLanguageByProjectIteration(projSlug, iterSlug)).thenReturn(localeList);
View Full Code Here

        verify(copyTransWork).work();
    }

    private HDocument createDoc(HProjectIteration iter,
            List<HTextFlow> textFlows) {
        HDocument doc = new HDocument();
        doc.setId(9999L);
        doc.setProjectIteration(iter);
        doc.setTextFlows(textFlows);
        return doc;
    }
View Full Code Here

TOP

Related Classes of org.zanata.model.HDocument

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.