Package org.apache.wink.common.model.app

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


            // 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

    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

        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

        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

    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

        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

TOP

Related Classes of org.apache.wink.common.model.app.AppCollection

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.