當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeEventHandler類代碼示例

本文整理匯總了Java中dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers.TreeEventHandler的典型用法代碼示例。如果您正苦於以下問題:Java TreeEventHandler類的具體用法?Java TreeEventHandler怎麽用?Java TreeEventHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TreeEventHandler類屬於dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers包,在下文中一共展示了TreeEventHandler類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: printStructure

import dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers.TreeEventHandler; //導入依賴的package包/類
@Test(groups = "integrationTest", enabled = false)
public void printStructure()
        throws
        IOException {

    String pathToTestBatch =
            System.getProperty("integration.test.newspaper.testdata") + "/small-test-batch/B400022028241-RT1/";
    final TreeNodeState nodeState = new TreeNodeState();
    final TreeEventHandler handler = new PrintingTreeEventHandler(nodeState);
    EventRunner eventRunner = new EventRunner(new TransformingIteratorForFileSystems(new File(pathToTestBatch),
                                                                                     TransformingIteratorForFileSystems.GROUPING_PATTERN_DEFAULT_VALUE,
                                                                                     TransformingIteratorForFileSystems.DATA_FILE_PATTERN_JP2_VALUE,
                                                                                     TransformingIteratorForFileSystems.CHECKSUM_POSTFIX_DEFAULT_VALUE,
                                                                                     Arrays.asList(TransformingIteratorForFileSystems.IGNORED_FILES_DEFAULT_VALUE.split(","))),
            Arrays.asList(handler),
            null);

    eventRunner.run();
}
 
開發者ID:statsbiblioteket,項目名稱:newspaper-batch-event-framework,代碼行數:20,代碼來源:TreeNodesStructurePrint.java

示例2: testCreateEventHandlers

import dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers.TreeEventHandler; //導入依賴的package包/類
@Test
public void testCreateEventHandlers() throws Exception {
    MetadataChecksFactory factoryForAll = new MetadataChecksFactory(new ResultCollector("sdfsd", "sdfds"),
            true,
            "batchFolder",
            "jpylyzerPath", MFPakMocker.getMFPak(),
            new Batch("4000"),
            null,
            null);
    final List<TreeEventHandler> eventHandlers = factoryForAll.createEventHandlers();
    Assert.assertEquals(eventHandlers.size(), 11);
    int i = 0;
    Assert.assertTrue(eventHandlers.get(i++) instanceof ChecksumCheckEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof JpylyzingEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof SchemaValidatorEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof SchematronValidatorEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof ModsXPathEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof AltoXPathEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof AltoMixCrossCheckEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof EditionModsEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof FilmXmlChecker);
    Assert.assertTrue(eventHandlers.get(i++) instanceof MixXmlFileChecker);
    Assert.assertTrue(eventHandlers.get(i++) instanceof MixFilmCrossCheckEventHandler);

}
 
開發者ID:statsbiblioteket,項目名稱:newspaper-batch-metadata-checker,代碼行數:26,代碼來源:MetadataChecksFactoryTest.java

示例3: testCreateEventHandlersWithDisabled

import dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers.TreeEventHandler; //導入依賴的package包/類
@Test
public void testCreateEventHandlersWithDisabled() throws Exception {
    Set<MetadataChecksFactory.Checks> disabled = new HashSet<>();
    disabled.add(MetadataChecksFactory.Checks.CHECKSUM);
    disabled.add(MetadataChecksFactory.Checks.MIX_FILM);
    MetadataChecksFactory factoryForAll = new MetadataChecksFactory(new ResultCollector("sdfsd", "sdfds"),
            true,
            "batchFolder",
            "jpylyzerPath", MFPakMocker.getMFPak(),
            new Batch("4000"),
            null,
            disabled);
    final List<TreeEventHandler> eventHandlers = factoryForAll.createEventHandlers();
    Assert.assertEquals(eventHandlers.size(), 9);
    int i = 0;
    Assert.assertTrue(eventHandlers.get(i++) instanceof JpylyzingEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof SchemaValidatorEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof SchematronValidatorEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof ModsXPathEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof AltoXPathEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof AltoMixCrossCheckEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof EditionModsEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof FilmXmlChecker);
    Assert.assertTrue(eventHandlers.get(i++) instanceof MixXmlFileChecker);
}
 
開發者ID:statsbiblioteket,項目名稱:newspaper-batch-metadata-checker,代碼行數:26,代碼來源:MetadataChecksFactoryTest.java

示例4: testCreateEventHandlersWithDisabledNotAtNinestars

import dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers.TreeEventHandler; //導入依賴的package包/類
public void testCreateEventHandlersWithDisabledNotAtNinestars() throws Exception {
    Set<MetadataChecksFactory.Checks> disabled = new HashSet<>();
    disabled.add(MetadataChecksFactory.Checks.CHECKSUM);
    disabled.add(MetadataChecksFactory.Checks.MIX_FILM);
    MetadataChecksFactory factoryForAll = new MetadataChecksFactory(new ResultCollector("sdfsd", "sdfds"),
            false,
            "batchFolder",
            "jpylyzerPath", MFPakMocker.getMFPak(),
            new Batch("4000"),
            null,
            disabled);
    final List<TreeEventHandler> eventHandlers = factoryForAll.createEventHandlers();
    Assert.assertEquals(eventHandlers.size(), 8);
    int i = 0;
    Assert.assertTrue(eventHandlers.get(i++) instanceof SchemaValidatorEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof SchematronValidatorEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof ModsXPathEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof AltoXPathEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof AltoMixCrossCheckEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof EditionModsEventHandler);
    Assert.assertTrue(eventHandlers.get(i++) instanceof FilmXmlChecker);
    Assert.assertTrue(eventHandlers.get(i++) instanceof MixXmlFileChecker);
}
 
