当前位置: 首页>>代码示例>>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;未经允许,请勿转载。