Package org.zanata.service

Examples of org.zanata.service.TranslationFinder


        sourceLocale = localeDAO.findByLocaleId(LocaleId.EN_US);
    }

    @Test
    public void testTextFlowTargetDAOMostRecent() {
        TranslationFinder service = seam.autowire(TextFlowTargetDAO.class);
        testMostRecentMatch(service);
    }
View Full Code Here


        testMostRecentMatch(service);
    }

    @Test
    public void testTranslationMemoryServiceImplMostRecent() throws Exception {
        TranslationFinder service = seam.autowire(TranslationMemoryServiceImpl.class);
        testMostRecentMatch(service);
    }
View Full Code Here

        testExecution(TranslationMemoryServiceImpl.class, execution);
    }


    private void testExecution(Class<? extends TranslationFinder> impl, Execution execution) {
        TranslationFinder service = seam.autowire(impl);
        // Prepare Execution
        ProjectIterationDAO iterationDAO =
                seam.autowire(ProjectIterationDAO.class);

        // Get the project iteration
        HProjectIteration queryProjIter =
                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)
        queryTextFlow.setId(-999L);
        queryTextFlow.setContents(execution.getContent()); // Source content matches
        queryTextFlow.setPlural(false);
        queryTextFlow.setObsolete(false);
        queryTextFlow.setDocument(queryDoc);
        queryTextFlow.setResId(execution.getContext());

        // For all the executions whose queries are expected to find a match,
        // the target which is expected to match is HTextFlowTarget 100
        // (which belongs to HTextFlow 100, HDocument 100,
        // HProjectIteration 100, HProject 100)

        Optional<HTextFlowTarget> matchingTarget =
                service.searchBestMatchTransMemory(
                        queryTextFlow, LocaleId.DE, LocaleId.EN_US,
                        execution.isCheckContext(), execution.isCheckDocument(),
                        execution.isCheckProject());

        assertThat(matchingTarget.isPresent()).as("match present").isEqualTo(
View Full Code Here

TOP

Related Classes of org.zanata.service.TranslationFinder

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.