Java 类org.junit.rules.ErrorCollector 实例源码

项目:components    文件:ComponentTestUtils.java   
/**
 * check all properties of a component for i18n, check form i18n, check ComponentProperties title is i18n
 * 
 * @param componentService where to get all the components
 * @param errorCollector used to collect all errors at once. @see
 *            <a href="http://junit.org/apidocs/org/junit/rules/ErrorCollector.html">ErrorCollector</a>
 * @deprecated use {@link PropertiesTestUtils#assertAlli18nAreSetup(DefinitionRegistryService, ErrorCollector)} and
 *             {@link #assertReturnProperties18nAreSet(DefinitionRegistryService, ErrorCollector)}
 */
@Deprecated
static public void testAlli18n(ComponentService componentService, ErrorCollector errorCollector) {
    Set<ComponentDefinition> allComponents = componentService.getAllComponents();
    for (ComponentDefinition cd : allComponents) {
        ComponentProperties props = (ComponentProperties) PropertiesImpl.createNewInstance(cd.getPropertiesClass(), "root")
                .init();
        // check all properties
        if (props != null) {
            checkAllI18N(props, errorCollector);
        } else {
            System.out.println("No properties to check fo I18n for :" + cd.getName());
        }
        // check component definition title
        errorCollector.checkThat(
                "missing I18n property [" + cd.getTitle() + "] for definition [" + cd.getClass().getName() + "]",
                cd.getTitle().contains("component."), is(false));
        // check return properties i18n
        checkAllPropertyI18n(cd.getReturnProperties(), cd, errorCollector);
    }
}
项目:BfROpenLab    文件:WorkflowCloseViewsTest.java   
private void closeViews(final ErrorCollector collector) throws InterruptedException {
    Semaphore done = new Semaphore(1);
    done.acquire();
    SwingUtilities.invokeLater(() -> done.release());
    done.tryAcquire(2, TimeUnit.SECONDS);

    for (Map.Entry<SingleNodeContainer, List<AbstractNodeView<? extends NodeModel>>> e : m_context.getNodeViews()
            .entrySet()) {
        for (AbstractNodeView<? extends NodeModel> view : e.getValue()) {
            try {
                Node.invokeCloseView(view);
            } catch (Exception ex) {
                String msg =
                        "View '" + view + "' of node '" + e.getKey().getNameWithID() + "' has thrown a "
                                + ex.getClass().getSimpleName() + " during close: " + ex.getMessage();
                collector.addError(new Throwable(msg, ex));
            }
        }
    }
}
项目:BfROpenLab    文件:WorkflowUncaughtExceptionsTest.java   
public void run(final ErrorCollector collector) {
    try {
        assert !SwingUtilities.isEventDispatchThread() : "This part must not be executed in the AWT thread";
        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                // do nothing, just wait for all previous events to be processed (e.g. close dialog and views)
            }
        });
        synchronized (m_context.getUncaughtExceptions()) {
            for (Pair<Thread, Throwable> p : m_context.getUncaughtExceptions()) {
                Throwable error = new Throwable("Thread " + p.getFirst().getName() + " has thrown an uncaught "
                                + p.getSecond().getClass().getSimpleName() + ": " + p.getSecond().getMessage(), p.getSecond());
                collector.addError(error);
            }
        }
    } catch (Throwable t) {
        collector.addError(t);
    } finally {
        Thread.setDefaultUncaughtExceptionHandler(null);
    }
}
项目:BfROpenLab    文件:WorkflowCloseTest.java   
public void run(final ErrorCollector collector, WorkflowTestContext m_context) {
    try {
        m_context.getWorkflowManager().shutdown();
        m_context.getWorkflowManager().getParent().removeNode(m_context.getWorkflowManager().getID());

        List<NodeContainer> openWorkflows = new ArrayList<NodeContainer>(WorkflowManager.ROOT.getNodeContainers());
        openWorkflows.removeAll(m_context.getAlreadyOpenWorkflows());
        if (openWorkflows.size() > 0) {
            collector.addError(new Throwable(openWorkflows.size()
                    + " dangling workflows detected: " + openWorkflows));
        }

        Collection<Pair<NodeContainer, StackTraceElement[]>> openBuffers =
            BufferTracker.getInstance().getOpenBuffers();
        if (!openBuffers.isEmpty()) {
            collector.addError(new Throwable(openBuffers.size() + " open buffers detected: "
                + openBuffers.stream().map(p -> p.getFirst().getNameWithID()).collect(Collectors.joining(", "))));
        }
        BufferTracker.getInstance().clear();
    } catch (Throwable t) {
        collector.addError(t);
    }
}
项目:daikon    文件:PropertiesTestUtils.java   
public static Properties checkSerialize(Properties props, ErrorCollector errorCollector) {
    String s = props.toSerialized();
    SerializerDeserializer.Deserialized<Properties> d = Properties.Helper.fromSerializedPersistent(s, Properties.class);
    Properties deserProps = d.object;
    checkAllI18N(deserProps, errorCollector);
    assertFalse(d.migrated);
    List<NamedThing> newProps = deserProps.getProperties();
    List<Form> newForms = deserProps.getForms();
    int i = 0;
    for (NamedThing prop : props.getProperties()) {
        LOGGER.debug(prop.getName());
        assertEquals(prop.getName(), newProps.get(i).getName());
        i++;
    }
    i = 0;
    for (Form form : props.getForms()) {
        LOGGER.debug("Form: " + form.getName());
        Form newForm = newForms.get(i++);
        assertEquals(form.getName(), form.getName());
        for (Widget widget : form.getWidgets()) {
            NamedThing formChild = widget.getContent();
            String name = formChild.getName();
            if (formChild instanceof Form) {
                name = ((Form) formChild).getProperties().getName();
            }
            LOGGER.debug("  prop: " + formChild.getName() + " name to be used: " + name);
            NamedThing newChild = newForm.getWidget(name).getContent();
            String newName = newChild.getName();
            if (newChild instanceof Form) {
                newName = ((Form) newChild).getProperties().getName();
            }
            assertEquals(name, newName);

        }
    }
    return deserProps;

}
项目:daikon    文件:PropertiesTestUtils.java   
/**
 * check all properties of a component for i18n, check form i18n, check ComponentProperties title is i18n
 * 
 * @param defRegistry where to get all the definitions
 * @param errorCollector used to collect all errors at once. @see <a
 * href="http://junit.org/apidocs/org/junit/rules/ErrorCollector.html">ErrorCollector</a>
 */
