#
# Copyright (C) 2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# To test extract KieServerState data, use the following oc command example:
# oc get configmap -o=jsonpath='{range .items[?(@.metadata.name=="myapp2-kieserver")]}{.data.kie-server-state}{"\n"}{end}'
#
# To manually test dc rollout triggered by KieServerState change, touch ConfigMap with this annotation
#   oc annotate cm/myapp2-kieserver services.server.kie.org/openshift-startup-strategy.rolloutRequired=true

apiVersion: v1
kind: ConfigMap
metadata:
  name: myapp2-kieserver-6
  labels:
    services.server.kie.org/kie-server-state: DETACHED
    services.server.kie.org/kie-server-id: myapp2-kieserver-detached-bc
    application: myapp2
  annotations:
    test.annotation: must_be_kept
data:
  kie-server-state: |
    <kie-server-state>
      <controllers>
        <string>ws://172.30.111.77:8080/websocket/controller</string>
      </controllers>
      <configuration>
        <configItems>
          <config-item>
            <name>org.kie.server.location</name>
            <value>http://myapp2-kieserver-myproject.127.0.0.1.nip.io:80/services/rest/server</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.persistence.ds</name>
            <value>java:/jboss/datasources/ExampleDS</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.repo</name>
            <value>/home/jboss/.kie/repository</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.sync.deploy</name>
            <value>true</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.domain</name>
            <value>other</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.bypass.auth.user</name>
            <value>false</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.persistence.tm</name>
            <value>org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.controller.user</name>
            <value>controllerUser</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.controller</name>
            <value>ws://172.30.111.77:8080/websocket/controller</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.user</name>
            <value>executionUser</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.pwd</name>
            <value>RedHat</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.id</name>
            <value>myapp2-kieserver-detached-bc</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.persistence.dialect</name>
            <value>org.hibernate.dialect.H2Dialect</value>
            <type>java.lang.String</type>
          </config-item>
          <config-item>
            <name>org.kie.server.controller.pwd</name>
            <value>RedHat</value>
            <type>java.lang.String</type>
          </config-item>
        </configItems>
      </configuration>
      <containers>
        <container>
          <containerId>mortgages_1.0.0-SNAPSHOT</containerId>
          <releaseId>
            <groupId>mortgages</groupId>
            <artifactId>mortgages</artifactId>
            <version>1.0.0-SNAPSHOT</version>
          </releaseId>
          <status>STARTED</status>
          <scanner>
            <status>STOPPED</status>
          </scanner>
          <configItems>
            <config-item>
              <name>KBase</name>
              <value></value>
              <type>BPM</type>
            </config-item>
            <config-item>
              <name>KSession</name>
              <value></value>
              <type>BPM</type>
            </config-item>
            <config-item>
              <name>MergeMode</name>
              <value>MERGE_COLLECTIONS</value>
              <type>BPM</type>
            </config-item>
            <config-item>
              <name>RuntimeStrategy</name>
              <value>SINGLETON</value>
              <type>BPM</type>
            </config-item>
          </configItems>
          <messages/>
          <containerAlias>mortgages</containerAlias>
        </container>
        <container>
          <containerId>mortgage-process_1.0.0-SNAPSHOT</containerId>
          <releaseId>
            <groupId>mortgage-process</groupId>
            <artifactId>mortgage-process</artifactId>
            <version>1.0.0-SNAPSHOT</version>
          </releaseId>
          <status>STARTED</status>
          <scanner>
            <status>STOPPED</status>
          </scanner>
          <configItems>
            <config-item>
              <name>KBase</name>
              <value></value>
              <type>BPM</type>
            </config-item>
            <config-item>
              <name>KSession</name>
              <value></value>
              <type>BPM</type>
            </config-item>
            <config-item>
              <name>MergeMode</name>
              <value>MERGE_COLLECTIONS</value>
              <type>BPM</type>
            </config-item>
            <config-item>
              <name>RuntimeStrategy</name>
              <value>PER_PROCESS_INSTANCE</value>
              <type>BPM</type>
            </config-item>
          </configItems>
          <messages/>
          <containerAlias>mortgage-process</containerAlias>
        </container>
      </containers>
    </kie-server-state>