Package org.drools.guvnor.server.files

Examples of org.drools.guvnor.server.files.Response.writeData()


                        }
                        Response apiRes = api.get(ur);
                        res.setContentType("application/x-download");
                        res.setHeader("Content-Disposition",
                                "attachment; filename=data;");
                        apiRes.writeData(res.getOutputStream());
                        res.getOutputStream().flush();
                    }
                });

    }
View Full Code Here


       api.setAssetValidator(new AssetValidator());
        String url = "packages/testRestGetSpaces";
        Response res = api.get(url);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        res.writeData(out);

        assertTrue(new String(out.toByteArray()).indexOf("\\ ") > -1);

        url = "packages/testRestGetSpaces/some space.drl";
        res = api.get(url);
View Full Code Here

        String url = "packages/testRestGetBasics/.package";
        Response res = api.get(url);
        assertNotNull(res.lastModified);
        assertEquals(pkg.getLastModified(), res.lastModified);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        res.writeData(out);

        String dotPackage = new String(out.toByteArray());
        assertEquals(pkg.getStringProperty(ModuleItem.HEADER_PROPERTY_NAME), dotPackage);

        res = api.get("packages/testRestGetBasics");
View Full Code Here

        res = api.get("packages/testRestGetBasics");
        assertTrue(res instanceof Text);
        assertNotNull(res.lastModified);
        out = new ByteArrayOutputStream();
        res.writeData(out);
        String listing = new String(out.toByteArray());
        assertNotNull(listing);

        Properties p = new Properties();
        p.load(new ByteArrayInputStream(out.toByteArray()));
View Full Code Here

        res = api.get("packages/testRestGetBasics/asset1.drl");
        assertTrue(res instanceof Text);
        out = new ByteArrayOutputStream();
        assertNotNull(res.lastModified);
        assertTrue(res.lastModified.getTime().after(sdf.parse("2000-04-14T18:36:37")));
        res.writeData(out);

        String s = new String(out.toByteArray());
        assertEquals(asset1.getContent(), s);

View Full Code Here

        res = api.get("packages/testRestGetBasics/asset3.xls");
        assertTrue(res instanceof Binary);
        out = new ByteArrayOutputStream();
        assertNotNull(res.lastModified);
        assertTrue(res.lastModified.getTime().after(sdf.parse("2000-04-14T18:36:37")));
        res.writeData(out);

        byte[] data = out.toByteArray();
        assertNotNull(data);

        assertEquals("abc", new String(data));
View Full Code Here

        RestAPI api = new RestAPI(repo);
        api.setAssetValidator(new AssetValidator());
        Response res = api.get("packages/testRestGetVersionHistory/asset1.drl?version=all");
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        res.writeData(out);
        String d = new String(out.toByteArray());
        //System.err.println(d);
        assertTrue(d.indexOf(",alan_parsons,This is something") > 0);

View Full Code Here

        asset1.checkin("This is another");

        res = api.get("packages/testRestGetVersionHistory/asset1.drl?version=all");
        out = new ByteArrayOutputStream();

        res.writeData(out);
        d = new String(out.toByteArray());
        System.err.println(d);
        assertTrue(d.indexOf(",alan_parsons,This is something") > 0);
        assertTrue(d.indexOf(",alan_parsons,This is another") > 0);
        assertTrue(d.indexOf("1=") > -1);
View Full Code Here

        assertEquals(-1, d.indexOf("0="));

        res = api.get("packages/testRestGetVersionHistory/asset1.drl?version=1");
        out = new ByteArrayOutputStream();

        res.writeData(out);
        d = new String(out.toByteArray());
        assertEquals("this is content", d);


        res = api.get("packages");
View Full Code Here

        assertNotNull(d);

        resp = api.get("packages/testVersionHistoryAndArchived/asset2.drl?version=all");
        out = new ByteArrayOutputStream();

        resp.writeData(out);
        d = new String(out.toByteArray());
        assertEquals("", d);
    }

    @Test
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.