static public void assertAlli18nAreSetup(DefinitionRegistryService defRegistry, ErrorCollector errorCollector) {
    Collection<Definition> allDefs = defRegistry.getDefinitionsMapByType(Definition.class).values();
    for (Definition def : allDefs) {
        Class propertiesClass = def.getPropertiesClass();
        if (propertiesClass == null) {
            // log it but do not consider it as a error because
            // tComp Wizard ses it with null (this is bad)
            LOGGER.error("Properties class for definition [" + def.getName() + "] should never be null.");
            continue;
        }
        Properties props = PropertiesImpl.createNewInstance(propertiesClass, "root").init();
        // check all properties
        if (props != null) {
            checkAllI18N(props, errorCollector);
        } else {
            LOGGER.info("No properties to check fo I18n for :" + def.getName());
        }
        // check definition name
        errorCollector.checkThat("displayName for definition [" + def.getClass().getName() + "] must not be null",
                def.getDisplayName(), notNullValue());
        errorCollector.checkThat(
                "missing I18n displayName [" + def.getDisplayName() + "] for definition [" + def.getClass().getName() + "]",
                def.getDisplayName(), not(endsWith(Definition.I18N_DISPLAY_NAME_SUFFIX)));
        // check definition title
        errorCollector.checkThat("title for definition [" + def.getClass().getName() + "] must not be null", def.getTitle(),
                notNullValue());
        errorCollector.checkThat(
                "missing I18n title [" + def.getTitle() + "] for definition [" + def.getClass().getName() + "]",
                def.getTitle(), not(endsWith(Definition.I18N_TITLE_NAME_SUFFIX)));
    }
}
项目:daikon    文件:PropertiesTestUtils.java   
/**
 * check that the property has a display name that is translated. We basically checks that is does not end with
 * ".displayName".
 * 
 * @param errorCollector, to collect the error
 * @param prop the property to check for an i18N {@link Property#getDisplayName()}
 * @param parent, used only for the error message to identify the origin of the property
 */
