Package org.zanata.model

Examples of org.zanata.model.HLocale


        Assertions.assertThat(histories).hasSize(numOfTextFlowsHavingTarget);
    }

    private static HLocale createAndPersistLocale(LocaleId localeId,
            EntityManager entityManager) {
        HLocale hLocale = new HLocale(localeId, true, true);
        entityManager.persist(hLocale);
        return hLocale;
    }
View Full Code Here


        copyTransService = seam.autowire(CopyTransServiceImpl.class);

        deleteAll(getEm(), ZanataEntities.entitiesForRemoval());

        HLocale enUS = makeLocale(LocaleId.EN_US);
        HLocale de = makeLocale(LocaleId.DE);
        makeLocale(LocaleId.FR);
        makeLocale(LocaleId.ES);
        // makeLocale(new LocaleId("zh"));
        // makeLocale(new LocaleId("ja"));
        // makeLocale(new LocaleId("pl"));
View Full Code Here

                new ClassLoaderResourceAccessor(), database);
        liquibase.update(null);
    }

    private HLocale makeLocale(LocaleId localeId) {
        HLocale hLocale = new HLocale(localeId);
        hLocale.setActive(true);
        hLocale.setEnabledByDefault(true);
        getEm().persist(hLocale);
        return hLocale;
    }
View Full Code Here

     * This test method is no longer relevant. HLocaleMember entities are no
     * longer restricted to authenticated users.
     */
    // @Test(expected = NotLoggedInException.class)
    public void failSaveWhenNotLoggedIn() throws Exception {
        HLocale locale = entityManager.find(HLocale.class, new Long(1));
        HAccount account = entityManager.find(HAccount.class, new Long(1));

        assertThat(locale, notNullValue());
        assertThat(account, notNullValue());

View Full Code Here

        Identity identity = Identity.instance();
        identity.getCredentials().setUsername("admin");
        identity.getCredentials().setPassword("admin");
        identity.login();

        HLocale locale = entityManager.find(HLocale.class, new Long(1));
        HAccount account = entityManager.find(HAccount.class, new Long(1));

        assertThat(locale, notNullValue());
        assertThat(account, notNullValue());
View Full Code Here

    }

    @Test
    public void testFindByLocale() {
        log.debug("testFindByLocale");
        HLocale hl = dao.findByLocaleId(new LocaleId("de"));
        assertThat(hl.getLocaleId().getId(), is("de"));
    }
View Full Code Here

        this.testLocaleServiceImpl.setProjectIterationDAO(projectIterationDAO);
        this.testLocaleServiceImpl.setProjectDAO(projectDAO);
        this.testLocaleServiceImpl.setLocaleDAO(localeDAO);

        Set<HLocale> iterationLocales = new HashSet<HLocale>();
        iterationLocales.add(new HLocale(LocaleId.EN_US));
        iterationLocales.add(new HLocale(LocaleId.DE));

        when(hProjectIteration.getId()).thenReturn(1L);
        when(hProjectIteration.getCustomizedLocales()).thenReturn(
                iterationLocales);
        when(projectIterationDAO.getBySlug(projectSlug, versionSlug))
                .thenReturn(hProjectIteration);

        Set<HLocale> projectLocales = new HashSet<HLocale>();
        projectLocales.add(new HLocale(LocaleId.ES));
        when(hProject.getId()).thenReturn(1L);
        when(hProject.getCustomizedLocales()).thenReturn(projectLocales);
        when(projectDAO.getBySlug(projectSlug)).thenReturn(hProject);

        List<HLocale> defaultLocales = new ArrayList<HLocale>();
        defaultLocales.add(new HLocale(LocaleId.FR));
        defaultLocales.add(new HLocale(LocaleId.EN));
        defaultLocales.add(new HLocale(LocaleId.DE));
        when(localeDAO.findAllActiveAndEnabledByDefault()).thenReturn(
                defaultLocales);
    }
View Full Code Here

    }

    @Test
    public void testGetAllSupportedLanguages() {
        List<HLocale> lan = new ArrayList<HLocale>();
        lan.add(new HLocale(new LocaleId("as-IN")));
        lan.add(new HLocale(new LocaleId("pt-BR")));
        when(localeDAO.findAll()).thenReturn(lan);
        List<HLocale> sup = testLocaleServiceImpl.getAllLocales();
        Assert.assertEquals(sup.size(), 2);
        String loc1 = sup.get(0).getLocaleId().getId();
        Assert.assertEquals(loc1, "as-IN");
View Full Code Here

        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);

        when(copyTransWorkFactory
                .createCopyTransWork(any(HLocale.class),
View Full Code Here

        to.setRevision(originalTFRevision);
        HTextFlow originalTF = new HTextFlow(to, "id", "original text");
        originalTF.setRevision(originalTFRevision);

        // target locales that will have new, fuzzy and approved targets
        HLocale newLoc, fuzzyLoc, apprLoc;
        newLoc = new HLocale(LocaleId.DE);
        fuzzyLoc = new HLocale(LocaleId.FR);
        apprLoc = new HLocale(LocaleId.ES);
        // Target Locale ids
        Long newLocId = 1L, fuzzyLocId = 2L, apprLocId = 3L;

        HTextFlowTarget newTarg, fuzzyTarg, apprTarg;
        newTarg = new HTextFlowTarget(originalTF, newLoc);
View Full Code Here

TOP

Related Classes of org.zanata.model.HLocale

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.