Package org.rhq.enterprise.server.sync

Examples of org.rhq.enterprise.server.sync.MetricTemplateSynchronizer


            //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));
View Full Code Here


                allowing(measurementDefinitionManager).findMeasurementDefinitionsByCriteria(with(any(Subject.class)), with(any(MeasurementDefinitionCriteria.class)));
                will(returnValue(getFakeMeasurementDefinitions()));
            }
        });
       
        MetricTemplateSynchronizer exporter = new MetricTemplateSynchronizer(measurementDefinitionManager, measurementScheduleManager);

        Set<Synchronizer<?, ?>> exporters = new HashSet<Synchronizer<?, ?>>();
        exporters.add(exporter);

        InputStream eis = new ExportingInputStream(exporters, new HashMap<String, ExporterMessages>(), 65536, false);

        //        String exportContents = readAll(new InputStreamReader(eis, "UTF-8"));
        //
        //        LOG.warn("Export contents:\n" + exportContents);
        //
        //        eis = new ByteArrayInputStream(exportContents.getBytes("UTF-8"));

        //        <?xml version="1.0" ?>
        //        <configuration-export>
        //            <validator class="org.rhq.enterprise.server.sync.validators.DeployedAgentPluginsValidator">
        //                <plugin name="fakePlugin" hash="12345" version="1.0.0.test"></plugin>
        //            </validator>
        //            <entities id="org.rhq.enterprise.server.sync.exporters.MetricTemplatesExporter">
        //                <entity>
        //                    <data>
        //                        <metricTemplate referencedEntityId="1" enabled="false" defaultInterval="0" metricName="m1" resourceTypePlugin="fakePlugin" resourceTypeName="fakeType"></metricTemplate>
        //                    </data>
        //                </entity>
        //                <entity>
        //                    <data>
        //                        <metricTemplate referencedEntityId="2" enabled="false" defaultInterval="0" metricName="m2" resourceTypePlugin="fakePlugin" resourceTypeName="fakeType"></metricTemplate>
        //                    </data>
        //                </entity>
        //                <entity>
        //                    <data>
        //                        <metricTemplate referencedEntityId="3" enabled="false" defaultInterval="0" metricName="m3" resourceTypePlugin="fakePlugin" resourceTypeName="fakeType"></metricTemplate>
        //                    </data>
        //                </entity>
        //            </entities>
        //        </configuration-export>       

        DocumentBuilder bld = DocumentBuilderFactory.newInstance().newDocumentBuilder();

        Document doc = bld.parse(eis);

        Element root = doc.getDocumentElement();

        List<Node> validators = getDirectChildrenByTagName(root, SynchronizationConstants.VALIDATOR_ELEMENT);
        Set<ConsistencyValidator> declaredValidators = exporter.getRequiredValidators();
        assertEquals(validators.size(), declaredValidators.size(), "Unexpected number of validators in the export xml");

        for (Node v : validators) {
            Element validator = (Element) v;
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.sync.MetricTemplateSynchronizer

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.