static public void chekProperty(final ErrorCollector errorCollector, Property<?> prop, Object parent) {
    // check that property.getDisplay name has been translated.
    errorCollector.checkThat(
            "property [" + parent.getClass().getCanonicalName() + "#" + prop.getName()
                    + "] should have a translated message key [property." + prop.getName()
                    + ".displayName] in [the proper messages.properties]",
            prop.getDisplayName().endsWith(".displayName"), is(false));
    if (prop.getDisplayName().endsWith(".displayName")) {// display this to help create the I18N file
        System.out.println("property." + prop.getName() + ".displayName=");
    }
}
项目:daikon    文件:TestPropertiesTestUtils.java   
@Test
public void testAssertAlli18nAreSetup() {
    DefinitionRegistryService defRegServ = mock(DefinitionRegistryService.class);
    Definition repDef = when(mock(Definition.class).getName()).thenReturn("NAME").getMock();
    when(repDef.getPropertiesClass()).thenReturn(TestProperties.class);
    when(defRegServ.getDefinitionsMapByType(Definition.class)).thenReturn(Collections.singletonMap("NAME", repDef));

    ErrorCollector errorCollector = spy(new ErrorCollector());
    // check when everything is fine
    assertThat(repDef, notNullValue());
    when(repDef.getDisplayName()).thenReturn("foo");
    when(repDef.getTitle()).thenReturn("bar");

    PropertiesTestUtils.assertAlli18nAreSetup(defRegServ, errorCollector);

    verify(errorCollector, times(0)).addError(any(Throwable.class));

    // check when displayName and title is missing
    errorCollector = spy(new ErrorCollector());
    when(repDef.getDisplayName()).thenReturn(Definition.I18N_DISPLAY_NAME_SUFFIX);
    when(repDef.getTitle()).thenReturn(Definition.I18N_TITLE_NAME_SUFFIX);

    PropertiesTestUtils.assertAlli18nAreSetup(defRegServ, errorCollector);

    verify(errorCollector, times(2)).addError(any(Throwable.class));

    // check when displayName and title are null
    errorCollector = spy(new ErrorCollector());
    when(repDef.getDisplayName()).thenReturn(null);
    when(repDef.getTitle()).thenReturn(null);

    PropertiesTestUtils.assertAlli18nAreSetup(defRegServ, errorCollector);

    verify(errorCollector, times(2)).addError(any(Throwable.class));
}
项目:components    文件:CommonTestUtils.java   
static public void checkAllSchemaPathAreSchemaTypes(ComponentService service, ErrorCollector collector) {
    Set<ComponentDefinition> allComponents = service.getAllComponents();
    for (ComponentDefinition cd : allComponents) {
        ComponentProperties properties = cd.createProperties();
        if (properties instanceof FixedConnectorsComponentProperties) {
            checkAllSchemaPathAreSchemaTypes((FixedConnectorsComponentProperties) properties, collector);
        }
    }
}
项目:components    文件:CommonTestUtils.java   
private static void checkAllConnector(FixedConnectorsComponentProperties fccp, ErrorCollector collector,
        Set<PropertyPathConnector> allConnectors) {
    for (PropertyPathConnector connector : allConnectors) {
        NamedThing property = fccp.getProperty(connector.getPropertyPath());
        collector.checkThat(property, notNullValue());
        collector.checkThat(property, anyOf(instanceOf(Property.class), instanceOf(SchemaProperties.class)));
    }
}
项目:components    文件:ComponentTestUtils.java   
/**
 * check all properties of a component for i18n, check form i18n, check ComponentProperties title is i18n
 * 
 * @param componentService where to get all the components
 * @param errorCollector used to collect all errors at once. @see
 *            <a href="http://junit.org/apidocs/org/junit/rules/ErrorCollector.html">ErrorCollector</a>
 */
