Exemplo n.º 1
0
  public void testInvalidConfig() {
    ConfigurationRevisionEventType config = new ConfigurationRevisionEventType();
    tryInvalidConfig(
        "abc",
        config,
        "Required base event type name is not set in the configuration for revision event type 'abc'");

    epService.getEPAdministrator().getConfiguration().addEventType("MyEvent", SupportBean.class);
    epService
        .getEPAdministrator()
        .getConfiguration()
        .addEventType("MyComplex", SupportBeanComplexProps.class);
    epService
        .getEPAdministrator()
        .getConfiguration()
        .addEventType("MyTypeChange", SupportBeanTypeChange.class);

    config.addNameBaseEventType("XYZ");
    tryInvalidConfig(
        "abc",
        config,
        "Could not locate event type for name 'XYZ' in the configuration for revision event type 'abc'");

    config.getNameBaseEventTypes().clear();
    config.addNameBaseEventType("MyEvent");
    tryInvalidConfig(
        "abc",
        config,
        "Required key properties are not set in the configuration for revision event type 'abc'");

    config.addNameBaseEventType("AEvent");
    config.addNameBaseEventType("AEvent");
    tryInvalidConfig(
        "abc",
        config,
        "Only one base event type name may be added to revision event type 'abc', multiple base types are not yet supported");

    config.getNameBaseEventTypes().clear();
    config.addNameBaseEventType("MyEvent");
    config.setKeyPropertyNames(new String[0]);
    tryInvalidConfig(
        "abc",
        config,
        "Required key properties are not set in the configuration for revision event type 'abc'");

    config.setKeyPropertyNames(new String[] {"xyz"});
    tryInvalidConfig(
        "abc",
        config,
        "Key property 'xyz' as defined in the configuration for revision event type 'abc' does not exists in event type 'MyEvent'");

    config.setKeyPropertyNames(new String[] {"intPrimitive"});
    config.addNameDeltaEventType("MyComplex");
    tryInvalidConfig(
        "abc",
        config,
        "Key property 'intPrimitive' as defined in the configuration for revision event type 'abc' does not exists in event type 'MyComplex'");

    config.addNameDeltaEventType("XYZ");
    tryInvalidConfig(
        "abc",
        config,
        "Could not locate event type for name 'XYZ' in the configuration for revision event type 'abc'");

    config.getNameDeltaEventTypes().clear();
    config.setKeyPropertyNames(new String[] {"intBoxed"});
    config.addNameDeltaEventType("MyTypeChange"); // invalid intPrimitive property type
    tryInvalidConfig(
        "abc",
        config,
        "Property named 'intPrimitive' does not have the same type for base and delta types of revision event type 'abc'");

    config.getNameDeltaEventTypes().clear();
    epService.getEPAdministrator().getConfiguration().addRevisionEventType("abc", config);
  }