開發者ID:statsbiblioteket,項目名稱:newspaper-batch-metadata-checker,代碼行數:24,代碼來源:MetadataChecksFactoryTest.java

示例5: runValidation

import dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers.TreeEventHandler; //導入依賴的package包/類
protected static int runValidation(File file, String jpylyzerPath) throws
                                                                                               FileNotFoundException {
    DocumentCache documentCache = new DocumentCache();
    ResultCollector resultCollector = new ResultCollector("file", NinestarsUtils.getVersion());
    JpylyzingEventHandler jpylyzingEventHandler = new JpylyzingEventHandler(resultCollector,
            file.getParentFile().getAbsolutePath(),
            jpylyzerPath);
    Map<String, AttributeSpec> metadataChecksConfig = MetadataChecksFactory.getAttributeValidationConfig();
    DefaultTreeEventHandler schemaValidatorEventHandler = new SchemaValidatorEventHandler(resultCollector,
            documentCache,metadataChecksConfig);
    DefaultTreeEventHandler schematronValidatorEventHandler = new SchematronValidatorEventHandler(resultCollector,
            documentCache,metadataChecksConfig);
    EventRunner runner = new EventRunner(null,
            Arrays.asList((TreeEventHandler) jpylyzingEventHandler,
                    schemaValidatorEventHandler,
                    schematronValidatorEventHandler),
            resultCollector);
    runner.handleNodeBegins(new DataFileNodeBeginsParsingEvent(file.getName()));
    //simulate a tree iteration
    try {
        runner.handleAttribute(new FileAttributeParsingEvent(file.getName() + JpylyzingEventHandler.CONTENTS,
                file));
    } catch (RuntimeException e) {
        resultCollector.addFailure(file.getName(),
                "exception",
                JpylyzingEventHandler.class.getSimpleName(),
                "Unexpected error: " + e.getMessage(),
                Strings.getStackTrace(e));
    }
    // Only run the validations if jpylyzer succeeds it's run.
    if (resultCollector.isSuccess()) {
        AttributeParsingEvent parsingEvent = runner.popInjectedEvent();
        runner.handleAttribute(parsingEvent);
        runner.handleNodeEnd(new DataFileNodeEndsParsingEvent(file.getName()));
        runner.handleFinish();
    }
    String result = NinestarsUtils.convertResult(resultCollector, file.getName(), new HashSet<MetadataChecksFactory.Checks>());
    System.out.println(result);
    if (!resultCollector.isSuccess()) {
        return 1;
    }
    return 0;
}
 
開發者ID:statsbiblioteket,項目名稱:newspaper-ninestars-QA-suite,代碼行數:44,代碼來源:NinestarsFileQA.java

示例6: createEventHandlers

import dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers.TreeEventHandler; //導入依賴的package包/類
/**
 * Add all metadata checking event handlers.
 *
 * @return The list of metadata checking event handlers.
 */
@Override
public List<TreeEventHandler> createEventHandlers() {
    ArrayList<TreeEventHandler> treeEventHandlers = new ArrayList<>();
    DocumentCache documentCache = new DocumentCache();

    Map<String, AttributeSpec> attributeConfigs = getAttributeValidationConfig();

    if (atNinestars) {
        if (!disabledChecks.contains(Checks.CHECKSUM)) {
            treeEventHandlers.add(new ChecksumCheckEventHandler(resultCollector));
        }

        if (!disabledChecks.contains(Checks.JPYLYZER)) {
            //This thing adds virtual jpylyzer.xml nodes
            treeEventHandlers.add(new JpylyzingEventHandler(resultCollector, batchFolder, jpylyzerPath));
        }
    }
    if (!disabledChecks.contains(Checks.SCHEMA_VALIDATOR)) {
        treeEventHandlers.add(new SchemaValidatorEventHandler(resultCollector, documentCache, attributeConfigs));
    }
    if (!disabledChecks.contains(Checks.SCHEMATRON)) {
        treeEventHandlers.add(new SchematronValidatorEventHandler(resultCollector, documentCache, attributeConfigs));
    }
    if (!disabledChecks.contains(Checks.MODS_XPATH)) {
        treeEventHandlers.add(new ModsXPathEventHandler(resultCollector,
                batchContext,
                batchXmlStructure,
                documentCache));
    }
    if (!disabledChecks.contains(Checks.ALTO_XPATH)) {
        treeEventHandlers.add(new AltoXPathEventHandler(resultCollector, documentCache));
    }
    if (!disabledChecks.contains(Checks.ALTO_MIX)) {
        treeEventHandlers.add(new AltoMixCrossCheckEventHandler(resultCollector, documentCache));
    }
    if (!disabledChecks.contains(Checks.EDITION_MODS)) {
        treeEventHandlers.add(new EditionModsEventHandler(resultCollector, batchContext, documentCache));
    }
    if (!disabledChecks.contains(Checks.FILM_XML)) {
        treeEventHandlers.add(new FilmXmlChecker(resultCollector, batchContext, batchXmlStructure, documentCache));
    }
    if (!disabledChecks.contains(Checks.MIX_XML)) {
        treeEventHandlers.add(new MixXmlFileChecker(resultCollector, batchContext, batchXmlStructure, documentCache));
    }
    if (!disabledChecks.contains(Checks.MIX_FILM)) {
        treeEventHandlers.add(new MixFilmCrossCheckEventHandler(resultCollector, documentCache));
    }

    return treeEventHandlers;
}
 
開發者ID:statsbiblioteket,項目名稱:newspaper-batch-metadata-checker,代碼行數:56,代碼來源:MetadataChecksFactory.java


注:本文中的dk.statsbiblioteket.medieplatform.autonomous.iterator.eventhandlers.TreeEventHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。