static public void assertReturnProperties18nAreSet(DefinitionRegistryService definitionRegistry,
        ErrorCollector errorCollector) {
    Collection<ComponentDefinition> allComponents = definitionRegistry.getDefinitionsMapByType(ComponentDefinition.class)
            .values();
    for (ComponentDefinition cd : allComponents) {
        // check return properties i18n
        checkAllPropertyI18n(cd.getReturnProperties(), cd, errorCollector);
    }
}
项目:components    文件:ComponentTestUtils.java   
public static void checkAllPropertyI18n(Property<?>[] propertyArray, Object parent, ErrorCollector errorCollector) {
    if (propertyArray != null) {
        for (Property<?> prop : propertyArray) {
            PropertiesTestUtils.chekProperty(errorCollector, prop, parent);
        }
    } // else no property to check so ignore.
}
项目:jdbox    文件:LifeCycleManagerResource.java   
public LifeCycleManagerResource(ErrorCollector errorCollector, final List<Module> modules) {
    this.errorCollector = errorCollector;
    this.modules = modules;
    this.lifeCycleManager = new LifeCycleManager(new LinkedList<Module>() {{
        add(new CommonModule());
        addAll(modules);
    }});
}
项目:jdbox    文件:MountedFileSystem.java   
public MountedFileSystem(
        ErrorCollector errorCollector, TempFolderProvider tempFolderProvider,
        LifeCycleManagerResource lifeCycleManager) {
    this.errorCollector = errorCollector;
    this.tempFolderProvider = tempFolderProvider;
    this.lifeCycleManager = lifeCycleManager;
}
项目:BfROpenLab    文件:TestFlowRunner.java   
public TestFlowRunner(ErrorCollector collector, TestrunConfiguration runConfiguration) {
    super();
    this.collector = collector;
    this.m_runConfiguration = runConfiguration;
    if (m_runConfiguration.isLoadSaveLoad()) {
        throw new UnsupportedOperationException("LoadSaveLoad is not supported");
    }
}
项目:BfROpenLab    文件:WorkflowDeprecationTest.java   
public void run(final ErrorCollector collector) {

        try {
            checkForDeprecatedNodes(collector, m_context.getWorkflowManager());
        } catch (Throwable t) {
            collector.addError(t);
        }
    }
项目:BfROpenLab    文件:WorkflowDeprecationTest.java   
private void checkForDeprecatedNodes(final ErrorCollector collector, final WorkflowManager wfm) {
    for (NodeContainer node : wfm.getNodeContainers()) {
        if (node instanceof SingleNodeContainer) {
            if ("true".equals(((SingleNodeContainer)node).getXMLDescription().getAttribute("deprecated"))) {
                 collector.addError(new Throwable("Node '" + node.getName() + "' is deprecated."));
            }
        } else if (node instanceof WorkflowManager) {
            checkForDeprecatedNodes(collector, (WorkflowManager)node);
        } else {
            throw new IllegalStateException("Unknown node container type: " + node.getClass().getName());
        }
    }
}
项目:BfROpenLab    文件:WorkflowCloseViewsTest.java   
public void run(final ErrorCollector collector) {
    try {
        closeViews(collector);
    } catch (Throwable t) {
        collector.addError(t);
    }
}
项目:BfROpenLab    文件:WorkflowNodeMessagesTest.java   
public void run(final ErrorCollector collector) {

        try {
            checkNodeMessages(collector, m_context.getWorkflowManager(), m_context.getTestflowConfiguration());
        } catch (Throwable t) {
            collector.addError(t);
        }
    }
