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);
  }
  public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();

    config.addEventType("SupportBean", SupportBean.class);
    config.addEventType("FullEvent", SupportRevisionFull.class);
    config.addEventType("D1", SupportDeltaOne.class);
    config.addEventType("D2", SupportDeltaTwo.class);
    config.addEventType("D3", SupportDeltaThree.class);
    config.addEventType("D4", SupportDeltaFour.class);
    config.addEventType("D5", SupportDeltaFive.class);

    ConfigurationRevisionEventType configRev = new ConfigurationRevisionEventType();
    configRev.setKeyPropertyNames(new String[] {"k0"});
    configRev.addNameBaseEventType("FullEvent");
    configRev.addNameDeltaEventType("D1");
    configRev.addNameDeltaEventType("D2");
    configRev.addNameDeltaEventType("D3");
    configRev.addNameDeltaEventType("D4");
    configRev.addNameDeltaEventType("D5");
    config.addRevisionEventType("RevisableQuote", configRev);

    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    listenerOne = new SupportUpdateListener();
    listenerTwo = new SupportUpdateListener();
    listenerThree = new SupportUpdateListener();

    stmtCreateWin =
        epService
            .getEPAdministrator()
            .createEPL("create window RevQuote.win:keepall() as select * from RevisableQuote");
    epService.getEPAdministrator().createEPL("insert into RevQuote select * from FullEvent");
    epService.getEPAdministrator().createEPL("insert into RevQuote select * from D1");
    epService.getEPAdministrator().createEPL("insert into RevQuote select * from D2");
    epService.getEPAdministrator().createEPL("insert into RevQuote select * from D3");
    epService.getEPAdministrator().createEPL("insert into RevQuote select * from D4");
    epService.getEPAdministrator().createEPL("insert into RevQuote select * from D5");

    // assert type metadata
    EventTypeSPI type =
        (EventTypeSPI)
            ((EPServiceProviderSPI) epService)
                .getValueAddEventService()
                .getValueAddProcessor("RevQuote")
                .getValueAddEventType();
    assertEquals(null, type.getMetadata().getOptionalApplicationType());
    assertEquals(null, type.getMetadata().getOptionalSecondaryNames());
    assertEquals("RevisableQuote", type.getMetadata().getPrimaryName());
    assertEquals("RevisableQuote", type.getMetadata().getPublicName());
    assertEquals("RevisableQuote", type.getName());
    assertEquals(EventTypeMetadata.TypeClass.REVISION, type.getMetadata().getTypeClass());
    assertEquals(true, type.getMetadata().isApplicationConfigured());
    assertEquals(true, type.getMetadata().isApplicationPreConfigured());
    assertEquals(true, type.getMetadata().isApplicationPreConfiguredStatic());

    EventType[] valueAddTypes =
        ((EPServiceProviderSPI) epService).getValueAddEventService().getValueAddedTypes();
    assertEquals(1, valueAddTypes.length);
    assertSame(type, valueAddTypes[0]);

    ArrayAssertionUtil.assertEqualsAnyOrder(
        new Object[] {
          new EventPropertyDescriptor("k0", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor("p0", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor("p1", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor("p2", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor("p3", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor("p4", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor("p5", String.class, null, false, false, false, false, false)
        },
        type.getPropertyDescriptors());
  }