Examples of AppCollection


Examples of org.apache.wink.common.model.app.AppCollection

    private void addCollection(AppWorkspace workspace,
                               ServiceDocumentCollectionData serviceDocumentCollection,
                               String baseUri) {

        // new collection
        AppCollection collection = new AppCollection();

        List<AppCollection> workspaceCollectionList = workspace.getCollection();

        // Set URI
        String href = UriHelper.appendPathToBaseUri(baseUri, serviceDocumentCollection.getUri());
        collection.setHref(href);

        // Set Title
        AtomText title = new AtomText();
        // title.setType();
        title.setValue(serviceDocumentCollection.getTitle());
        collection.setTitle(title);

        // Add Accept Media Types
        List<AppAccept> acceptMediaTypes = collection.getAccept();
        if (serviceDocumentCollection.getAccepts().isEmpty()) {
            AppAccept appAccept = new AppAccept();
            acceptMediaTypes.add(appAccept);
        } else {
            for (MediaType acceptMediaType : serviceDocumentCollection.getAccepts()) {
View Full Code Here

Examples of org.apache.wink.common.model.app.AppCollection

            // Find workspace by it's title
            AppWorkspace workspace = service.getWorkspace(WORKSPACE_TITLE);

            // Find collection by title
            AppCollection collection = workspace.getCollection(COLLECTION_TITLE);
            String href = collection.getHref();

            // Get collection of defects
            Resource feedResource = restClient.resource(href);
            AtomFeed feed = feedResource.accept(MediaType.APPLICATION_ATOM_XML).get(AtomFeed.class);
View Full Code Here

Examples of org.apache.wink.common.model.app.AppCollection

    private void addCollection(AppWorkspace workspace,
                               ServiceDocumentCollectionData serviceDocumentCollection,
                               String baseUri) {

        // new collection
        AppCollection collection = new AppCollection();

        List<AppCollection> workspaceCollectionList = workspace.getCollection();

        // Set URI
        String href = UriHelper.appendPathToBaseUri(baseUri, serviceDocumentCollection.getUri());
        collection.setHref(href);

        // Set Title
        AtomText title = new AtomText();
        // title.setType();
        title.setValue(serviceDocumentCollection.getTitle());
        collection.setTitle(title);

        // Add Accept Media Types
        List<AppAccept> acceptMediaTypes = collection.getAccept();
        if (serviceDocumentCollection.getAccepts().isEmpty()) {
            AppAccept appAccept = new AppAccept();
            acceptMediaTypes.add(appAccept);
        } else {
            for (MediaType acceptMediaType : serviceDocumentCollection.getAccepts()) {
View Full Code Here

Examples of org.apache.wink.common.model.app.AppCollection

        MockHttpServletResponse response = invoke(request);
        assertEquals("status", HttpStatus.OK.getCode(), response.getStatus());
        String contentString = response.getContentAsString();
        AppService service = AppService.unmarshal(new StringReader(contentString));
        AppWorkspace workspace = service.getWorkspace().get(0);
        AppCollection collection = workspace.getCollection().get(0);
        String href = collection.getHref();
        assertTrue("ipv6 URI: " + href, href.startsWith(http));
    }
View Full Code Here

Examples of org.apache.wink.common.model.app.AppCollection

        MockHttpServletResponse response = invoke(request);
        assertEquals("status", HttpStatus.OK.getCode(), response.getStatus());
        String contentString = response.getContentAsString();
        AppService service = AppService.unmarshal(new StringReader(contentString));
        AppWorkspace workspace = service.getWorkspace().get(0);
        AppCollection collection = workspace.getCollection().get(0);
        String href = collection.getHref();
        assertTrue("ipv6 URI: " + href, href.startsWith(https));
    }
View Full Code Here

Examples of org.apache.wink.common.model.app.AppCollection

    private void assertCollections(List<AppCollection> expectedcollections,
                                   List<AppCollection> collections) {
        assertEquals(expectedcollections.size(), collections.size());
        for (int i = 0; i < expectedcollections.size(); ++i) {
            AppCollection expectedCollection = expectedcollections.get(i);
            AppCollection collection = collections.get(i);

            assertEquals(expectedCollection.getLang(), collection.getLang());
            assertEquals(expectedCollection.getBase(), collection.getBase());
            assertEquals(expectedCollection.getHref(), collection.getHref());
            assertEquals(expectedCollection.getTitle().getType(), collection.getTitle().getType());
            assertEquals(expectedCollection.getTitle().getValue(), collection.getTitle().getValue());
            assertEquals(expectedCollection.getOtherAttributes()
                .get(new QName("anyAttirbCollection")), collection.getOtherAttributes()
                .get(new QName("anyAttirbCollection")));

            List<AppAccept> expectedAccepts = expectedCollection.getAccept();
            List<AppAccept> accepts = collection.getAccept();
            assertEquals(expectedAccepts.size(), accepts.size());
            assertEquals(expectedAccepts.get(0).getValue(), accepts.get(0).getValue());
            assertEquals(expectedAccepts.get(1).getValue(), accepts.get(1).getValue());

            List<AppCategories> expectedCategories = expectedCollection.getCategories();
            List<AppCategories> categories = collection.getCategories();
            assertEquals(expectedCategories.size(), categories.size());

            assertNull(categories.get(0).getHref());
            assertEquals(expectedCategories.get(0).getScheme(), categories.get(0).getScheme());
            assertEquals(expectedCategories.get(0).getFixed(), categories.get(0).getFixed());
View Full Code Here

Examples of org.apache.wink.common.model.app.AppCollection

        return ws;
    }

    private AppCollection getCollection(String id) {
        AppCollection col = new AppCollection();
        col.setLang("en-us");
        col.setBase("http://base/collection");
        col.setTitle(new AtomText("collection" + id));
        col.getOtherAttributes().put(new QName("anyAttirbCollection"), "anyAttribValueCollection");
        col.setHref("href" + id);

        AppAccept accept1 = new AppAccept();
        accept1.setValue("accept1");
        AppAccept accept2 = new AppAccept();
        accept2.setValue("accept2");
        col.getAccept().add(accept1);
        col.getAccept().add(accept2);

        col.getCategories().add(getInlineCategories());
        col.getCategories().add(getOutOfLineCategories());

        return col;
    }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.atom.app.AppCollection

        AppService service = new AppService();

        AppWorkspace workspace1 = new AppWorkspace();
        workspace1.setTitle("Main Site");
        AppCollection collection1 = new AppCollection();
        collection1.setHref("http://example.org/blog/main");
        collection1.setTitle("My Blog Entries");
        AppCategories categories1 = new AppCategories();
        categories1.setHref("http://example.com/cats/forMain.cats");
        collection1.getCategories().add(categories1);
        workspace1.getCollection().add(collection1);

        AppCollection collection2 = new AppCollection();
        collection2.setHref("http://example.org/blog/pic");
        collection2.setTitle("Pictures");
        AppAccept accept1 = new AppAccept();
        accept1.setContent("image/png");
        collection2.getAccept().add(accept1);
        AppAccept accept2 = new AppAccept();
        accept2.setContent("image/jpg");
        collection2.getAccept().add(accept2);
        AppAccept accept3 = new AppAccept();
        accept3.setContent("image/gif");
        collection2.getAccept().add(accept3);
        workspace1.getCollection().add(collection2);

        service.getWorkspace().add(workspace1);

        AppWorkspace workspace2 = new AppWorkspace();
        workspace1.setTitle("Sidebar Blog");
        AppCollection collection3 = new AppCollection();
        collection3.setHref("http://example.org/sidebar/list");
        collection3.setTitle("Remaindered Links");
        AppAccept accept4 = new AppAccept();
        accept4.setContent("application/atom+xml;type=entry");
        collection3.getAccept().add(accept4);
        AppCategories categories3 = new AppCategories();
        categories3.setFixed(true);
        Category category1 = new Category();
        category1.setScheme(new URI("http://example.org/extra-cats/"));
        category1.setTerm("joke");
        categories3.getCategory().add(category1);
        Category category2 = new Category();
        category2.setScheme(new URI("http://example.org/extra-cats/"));
        category2.setTerm("serious");
        categories3.getCategory().add(category2);

        collection3.getCategories().add(categories3);
        workspace2.getCollection().add(collection3);

        service.getWorkspace().add(workspace2);

        StringWriter writer = new StringWriter();
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.atom.app.AppCollection

    /**
     * Create an instance of {@link AppCollection }
     *
     */
    public AppCollection createAppCollection() {
        return new AppCollection();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.