项目:BfROpenLab    文件:WorkflowNodeMessagesTest.java   
private void checkNodeMessages(final ErrorCollector collector, final WorkflowManager wfm,
    final TestflowConfiguration flowConfiguration) {
    for (NodeContainer node : wfm.getNodeContainers()) {
        if (!m_context.isPreExecutedNode(node)) {
            if (node instanceof SubNodeContainer) {
                checkNodeMessages(collector, ((SubNodeContainer)node).getWorkflowManager(), flowConfiguration);
            } else if (node instanceof WorkflowManager) {
                checkNodeMessages(collector, (WorkflowManager)node, flowConfiguration);
                checkSingleNode(collector, node, flowConfiguration);
            } else {
                checkSingleNode(collector, node, flowConfiguration);
            }
        }
    }
}
项目:BfROpenLab    文件:WorkflowHiliteTest.java   
public void run(final ErrorCollector collector) {
    try {
        hiliteRows(collector, m_context.getWorkflowManager(), m_context.getTestflowConfiguration());
    } catch (Throwable t) {
        collector.addError(t);
    }
}
项目:BfROpenLab    文件:WorkflowHiliteTest.java   
private void hiliteRows(final ErrorCollector collector, final WorkflowManager manager,
                        final TestflowConfiguration flowConfiguration) {
    for (NodeContainer cont : manager.getNodeContainers()) {
        if (cont instanceof WorkflowManager) {
            hiliteRows(collector, (WorkflowManager)cont, flowConfiguration);
        } else if (cont instanceof SingleNodeContainer) {
            hiliteRows(collector, (SingleNodeContainer)cont, flowConfiguration);

        }
    }
}
项目:BfROpenLab    文件:WorkflowHiliteTest.java   
private void hiliteRows(final ErrorCollector collector, final SingleNodeContainer node,
                        final TestflowConfiguration flowConfiguration) {
    for (int i = 0; i < node.getNrOutPorts(); i++) {
        if (node.getOutputObject(i) instanceof BufferedDataTable) {
            int max = flowConfiguration.getMaxHiliteRows();

            List<RowKey> keys = new ArrayList<RowKey>();
            CloseableRowIterator it = ((BufferedDataTable)node.getOutputObject(i)).iterator();
            while (it.hasNext() && max-- > 0) {
                keys.add(it.next().getKey());
            }
            it.close();

            HiLiteHandler handler = node.getOutputHiLiteHandler(i);
            // hilite all
            handler.fireHiLiteEvent(new HashSet<RowKey>(keys));
            // unhilite sonme
            handler.fireUnHiLiteEvent(new HashSet<RowKey>(keys.subList((int) (0.1 * keys.size()),
                                                                     (int) Math.ceil(0.6 * keys.size()))));
            // unhilite all
            handler.fireClearHiLiteEvent();
        }
    }
}
项目:BfROpenLab    文件:WorkflowLoadTest.java   
public void run(final ErrorCollector collector) {
    try {
        m_context.setWorkflowManager(loadWorkflow(this, collector, m_workflowDir, m_testcaseRoot, m_runConfiguration));
    } catch (Throwable t) {
        collector.addError(t);
    }
}
项目:BfROpenLab    文件:WorkflowLoadTest.java   
static WorkflowManager loadWorkflow(final WorkflowTest test, final ErrorCollector collector, final File workflowDir,
    final File testcaseRoot, final TestrunConfiguration runConfig) throws IOException, InvalidSettingsException,
    CanceledExecutionException, UnsupportedWorkflowVersionException, LockFailedException {
    WorkflowLoadHelper loadHelper = new WorkflowLoadHelper() {
        /**
         * {@inheritDoc}
         */
        @Override
        public WorkflowContext getWorkflowContext() {
            WorkflowContext.Factory fac = new WorkflowContext.Factory(workflowDir);
            fac.setMountpointRoot(testcaseRoot);
            return fac.createContext();
        }
    };

    WorkflowLoadResult loadRes = WorkflowManager.loadProject(workflowDir, new ExecutionMonitor(), loadHelper);
    if ((loadRes.getType() == LoadResultEntryType.Error)
        || ((loadRes.getType() == LoadResultEntryType.DataLoadError) && loadRes.getGUIMustReportDataLoadErrors())) {
        collector.addError(new Throwable(loadRes.getFilteredError("", LoadResultEntryType.Error)));
    }
    if (runConfig.isCheckForLoadWarnings() && loadRes.hasWarningEntries()) {
        collector.addError(new Throwable(loadRes.getFilteredError("", LoadResultEntryType.Warning)));
    }

    WorkflowManager wfm = loadRes.getWorkflowManager();
    wfm.addWorkflowVariables(true, runConfig.getFlowVariables());
    return wfm;
}
项目:BfROpenLab    文件:WorkflowOpenViewsTest.java   
public void run(final ErrorCollector collector) {

        try {
            openViews(collector, m_context.getWorkflowManager());
        } catch (Throwable t) {
            collector.addError(t);
        }
    }
