<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:kie="http://drools.org/schema/kie-aries-blueprint/1.0.0"
           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0
           http://drools.org/schema/kie-aries-blueprint/1.0.0 http://drools.org/schema/kie-aries-blueprint/1.0.0">

  <bean id="my-globals"      class="org.drools.core.base.MapGlobalResolver"/>
  <bean id="my-calendars"    class="org.drools.core.base.CalendarsImpl"/>

  <bean id="ds" class="org.kie.aries.blueprint.mocks.MockDataSource">
    <property name="driverClassName" value="org.h2.Driver"/>
    <property name="url" value="jdbc:h2:tcp://localhost/DroolsFlow"/>
    <property name="username" value="sa"/>
    <property name="password" value=""/>
  </bean>

  <bean id="myEmf" class="org.kie.aries.blueprint.mocks.MockEntityManager">
    <property name="dataSource" ref="ds"/>
    <property name="persistenceUnitName" value="org.kie.persistence.jpa.local"/>
  </bean>

  <bean id="txManager" class="org.kie.aries.blueprint.mocks.MockJpaTransactionManager">
    <property name="entityManagerFactory" ref="myEmf"/>
  </bean>

  <bean id="mock-custom-strategy" class="org.kie.aries.blueprint.mocks.MockObjectMarshallingStrategy"/>

  <kie:environment id="drools-env">

    <kie:entity-manager-factory ref="myEmf"/>
    <kie:transaction-manager ref="txManager"/>
    <kie:user-transaction ref="txManager"/>
    <kie:transaction-sync-registry ref="txManager"/>
    <kie:globals ref="my-globals" />
    <kie:calendars ref="my-calendars" />

    <kie:object-marshalling-strategies>
      <kie:serializable-placeholder-resolver-strategy strategy-acceptor-ref="default-acceptor"/>
      <kie:identity-placeholder-resolver-strategy strategy-acceptor-ref="default-acceptor"/>
      <kie:jpa-placeholder-resolver-strategy/>
      <kie:process-instance-resolver-strategy/>
    </kie:object-marshalling-strategies>

  </kie:environment>

  <kie:environment id="drools-empty-env">

  </kie:environment>

  <kie:environment id="drools-env-custom-marshaller-ref">

    <kie:entity-manager-factory ref="myEmf"/>

    <kie:object-marshalling-strategies>
      <kie:custom-marshalling-strategy ref="mock-custom-strategy"/>
    </kie:object-marshalling-strategies>

  </kie:environment>

  <kie:environment id="drools-env-custom-marshaller-mixed">

    <kie:entity-manager-factory ref="myEmf"/>

    <kie:object-marshalling-strategies>
      <kie:serializable-placeholder-resolver-strategy strategy-acceptor-ref="default-acceptor"/>
      <kie:identity-placeholder-resolver-strategy strategy-acceptor-ref="default-acceptor"/>
      <kie:jpa-placeholder-resolver-strategy />
      <kie:custom-marshalling-strategy ref="mock-custom-strategy"/>
      <kie:process-instance-resolver-strategy/>
    </kie:object-marshalling-strategies>

  </kie:environment>
  <bean id="default-acceptor" class="org.drools.core.marshalling.impl.ClassObjectMarshallingStrategyAcceptor">
    <argument>
      <list>
        <value>*.*</value>
      </list>
    </argument>
  </bean>

</blueprint>