Examples of MIMETypedStream


Examples of org.fcrepo.server.types.gen.MIMETypedStream

    }

    public static void getDissemination() throws Exception {
   
    // test dissemination of the Default Disseminator
    MIMETypedStream diss = null;
    diss = APIA.getDissemination("demo:5", "fedora-system:3", "viewDublinCore", new Property[0], null);
    System.out.println("SOAP Request: getDissemination for method viewDublinCore of demo object demo:11...");   
    String dsXML = new String(diss.getStream(), "UTF-8");
    System.out.println("SOAP Response: GetDissemination Object:demo:11 Method:viewDublinCore succeeded.");
    System.out.println("SOAP Response: Dissemination results: \n"+dsXML);   
   
    // test dissemination of getThumb method with no parameters
    diss = APIA.getDissemination("demo:5", "demo:1", "getThumbnail", new Property[0], null);
View Full Code Here

Examples of org.fcrepo.server.types.mtom.gen.MIMETypedStream

        return bytesRead;
    }

    private long exportAPIA(String dsId) throws Exception {
        MIMETypedStream fileStream = null;
        try {
            fileStream = apia.getDatastreamDissemination(pid, dsId, null);
        } catch (Exception e) {
            if (e.getMessage().indexOf("The datastream you are attempting " +
                                       "to retrieve is too large") > 0) {
                System.out.println("  Expected error generated in API-A export:");
                System.out.println("    Error text: " + e.getMessage());
                return -1;
            } else {
                fail("  Unexpected exception encountered in exportAPIA: " +
                     e.getMessage());
            }
        }

        return TypeUtility.convertDataHandlerToBytes(fileStream.getStream()).length;
    }
View Full Code Here

Examples of org.fcrepo.server.types.mtom.gen.MIMETypedStream

        assertEquals("demo:5", fields.get(0).getPid().getValue());
    }

    @Test
    public void testGetDatastreamDissemination() throws Exception {
        MIMETypedStream ds = null;

        // test for type X datastream
        ds = apia.getDatastreamDissemination("demo:5", "DC", null);
        byte[] bytes = TypeUtility.convertDataHandlerToBytes(ds.getStream());
        String xml = new String(bytes, "UTF-8");
        assertXpathExists("/oai_dc:dc", xml);
        assertXpathEvaluatesTo("demo:5",
                               "/oai_dc:dc/dc:identifier/text( )",
                               xml);
        assertEquals(ds.getMIMEType(), "text/xml");

        // test for type E datastream
        ds =
                apia.getDatastreamDissemination("demo:SmileyBeerGlass",
                                                "MEDIUM_SIZE",
                                                null);
        bytes = TypeUtility.convertDataHandlerToBytes(ds.getStream());
        assertEquals(ds.getMIMEType(), "image/jpeg");
        assertTrue(bytes.length > 0);

        // test for type R datastream
        ds = apia.getDatastreamDissemination("demo:31", "DS3", null);
        assertEquals(ds.getMIMEType(), "application/fedora-redirect");

        // test for type M datastream
        ds = apia.getDatastreamDissemination("demo:5", "THUMBRES_IMG", null);
        bytes = TypeUtility.convertDataHandlerToBytes(ds.getStream());
        assertEquals(ds.getMIMEType(), "image/jpeg");
        assertTrue(bytes.length > 0);
    }
View Full Code Here

Examples of org.fcrepo.server.types.mtom.gen.MIMETypedStream

        assertTrue(bytes.length > 0);
    }

    @Test
    public void testGetDisseminationDefault() throws Exception {
        MIMETypedStream diss = null;
        Parameters params = new Parameters();
        diss =
                apia.getDissemination("demo:5",
                                      "fedora-system:3",
                                      "viewDublinCore",
                                      params,
                                      null);
        assertEquals(diss.getMIMEType(), "text/html");
        assertTrue(TypeUtility.convertDataHandlerToBytes(diss.getStream()).length > 0);
    }
View Full Code Here

Examples of org.fcrepo.server.types.mtom.gen.MIMETypedStream

     * assertTrue(diss.getStream().length > 0); }
     */

    @Test
    public void testGetDisseminationUserInput() throws Exception {
        MIMETypedStream diss = null;
        Parameters params = new Parameters();
        Property prop = new Property();
        prop.setName("convertTo");
        prop.setValue("gif");
        params.getParameter().add(prop);
        diss =
                apia.getDissemination("demo:29",
                                      "demo:27",
                                      "convertImage",
                                      params,
                                      null);
        assertEquals(diss.getMIMEType(), "image/gif");
        assertTrue(TypeUtility.convertDataHandlerToBytes(diss.getStream()).length > 0);
    }
View Full Code Here

Examples of org.fcrepo.server.types.mtom.gen.MIMETypedStream

        // test chained dissemination using local services
        // The object contains an E datastream that is a dissemination of the local SAXON service.
        // This datastream is input to another dissemination that uses the local FOP service.
        Parameters params = new Parameters();
        //params.getParameter().add(new Property());
        MIMETypedStream diss =
                apia.getDissemination("demo:26",
                                      "demo:19",
                                      "getPDF",
                                      params,
                                      null);
        assertEquals(diss.getMIMEType(), "application/pdf");
        assertTrue(TypeUtility.convertDataHandlerToBytes(diss.getStream()).length > 0);
    }
View Full Code Here

Examples of org.fcrepo.server.types.mtom.gen.MIMETypedStream

                throw new InvalidContentModelException(pid, "Datastream '"
                        + DS_COMPOSITE_MODEL + "' has incorrect format URI: '"
                        + dsInfo.getFormatUri() + "'.");
            }

            MIMETypedStream ds =
                    apia.getDatastreamDissemination(pid,
                                                    DS_COMPOSITE_MODEL,
                                                    null);
            DsCompositeModelDoc model =
                    new DsCompositeModelDoc(pid,
                                            org.fcrepo.server.utilities.TypeUtility
                                                    .convertDataHandlerToBytes(ds
                                                            .getStream()));
            return new BasicContentModelInfo(object, model.getTypeModels());
        } catch (Exception e) {
            throw new ObjectSourceException("Problem fetching '"
                                                    + DS_COMPOSITE_MODEL
View Full Code Here

Examples of org.fcrepo.server.types.mtom.gen.MIMETypedStream

                DEMO_REST_PID.toString()));

        verifyPUTStatusOnly(url, SC_UNAUTHORIZED, entity, false);
        verifyPUTStatusOnly(url, SC_OK, entity, true);

        MIMETypedStream ds1 =
                apia.getDatastreamDissemination(DEMO_REST_PID.toString(), "DS1", null);
        assertXMLEqual(xmlData,
                       new String(TypeUtility.convertDataHandlerToBytes(ds1
                               .getStream()), "UTF-8"));
    }
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.