项目:BfROpenLab    文件:WorkflowMemLeakTest.java   
public void run(final ErrorCollector collector) {
    try {
        MemoryUsage currentUsage = getHeapUsage();
        long diff = currentUsage.getUsed() - m_initalUsage.getUsed();
        if (diff > m_runConfiguration.getAllowedMemoryIncrease()) {
            collector.addError(new Throwable("Heap usage increased by " + diff
                    + " bytes which is more than the allowed " + m_runConfiguration.getAllowedMemoryIncrease()
                    + "bytes (before test: " + m_initalUsage.getUsed() + ", after test: " + currentUsage.getUsed()));
        }
    } catch (Throwable t) {
        collector.addError(t);
    }
}
项目:BfROpenLab    文件:WorkflowLogMessagesTest.java   
public void run(final ErrorCollector collector, TestflowConfiguration flowConfiguration) {
    try {
        Logger.getRootLogger().removeAppender(m_logAppender);
        checkLogMessages(collector, flowConfiguration);
    } catch (Throwable t) {
        collector.addError(t);
    } finally {
        Logger.getRootLogger().removeAppender(m_logAppender);
        m_logEvents.clear();
    }
}
项目:BfROpenLab    文件:WorkflowDialogsTest.java   
public void run(final ErrorCollector collector) {
    try {
        checkDialogs(collector, m_context.getWorkflowManager());
    } catch (Throwable t) {
        collector.addError(t);
    }
}
项目:BfROpenLab    文件:WorkflowSaveTest.java   
public void run(final ErrorCollector collector) {
    if (m_saveLocation != null) {
        try {
            saveWorkflow();
        } catch (Throwable t) {
            collector.addError(t);
        }
    }
}
项目:tracee    文件:DelegateTpicToAsyncExecutionInterceptorIT.java   
@Async
public void getStringInFuture(ErrorCollector collector) {
    final String backendValue = traceeBackend.get("myKey");
    collector.checkThat(backendValue, notNullValue());
    collector.checkThat(oldVals, not(hasItem(backendValue)));
    oldVals.add(backendValue);
    invocationCount.incrementAndGet();
}
项目:rpc-comparison    文件:FunctionSyncTest.java   
public Helper(ErrorCollector collector) {
    this.collector = collector;
}
项目:rpc-comparison    文件:FunctionAsyncTest.java   
public Helper(ErrorCollector collector) {
    this.collector = collector;
}
项目:rpc-comparison    文件:FunctionTest.java   
public SyncHelper(ErrorCollector collector) {
    this.collector = collector;
}
项目:rpc-comparison    文件:FunctionTest.java   
public AsyncHelper(ErrorCollector collector) {
    this.collector = collector;
}
项目:rpc-comparison    文件:FunctionTest.java   
public Helper(ErrorCollector collector) {
    this.collector = collector;
}
项目:daikon    文件:TestPropertiesTestUtils.java   
@Test
public void testAssertAnIconIsSetup() {
    // create a registry with one definition
    DefinitionRegistryService defRegServ = mock(DefinitionRegistryService.class);
    Definition repDef = when(mock(ADefinition.class).getName()).thenReturn("NAME").getMock();
    when(repDef.getPropertiesClass()).thenReturn(TestProperties.class);
    when(defRegServ.getDefinitionsMapByType(Definition.class)).thenReturn(Collections.singletonMap("NAME", repDef));

    // check when everything is fine
    assertThat(repDef, notNullValue());

    // There is a PNG icon available.
    ErrorCollector errorCollector = spy(new ErrorCollector());
    when(repDef.getImagePath(DefinitionImageType.PALETTE_ICON_32X32))
            .thenReturn("/org/talend/daikon/properties/messages.properties");
    when(repDef.getImagePath(DefinitionImageType.SVG_ICON)).thenReturn(null);
    when(repDef.getIconKey()).thenReturn(null);

    PropertiesTestUtils.assertAnIconIsSetup(defRegServ, errorCollector);
    verify(errorCollector, times(0)).addError(any(Throwable.class));

    // There is an SVG icon available.
    errorCollector = spy(new ErrorCollector());
    when(repDef.getImagePath(DefinitionImageType.PALETTE_ICON_32X32)).thenReturn(null);
    when(repDef.getImagePath(DefinitionImageType.SVG_ICON)).thenReturn("/org/talend/daikon/properties/messages.properties");
    when(repDef.getIconKey()).thenReturn(null);

    PropertiesTestUtils.assertAnIconIsSetup(defRegServ, errorCollector);
    verify(errorCollector, times(0)).addError(any(Throwable.class));

    // There is an iconKey available.
    errorCollector = spy(new ErrorCollector());
    when(repDef.getImagePath(DefinitionImageType.PALETTE_ICON_32X32)).thenReturn(null);
    when(repDef.getImagePath(DefinitionImageType.SVG_ICON)).thenReturn(null);
    when(repDef.getIconKey()).thenReturn("icon-key");

    PropertiesTestUtils.assertAnIconIsSetup(defRegServ, errorCollector);
    verify(errorCollector, times(0)).addError(any(Throwable.class));

    // check when no icon information is present
    errorCollector = spy(new ErrorCollector());
    when(repDef.getImagePath(DefinitionImageType.PALETTE_ICON_32X32)).thenReturn(null);
    when(repDef.getImagePath(DefinitionImageType.SVG_ICON)).thenReturn(null);
    when(repDef.getIconKey()).thenReturn(null);

    PropertiesTestUtils.assertAnIconIsSetup(defRegServ, errorCollector);
    verify(errorCollector, times(1)).addError(any(Throwable.class));

    // There is a PNG icon available, but the path is wrong
    errorCollector = spy(new ErrorCollector());
    when(repDef.getImagePath(DefinitionImageType.PALETTE_ICON_32X32)).thenReturn("foo");
    when(repDef.getImagePath(DefinitionImageType.SVG_ICON)).thenReturn(null);
    when(repDef.getIconKey()).thenReturn(null);

    PropertiesTestUtils.assertAnIconIsSetup(defRegServ, errorCollector);
    verify(errorCollector, times(1)).addError(any(Throwable.class));

    // There is an SVG icon available.
    errorCollector = spy(new ErrorCollector());
    when(repDef.getImagePath(DefinitionImageType.PALETTE_ICON_32X32)).thenReturn(null);
    when(repDef.getImagePath(DefinitionImageType.SVG_ICON)).thenReturn("foo");
    when(repDef.getIconKey()).thenReturn(null);

    PropertiesTestUtils.assertAnIconIsSetup(defRegServ, errorCollector);
    verify(errorCollector, times(1)).addError(any(Throwable.class));
}
项目:components    文件:CommonTestUtils.java   
static public void checkAllSchemaPathAreSchemaTypes(FixedConnectorsComponentProperties fccp, ErrorCollector collector) {
    Set<PropertyPathConnector> allConnectors = fccp.getAllSchemaPropertiesConnectors(true);
    checkAllConnector(fccp, collector, allConnectors);
    allConnectors = fccp.getAllSchemaPropertiesConnectors(false);
    checkAllConnector(fccp, collector, allConnectors);
}
项目:components    文件:ComponentTestUtils.java   
public static Properties checkSerialize(Properties props, ErrorCollector errorCollector) {
    return PropertiesTestUtils.checkSerialize(props, errorCollector);
}
项目:components    文件:ComponentTestUtils.java   
static public void checkAllI18N(Properties checkedProps, ErrorCollector errorCollector) {
    PropertiesTestUtils.checkAllI18N(checkedProps, errorCollector);
}