Package org.zanata.util

Examples of org.zanata.util.ZanataRestCaller


    public void concurrentDocumentCreationWillNotCauseHibernateException()
            throws InterruptedException {
        final String projectSlug = "project";
        final String iterationSlug = "master";
        final AtomicInteger counter = new AtomicInteger(1);
        new ZanataRestCaller().createProjectAndVersion(projectSlug,
                iterationSlug, "gettext");

        int threadCount = 5;
        Callable<Integer> task = new Callable<Integer>() {

            @Override
            public Integer call() throws Exception {
                int suffix = counter.getAndIncrement();
                return new ZanataRestCaller().postSourceDocResource(
                        projectSlug, iterationSlug, buildResource(suffix),
                        false);
            }
        };
        List<Callable<Integer>> tasks = Collections.nCopies(threadCount, task);
View Full Code Here


    private ZanataRestCaller restCaller;

    @Before
    public void setUp() {
        restCaller = new ZanataRestCaller();
    }
View Full Code Here

    private String documentStorageDirectory;

    @Before
    public void before() {
        new BasicWorkFlow().goToHome().deleteCookiesAndRefresh();
        zanataRestCaller = new ZanataRestCaller();
        zanataRestCaller.createProjectAndVersion("uploadtest",
                "txt-upload", "file");
        documentStorageDirectory = CleanDocumentStorageRule
                .getDocumentStoragePath()
                .concat(File.separator)
View Full Code Here

    public static CleanDocumentStorageRule documentStorageRule =
            new CleanDocumentStorageRule();

    @Before
    public void before() {
        new ZanataRestCaller().createProjectAndVersion("doctype-test",
                "doctype-upload", "File");
        new LoginWorkFlow().signIn("admin", "admin");
    }
View Full Code Here

    private String documentStorageDirectory;

    @Before
    public void before() {
        new BasicWorkFlow().goToHome().deleteCookiesAndRefresh();
        zanataRestCaller = new ZanataRestCaller();
        zanataRestCaller.createProjectAndVersion("multi-upload", "multi-upload",
            "file");
        documentStorageDirectory = CleanDocumentStorageRule
                .getDocumentStoragePath()
                .concat(File.separator)
View Full Code Here

    private DashboardBasePage dashboard;

    @Before
    public void setUp() {
        ZanataRestCaller restCaller = new ZanataRestCaller();
        Resource resource =
                buildSourceResource("a", buildTextFlow("res1", "content"));
        // create 6 activities
        for (int i = 0; i < 6; i++) {
            String projectSlug = "activity" + i;
            String iterationSlug = "v" + i;
            restCaller.createProjectAndVersion(projectSlug, iterationSlug,
                    "gettext");
            restCaller.postSourceDocResource(projectSlug, iterationSlug,
                    resource, false);
        }
        dashboard = new LoginWorkFlow().signIn("admin", "admin");
    }
View Full Code Here

                .saveGroup()
                .goToGroup(groupName);
    }

    private void createProject() {
        restCaller = new ZanataRestCaller();
        // create another project and version
        String projectSlug = "base";
        String iterationSlug = "master";
        String projectType = "gettext";
        restCaller.createProjectAndVersion(projectSlug, iterationSlug,
View Full Code Here

        plDir.mkdirs();
        Files.copy(new File(projectRootPath + "/pot", "test.pot"), new File(
                potDir, "test.pot"));
        Files.copy(new File(projectRootPath + "/pl", "test.po"), new File(
                plDir, "test.po"));
        restCaller = new ZanataRestCaller();
    }
View Full Code Here

    @Feature(summary = "A non-maintainer user may not push to a project",
            tcmsTestPlanIds = 5316, tcmsTestCaseIds = 91146)
    @Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
    public void nonProjectMaintainerCanNotPush() {
        // admin creates the project
        ZanataRestCaller adminRestCaller = new ZanataRestCaller();
        adminRestCaller.createProjectAndVersion("plurals", "master", "podir");

        // translator tries to push
        List<String> output =
                client.callWithTimeout(projectRootPath,
                        "mvn -B zanata:push -Dzanata.userConfig="
View Full Code Here

    @Feature(summary = "The system will run CopyTrans when a push occurs",
            tcmsTestPlanIds = 5316, tcmsTestCaseIds = 91869)
    @Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
    public void pushTransAndCopyTransTest() {
        // translator creates the project and become maintainer
        ZanataRestCaller restCaller =
                new ZanataRestCaller("translator",
                        PropertiesHolder.getProperty(
                                Constants.zanataTranslatorKey.value()));
        restCaller.createProjectAndVersion("plurals", "master", "podir");
        List<String> output =
                client.callWithTimeout(projectRootPath,
                        "mvn -B zanata:push -Dzanata.copyTrans=false -Dzanata.userConfig="
                                + translatorConfig);

        assertThat(client.isPushSuccessful(output)).isTrue();

        new LoginWorkFlow().signIn("admin", "admin");
        VersionLanguagesPage versionPage =
                new BasicWorkFlow().goToPage(String.format(
                        PROJECT_VERSION_TEMPLATE, "plurals", "master"),
                        VersionLanguagesPage.class);
        assertThat(versionPage.getStatisticsForLocale("pl"))
                .contains("0.0%");

        // push trans
        client.callWithTimeout(
                projectRootPath,
                "mvn -B zanata:push -Dzanata.pushType=trans -Dzanata.copyTrans=false -Dzanata.userConfig="
                        + translatorConfig);

        versionPage.reload();
        assertThat(versionPage.getStatisticsForLocale("pl")).contains("6.0%");

        // create new version
        restCaller.createProjectAndVersion("plurals", "beta", "podir");
        File updatedZanataXml = new File(Files.createTempDir(), "zanata.xml");
        generateZanataXml(updatedZanataXml, "plurals", "beta", "podir",
                Lists.newArrayList("pl"));
        // push source and run copyTrans
        client.callWithTimeout(
View Full Code Here

TOP

Related Classes of org.zanata.util.ZanataRestCaller

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.