Package org.rhq.enterprise.server.system

Examples of org.rhq.enterprise.server.system.SystemManagerLocal


        prepareCustomServerPluginService(testData.testServerPluginService);
        testData.testServerPluginService.startMasterPluginContainer();

        synchronizationManager = LookupUtil.getSynchronizationManager();

        SystemManagerLocal systemManager = LookupUtil.getSystemManager();
        //make sure the system manager is in sync w/ the db we just changed in dbsetup
        systemManager.loadSystemConfigurationCache();

        testData.systemSettings = systemManager.getUnmaskedSystemSettings(false);

        if (createExport) {
            export = synchronizationManager.exportAllSubsystems(freshUser());
        }
    }
View Full Code Here


    public void testImportWithDefaultConfiguration() throws Exception {
        setup(true);

        try {
            SystemManagerLocal systemManager = LookupUtil.getSystemManager();
            MeasurementDefinitionManagerLocal measurementDefinitionManager = LookupUtil
                .getMeasurementDefinitionManager();

            SystemSettings beforeSystemSettings = systemManager.getUnmaskedSystemSettings(false);
            MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
            criteria.setPageControl(PageControl.getUnlimitedInstance());
            criteria.fetchResourceType(true);

            List<MeasurementDefinition> beforeMeasurementDefinitions = measurementDefinitionManager
                .findMeasurementDefinitionsByCriteria(freshUser(), criteria);

            synchronizationManager.importAllSubsystems(freshUser(), export.getExportFile(), null);

            //this is to work around BZ 735810
            systemManager.loadSystemConfigurationCache();

            SystemSettings afterSystemSettings = systemManager.getUnmaskedSystemSettings(false);
            List<MeasurementDefinition> afterMeasurementDefinitions = measurementDefinitionManager
                .findMeasurementDefinitionsByCriteria(freshUser(), criteria);

            assertEquals("System settings unexpectedly differ", beforeSystemSettings, afterSystemSettings);
View Full Code Here

            } finally {
                exportData.close();
            }

            //now check that everything got imported according to the changed configuration
            SystemManagerLocal systemManager = LookupUtil.getSystemManager();
            SystemSettings settings = systemManager.getUnmaskedSystemSettings(false);

            assertEquals(settings.get(SystemSetting.BASE_URL), "http://testing.domain:7080");

            MeasurementDefinitionManagerLocal measurementDefinitionManager = LookupUtil
                .getMeasurementDefinitionManager();
View Full Code Here

    public void testManuallyPassedImportConfigurationHasPrecendenceOverTheInlinedOne() throws Exception {
        setup(true);

        try {
            //let's read the original values from the database, so that we know what to compare against
            SystemManagerLocal systemManager = LookupUtil.getSystemManager();
            SystemSettings settings = systemManager.getUnmaskedSystemSettings(false);

            String originalBaseUrl = settings.get(SystemSetting.BASE_URL);

            MeasurementDefinitionManagerLocal measurementDefinitionManager = LookupUtil
                .getMeasurementDefinitionManager();
            MeasurementDefinitionCriteria crit = new MeasurementDefinitionCriteria();
            crit.addFilterResourceTypeName(RESOURCE_TYPE_NAME);
            crit.addFilterName(METRIC_NAME);
            MeasurementDefinition distroNameDef = measurementDefinitionManager.findMeasurementDefinitionsByCriteria(
                freshUser(), crit).get(0);

            long originalInterval = distroNameDef.getDefaultInterval();

            //now modify the default configuration in the export file
            String exportXML = getExportData();

            exportXML = updateSystemSettingsImportConfiguration(exportXML);
            exportXML = updateMetricTemplatesImportConfiguration(exportXML);

            InputStream exportData = createCompressedStream(exportXML);

            //let's just use the default configs so that we don't apply the changes suggested in
            //the changed default configs created above
            ImportConfiguration systemSettingsConfiguration = new ImportConfiguration(
                SystemSettingsSynchronizer.class.getName(), new SystemSettingsSynchronizer().getImporter()
                    .getImportConfigurationDefinition().getDefaultTemplate().createConfiguration());
            ImportConfiguration metricTemplatesConfiguration = new ImportConfiguration(
                MetricTemplateSynchronizer.class.getName(), new MetricTemplateSynchronizer().getImporter()
                    .getImportConfigurationDefinition().getDefaultTemplate().createConfiguration());

            try {
                synchronizationManager.importAllSubsystems(freshUser(), exportData,
                    Arrays.asList(systemSettingsConfiguration, metricTemplatesConfiguration));
            } finally {
                exportData.close();
            }

            //now check that we import using the manually create configurations, not the inlined ones
            settings = systemManager.getUnmaskedSystemSettings(false);

            assertEquals(settings.get(SystemSetting.BASE_URL), originalBaseUrl);

            measurementDefinitionManager = LookupUtil.getMeasurementDefinitionManager();
            distroNameDef = measurementDefinitionManager.findMeasurementDefinitionsByCriteria(freshUser(), crit).get(0);
View Full Code Here

        try {
            Thread.sleep(2000L);
        } catch (InterruptedException ignored) {
        }
        Subject superuser = LookupUtil.getSubjectManager().getOverlord();
        SystemManagerLocal systemManager = LookupUtil.getSystemManager();
        systemManager.vacuum(superuser, new String[] { "RHQ_MEASUREMENT_DEF", "RHQ_CONFIG_DEF", "RHQ_RESOURCE_TYPE",
            "RHQ_RESOURCE_TYPE_PARENTS", Plugin.TABLE_NAME });

        return;
    }
View Full Code Here

        LOG.info("Auto-calculation of OOBs starting");

        Subject overlord = LookupUtil.getSubjectManager().getOverlord();
        MeasurementOOBManagerLocal manager = LookupUtil.getOOBManager();
        PurgeManagerLocal purgeManager = LookupUtil.getPurgeManager();
        SystemManagerLocal systemManager = LookupUtil.getSystemManager();

        // purge OOBs whose baseline just got recalculated
        // For now just assume that our system is fast, so a cutoff of 30mins is ok,
        // as the calculate baseline job runs hourly
        long cutOff = System.currentTimeMillis() - (30L * 60L * 1000L);

        long timeStart = System.currentTimeMillis();

        purgeManager.removeOutdatedOOBs(cutOff);

        // clean up
        systemManager.vacuum(overlord, new String[] { "RHQ_MEASUREMENT_OOB" });

        // Now calculate the fresh OOBs
        manager.computeOOBsForLastHour(overlord, oneHourAggregates);

        long duration = System.currentTimeMillis() - timeStart;
View Full Code Here

public class SystemSettingsExporterTest extends JMockTest {

    private static final Log LOG = LogFactory.getLog(MetricTemplateExporterTest.class);

    public void testCanExport() throws Exception {
        final SystemManagerLocal systemManager = context.mock(SystemManagerLocal.class);
       
        context.checking(new Expectations() {
            {
                allowing(systemManager).getObfuscatedSystemSettings(false);
                will(returnValue(getFakeSystemSettings()));
View Full Code Here

*/
@Test
public class SystemSettingsImporterTest extends JMockTest {

    public void testNullConfigurationUnderstoodAsDefault() throws Exception {
        final SystemManagerLocal systemManager = context.mock(SystemManagerLocal.class);

        SystemSettingsImporter importer = new SystemSettingsImporter(null, systemManager);

        final HashMap<String, String> settings = new HashMap<String, String>();
        settings.put(SystemSetting.BASE_URL.getInternalName(), "url");
View Full Code Here

        importer.finishImport();
    }

    public void testImportConfigurationHonored() throws Exception {
        final SystemManagerLocal systemManager = context.mock(SystemManagerLocal.class);

        SystemSettingsImporter importer = new SystemSettingsImporter(null, systemManager);

        String[] importableProps = SystemSettingsImporter.DEFAULT_IMPORTED_PROPERTIES_LIST.split("\\s*,\\s*");

 
View Full Code Here

        return (DriftServerPluginFacet) getServerPluginComponent(pluginName);
    }

    private Properties getSysConfig() {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        SystemManagerLocal systemMgr = LookupUtil.getSystemManager();

        return systemMgr.getSystemConfiguration(subjectMgr.getOverlord());
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.system.SystemManagerLocal

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.