org.junit.rules.ErrorCollector Java Examples

The following examples show how to use org.junit.rules.ErrorCollector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComponentTestUtils.java    From components with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #2
Source File: FakeWindmillServer.java    From beam with Apache License 2.0 5 votes vote down vote up
public FakeWindmillServer(ErrorCollector errorCollector) {
  workToOffer = new ConcurrentLinkedQueue<>();
  dataToOffer = new ConcurrentLinkedQueue<>();
  commitsReceived = new ConcurrentHashMap<>();
  exceptions = new LinkedBlockingQueue<>();
  expectedExceptionCount = new AtomicInteger();
  this.errorCollector = errorCollector;
  statsReceived = new ArrayList<>();
  droppedStreamingCommits = new AtomicInteger();
}
 
Example #3
Source File: CommonTestUtils.java    From components with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #4
Source File: CommonTestUtils.java    From components with Apache License 2.0 5 votes vote down vote up
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)));
    }
}
 
Example #5
Source File: ComponentTestUtils.java    From components with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #6
Source File: ComponentTestUtils.java    From components with Apache License 2.0 5 votes vote down vote up
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.
}
 
Example #7
Source File: TraceMetadataVerifier.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
void verifyAnnotationKeys(ErrorCollector collector) {
    collector.checkThat("No annotation keys registered.", traceMetadataSetupContext.dynamicAnnotationKeys, is(not(empty())));
    for (Map.Entry<Integer, List<String>> e : annotationKeyNamesByCode.entrySet()) {
        Integer annotationKeyCode = e.getKey();
        List<String> annotationKeyNames = e.getValue();
        collector.checkThat("Duplicate annotation keys. Code : " + annotationKeyCode + ", names : " + annotationKeyNames,
                annotationKeyNames, hasSize(1));
    }
}
 
Example #8
Source File: DelegateTpicToAsyncExecutionInterceptorIT.java    From tracee with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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();
}
 
Example #9
Source File: CommonTestUtils.java    From components with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example #10
Source File: ComponentTestUtils.java    From components with Apache License 2.0 4 votes vote down vote up
public static Properties checkSerialize(Properties props, ErrorCollector errorCollector) {
    return PropertiesTestUtils.checkSerialize(props, errorCollector);
}
 
Example #11
Source File: ComponentTestUtils.java    From components with Apache License 2.0 4 votes vote down vote up
static public void checkAllI18N(Properties checkedProps, ErrorCollector errorCollector) {
    PropertiesTestUtils.checkAllI18N(checkedProps, errorCollector);
}