Package org.rhq.bindings.util

Examples of org.rhq.bindings.util.ScriptUtil


public class ScriptUtilTest {

    @Test
    public void getFileBytes() {
        ScriptUtil scriptUtil = new ScriptUtil(null);

        try {
            String fileContents = "the rain in spain falls mainly on the plain";
            String tempDir = System.getProperty("java.io.tmpdir");
            File testFile = new File(tempDir, "getFileBytesTest.txt");
            byte[] contentBytes = fileContents.getBytes();
            FileOutputStream writer = new FileOutputStream(testFile);
            writer.write(contentBytes);
            writer.close();
            System.out.println("Test data written to " + testFile.getAbsolutePath());

            byte[] fileBytes = scriptUtil.getFileBytes(testFile.getAbsolutePath());
            String results = new String(fileBytes);

            System.out.println("Wrote: \"" + fileContents + "\"\nRead:  \"" + results + "\"");
            assert fileContents.equals(results) : "Wrote: \"" + fileContents + "\"\nRead:  \"" + results + "\"";
        } catch (IOException ioe) {
View Full Code Here


            }
            managers.clear();
        }

        //script utils can handle a null facade
        put(SCRIPT_UTIL, new ScriptUtil(rhqFacade));

        if (rhqFacade != null) {
            managers = rhqFacade.getScriptingAPI();

            put(SUBJECT, rhqFacade.getSubject());
View Full Code Here

TOP

Related Classes of org.rhq.bindings.util.ScriptUtil

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.