Examples of RhqDownloadsScriptSourceProvider


Examples of org.rhq.enterprise.client.RhqDownloadsScriptSourceProvider

    public void canLocateScripts() throws Exception {
        CoreServerMBean coreServer = Mockito.mock(CoreServerMBean.class);
               
        Mockito.when(coreServer.getEarDeploymentDir()).thenReturn(tmpDir);
       
        RhqDownloadsScriptSourceProvider provider = new RhqDownloadsScriptSourceProvider(coreServer);
       
        URI location = new URI("rhq://downloads/test-script.js");
       
        Reader rdr = provider.getScriptSource(location);
       
        try {
            String contents = StreamUtil.slurp(rdr);
            assertEquals(contents, EXPECTED_CONTENTS, "Unexpected script loaded");
        } finally {
View Full Code Here

Examples of org.rhq.enterprise.clientapi.RhqDownloadsScriptSourceProvider

        URI remoteURI = new URI("socket://localhost:7080");
        Mockito.when(client.getRemoteURI()).thenReturn(remoteURI);
       
        URI real = tmpDir.toURI().resolve("downloads/script-modules/test-script.js");
       
        RhqDownloadsScriptSourceProvider provider = new RhqDownloadsScriptSourceProvider();

        StandardBindings bindings = new StandardBindings(null, client);
       
        provider.rhqFacadeChanged(bindings);
       
        URI location = new URI("rhq://downloads/test-script.js");
       
        //let's actually cheat - the source provider will try to locate the script using HTTP
        //but we subvert that and use the local file URL anyway...
        PowerMockito.whenNew(URI.class).withArguments("http", "localhost:7080", "/downloads/script-modules/test-script.js", null, null).thenReturn(real);

        Reader rdr = provider.getScriptSource(location);
       
        try {
            String contents = StreamUtil.slurp(rdr);
            assertEquals(contents, EXPECTED_CONTENTS, "Unexpected script loaded");
        } finally {       
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.