Package org.rhq.core.domain.plugin

Examples of org.rhq.core.domain.plugin.Plugin


        assertPluginNotOnFilesystem(plugin10jun);
        return;
    }

    public void test9() throws Exception {
        Plugin plugin10feb = deployPluginJarToFilesystem(TESTPLUGIN_1_0_FEB);
        Plugin plugin10jun = deployPluginJarToFilesystem(TESTPLUGIN_1_0_JUN);
        deployPluginJarToDatabase(TESTPLUGIN_1_0_FEB);

        createScannerAndScan(null);
        assertPluginInDb(plugin10feb); // still the old one, will get updated when the file is deployed
        assertPluginOnFilesystem(plugin10jun);
View Full Code Here


        assertPluginNotOnFilesystem(plugin10feb);
        return;
    }

    public void test10() throws Exception {
        Plugin plugin10feb = deployPluginJarToFilesystem(TESTPLUGIN_1_0_FEB);
        Plugin plugin10jun = deployPluginJarToFilesystem(TESTPLUGIN_1_0_JUN);
        deployPluginJarToDatabase(TESTPLUGIN_1_0_JUN);

        createScannerAndScan(null);
        assertPluginInDb(plugin10jun); // no change
        assertPluginOnFilesystem(plugin10jun); // no change
View Full Code Here

        assertPluginNotOnFilesystem(plugin10feb);
        return;
    }

    public void test11() throws Exception {
        Plugin plugin10feb = deployPluginJarToFilesystem(TESTPLUGIN_1_0_FEB);
        Plugin plugin10jun = deployPluginJarToFilesystem(TESTPLUGIN_1_0_JUN);
        Plugin plugin11feb = deployPluginJarToDatabase(TESTPLUGIN_1_1_FEB);

        createScannerAndScan(null);
        assertPluginInDb(plugin11feb);
        assertPluginOnFilesystem(plugin11feb);
        assertPluginNotOnFilesystem(plugin10feb);
View Full Code Here

        assertPluginNotOnFilesystem(plugin10jun);
        return;
    }

    public void test12() throws Exception {
        Plugin plugin10feb = deployPluginJarToFilesystem(TESTPLUGIN_1_0_FEB);
        Plugin plugin11jun = deployPluginJarToFilesystem(TESTPLUGIN_1_1_JUN);
        deployPluginJarToDatabase(TESTPLUGIN_1_0_FEB);

        createScannerAndScan(null);
        assertPluginInDb(plugin10feb); // still the old one, will get updated when the file is deployed
        assertPluginOnFilesystem(plugin11jun);
View Full Code Here

        assertPluginNotOnFilesystem(plugin10feb);
        return;
    }

    public void test13() throws Exception {
        Plugin plugin10feb = deployPluginJarToFilesystem(TESTPLUGIN_1_0_FEB);
        Plugin plugin11jun = deployPluginJarToFilesystem(TESTPLUGIN_1_1_JUN);
        Plugin plugin11feb = deployPluginJarToDatabase(TESTPLUGIN_1_1_FEB);

        createScannerAndScan(null);
        assertPluginInDb(plugin11feb); // still the old one, will get updated when the file is deployed
        assertPluginOnFilesystem(plugin11jun);
        assertPluginNotOnFilesystem(plugin10feb);
View Full Code Here

        assertPluginNotOnFilesystem(plugin10feb);
        return;
    }

    public void test14() throws Exception {
        Plugin plugin10feb = deployPluginJarToFilesystem(TESTPLUGIN_1_0_FEB);
        Plugin plugin10feb2 = deployPluginJarToFilesystem(TESTPLUGIN_1_0_FEB2);
        deployPluginJarToDatabase(TESTPLUGIN_1_0_FEB);

        createScannerAndScan(null);
        assertPluginInDb(plugin10feb);
        boolean plugin10febExists = !isPluginNotOnFilesystem(plugin10feb);
View Full Code Here

    private void assertPluginOnFilesystem(Plugin plugin) throws Exception {
        File file = new File(DEPLOY_LOCATION, plugin.getPath());
        String version = AgentPluginDescriptorUtil.getPluginVersion(file, null).toString();
        String md5 = MessageDigestGenerator.getDigestString(file);
        long mtime = file.lastModified();
        Plugin filePlugin = new Plugin(PLUGIN_NAME, file.getName());
        filePlugin.setMd5(md5);
        filePlugin.setVersion(version);
        filePlugin.setMtime(mtime);
        assertSamePlugin(plugin, filePlugin);
    }
View Full Code Here

        filePlugin.setMtime(mtime);
        assertSamePlugin(plugin, filePlugin);
    }

    private void assertPluginInDb(Plugin plugin) throws Exception {
        Plugin dbPlugin;

        TransactionManager tm = getTransactionManager();
        tm.begin();
        try {
            Query q = em.createNamedQuery(Plugin.QUERY_FIND_BY_NAME);
View Full Code Here

        if (scanner != null) {
            scanner.scan();
        }

        if (pluginId != null) {
            Plugin plugin = this.testPlugins.get(pluginId);
            Plugin pluginDup = new Plugin(plugin.getName(), plugin.getPath(), plugin.getMd5());
            pluginDup.setMtime(plugin.getMtime());
            pluginDup.setVersion(plugin.getVersion());
            PluginDescriptor pluginDescriptor = this.testPluginDescriptors.get(pluginId);
            File localPluginFile = this.testPluginFiles.get(pluginId);
            pluginMgr.registerPlugin(pluginDup, pluginDescriptor, localPluginFile, false);
        }
        return;
View Full Code Here

        }
        return;
    }

    private Plugin deployPluginJarToDatabase(String pluginId) throws Exception {
        Plugin plugin = testPlugins.get(pluginId);

        // make our own copy since we will be persisting it and populating content in it
        Plugin pluginPojo = new Plugin(plugin.getName(), plugin.getPath(), plugin.getMd5());
        pluginPojo.setId(0);
        pluginPojo.setDisplayName(plugin.getName());
        pluginPojo.setVersion(plugin.getVersion());
        pluginPojo.setMtime(plugin.getMtime());
        pluginPojo.setContent(StreamUtil.slurp(new FileInputStream(testPluginFiles.get(pluginId))));

        TransactionManager tm = getTransactionManager();
        tm.begin();
        try {
            em.persist(pluginPojo);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.plugin.Plugin

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.