Package org.zanata.rest.dto.resource

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


        List<ResourceMeta> resources = new ArrayList<ResourceMeta>();

        for (HDocument doc : hProjectIteration.getDocuments().values()) {

            ResourceMeta resource = new ResourceMeta();
            resourceUtils.transferToAbstractResourceMeta(doc, resource);
            resources.add(resource);
        }

        Type genericType = new GenericType<List<ResourceMeta>>() {
View Full Code Here


        List<ResourceMeta> resources = new ArrayList<ResourceMeta>();

        for (HDocument doc : hProjectIteration.getDocuments().values()) {
            // TODO we shouldn't need this check
            if (!doc.isObsolete()) {
                ResourceMeta resource = new ResourceMeta();
                resourceUtils.transferToAbstractResourceMeta(doc, resource);
                resources.add(resource);
            }
        }
View Full Code Here

        if (doc == null) {
            return Response.status(Response.Status.NOT_FOUND)
                    .entity("document not found").build();
        }

        ResourceMeta entity = new ResourceMeta(doc.getDocId());
        resourceUtils.transferToAbstractResourceMeta(doc, entity);

        // transfer extensions
        resourceUtils.transferToResourceExtensions(doc,
                entity.getExtensions(true), extensions);

        log.debug("successfuly get resource meta: {}", entity);
        return Response.ok().entity(entity).tag(etag).build();
    }
View Full Code Here

        sourceDocResource.putResource(docUri, resource, null);

        ClientResponse<ResourceMeta> response =
                sourceDocResource.getResourceMeta(docUri, null);
        assertThat(response.getResponseStatus(), is(Status.OK));
        ResourceMeta doc = response.getEntity();
        assertThat(doc.getName(), is(docName));
        assertThat(doc.getContentType(), is(ContentType.TextPlain));
        assertThat(doc.getLang(), is(LocaleId.EN_US));
        assertThat(doc.getRevision(), is(1));

        /*
         * Link link = doc.getLinks().findLinkByRel(Relationships.SELF);
         * assertThat( link, notNullValue() ); assertThat(
         * URIUtil.decode(link.getHref().toString()), endsWith(url+docUri) );
View Full Code Here

        stf.getExtensions(true).add(potEntryHeader);
        return sr;
    }

    public ResourceMeta getResourceMeta() {
        ResourceMeta entity = new ResourceMeta();
        entity.setContentType(ContentType.TextPlain);
        entity.setName("test1");
        entity.setLang(new LocaleId("en-US"));
        entity.setType(ResourceType.FILE);
        entity.getExtensions(true);
        log.debug("create a new resource meta:" + entity.toString());
        return entity;
    }
View Full Code Here

        log.debug("create a new resource meta:" + entity.toString());
        return entity;
    }

    public ResourceMeta getPoHeaderResourceMeta() {
        ResourceMeta entity = getResourceMeta();
        entity.getExtensions(true).add(
                new PoHeader("comment", new HeaderEntry("ref", "test ref")));
        log.debug("create a new resource meta:" + entity.toString());
        return entity;
    }
View Full Code Here

                        .autowire(ResourceUtils.class);
    }

    @Test
    void transferFromResourceMetadata() {
        ResourceMeta from = new ResourceMeta("resId");
        from.setContentType(ContentType.TextPlain);
        PoHeader poHeader = new PoHeader();
        poHeader.setComment("comment");
        poHeader.getEntries().add(new HeaderEntry("key", "value"));
        from.getExtensions(true).add(poHeader);
        from.setLang(LocaleId.ES);
        from.setName("name");
        from.setType(ResourceType.FILE);

        HLocale hLocale = new HLocale(LocaleId.EN_US);

        HDocument to = new HDocument("fullPath", ContentType.PO, hLocale);
View Full Code Here

    public void testPutGetResourceMeta() {
        log.debug("test put get resource meta service");
        Resource res = resourceTestFactory.getTextFlowTest();
        sourceDocResource.putResource(res.getName(), res, new StringSet(
                "gettext;comment"));
        ResourceMeta sr = resourceTestFactory.getPoHeaderResourceMeta();
        sourceDocResource.putResourceMeta(sr.getName(), sr, new StringSet(
                "gettext;comment"));
        log.debug("get resource meta");
        ClientResponse<ResourceMeta> resourceGetResponse =
                sourceDocResource.getResourceMeta(sr.getName(), new StringSet(
                        "gettext;comment"));
        ResourceMeta get = resourceGetResponse.getEntity();
        ResourceTestUtil.clearRevs(sr);
        ResourceTestUtil.clearRevs(get);
        assertThat(sr.toString(), is(get.toString()));
    }
View Full Code Here

    public void testPutNoExtensionGetResourceMeta() {
        log.debug("test put get resource meta service");
        Resource res = resourceTestFactory.getTextFlowTest();
        sourceDocResource.putResource(res.getName(), res, null);
        ResourceMeta sr = resourceTestFactory.getPoHeaderResourceMeta();
        ResourceMeta base = resourceTestFactory.getResourceMeta();
        sourceDocResource.putResourceMeta(sr.getName(), sr, null);
        log.debug("get resource meta");
        ClientResponse<ResourceMeta> resourceGetResponse =
                sourceDocResource.getResourceMeta(sr.getName(), new StringSet(
                        "gettext;comment"));
        ResourceMeta get = resourceGetResponse.getEntity();
        ResourceTestUtil.clearRevs(base);
        ResourceTestUtil.clearRevs(get);
        assertThat(get.toString(), is(base.toString()));
    }
View Full Code Here

    public void testPutGetNoExtensionResourceMeta() {
        log.debug("test put get resource meta service");
        Resource res = resourceTestFactory.getTextFlowTest();
        sourceDocResource.putResource(res.getName(), res, null);
        ResourceMeta sr = resourceTestFactory.getPoHeaderResourceMeta();
        ResourceMeta base = resourceTestFactory.getResourceMeta();
        sourceDocResource.putResourceMeta(sr.getName(), sr, new StringSet(
                "gettext;comment"));
        log.debug("get resource meta");
        ClientResponse<ResourceMeta> resourceGetResponse =
                sourceDocResource.getResourceMeta(sr.getName(), null);
        ResourceMeta get = resourceGetResponse.getEntity();
        ResourceTestUtil.clearRevs(base);
        ResourceTestUtil.clearRevs(get);
        assertThat(get.toString(), is(base.toString()));
    }
View Full Code Here

TOP

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

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.