Package org.apache.abdera.model

Examples of org.apache.abdera.model.Workspace


            Document<Service> doc = res.getDocument();
            Service service = doc.getRoot();
            assertEquals(1, service.getWorkspaces().size());

            Workspace workspace = service.getWorkspaces().get(0);
            assertEquals(1, workspace.getCollections().size());

            // Keep the loop in case we add other collections to the test.

            for (Collection collection : workspace.getCollections()) {
                if (collection.getTitle().equals("Acme Customer Database")) {
                    String expected = uri + "customers";
                    String actual = collection.getResolvedHref().toString();
                    assertEquals(expected, actual);
                }
View Full Code Here


        return list;
    }

    public Workspace getWorkspace(String title) {
        List<Workspace> workspaces = getWorkspaces();
        Workspace workspace = null;
        for (Workspace w : workspaces) {
            if (w.getTitle().equals(title)) {
                workspace = w;
                break;
            }
View Full Code Here

    }

    public Workspace addWorkspace(String title) {
        complete();
        FOMFactory fomfactory = (FOMFactory)factory;
        Workspace workspace = fomfactory.newWorkspace(this);
        workspace.setTitle(title);
        return workspace;
    }
View Full Code Here

        return workspace;
    }

    public Collection getCollection(String workspace, String collection) {
        Collection col = null;
        Workspace w = getWorkspace(workspace);
        if (w != null) {
            col = w.getCollection(collection);
        }
        return col;
    }
View Full Code Here

    public void setTitle(String title) {
        this.title = title;
    }

    public Workspace asWorkspaceElement(RequestContext request) {
        Workspace workspace = request.getAbdera().getFactory().newWorkspace();
        workspace.setTitle(getTitle(null));
        for (CollectionInfo collection : getCollections(request))
            workspace.addCollection(collection.asCollectionElement(request));
        return workspace;
    }
View Full Code Here

            return false;
        return true;
    }

    public Workspace asWorkspaceElement(RequestContext request) {
        Workspace workspace = request.getAbdera().getFactory().newWorkspace();
        workspace.setTitle(title);
        for (CollectionInfo collection : this.collections)
            workspace.addCollection(collection.asCollectionElement(request));
        return workspace;
    }
View Full Code Here

    @Test
    public void testCollectionAccepts() throws Exception {
        Abdera abdera = new Abdera();
        Factory factory = abdera.getFactory();
        Service svc = factory.newService();
        Workspace ws = svc.addWorkspace("test-ws");
        Collection coll = ws.addCollection("test-coll", ws.getTitle() + "/test-coll");
        coll.setAcceptsEntry();
        assertTrue("Collection does not accept entries.", coll.acceptsEntry());
        coll.addAccepts("application/apples");
        assertTrue("Collection does not accept apples.", coll.accepts("application/apples"));
        StringWriter sw = new StringWriter();
View Full Code Here

    @Test
    public void testCollectionAcceptsMultipart() throws Exception {
        Abdera abdera = new Abdera();
        Factory factory = abdera.getFactory();
        Service svc = factory.newService();
        Workspace ws = svc.addWorkspace("test-ws");
        FOMMultipartCollection coll =
            (FOMMultipartCollection)ws.addMultipartCollection("test multipart coll", "/test-coll");
        coll.setAcceptsEntry();
        coll.addAccepts("image/*", "multipart-related");

        assertTrue("Collection does not accept entries.", coll.acceptsEntry());
        assertTrue("Collection does not accept multipart related images", coll.acceptsMultipart("image/*"));
 
View Full Code Here

        assertEquals(ResponseType.SUCCESS, resp.getType());
        assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.APP_MEDIA_TYPE));
        Document<Service> doc = resp.getDocument();
        Service service = doc.getRoot();
        assertEquals(1, service.getWorkspaces().size());
        Workspace workspace = service.getWorkspace("Abdera");
        assertEquals(1, workspace.getCollections().size());
        Collection collection = workspace.getCollection("title for any sample feed");
        assertNotNull(collection);
        assertTrue(collection.acceptsEntry());
        assertEquals("http://localhost:9002/sample", collection.getResolvedHref().toString());
        resp.release();
    }
View Full Code Here

        } catch (Exception e) {
        }
        Service service = doc.getRoot();
        prettyPrint(service);
        assertEquals(1, service.getWorkspaces().size());
        Workspace workspace = service.getWorkspaces().get(0);
        assertEquals(1, workspace.getCollections().size());
        Collection collection = workspace.getCollections().get(0);
        assertEquals(BASE + "/feed", collection.getResolvedHref().toString());
        assertEquals("A simple feed", collection.getTitle().toString());
        resp.release();
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Workspace

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.