#
# 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-stopped
  labels:
    services.server.kie.org/kie-server-state: USED
    application: myapp2
  annotations:
    test.annotation: must_be_kept
data:
  kie-server-state: |
   <kie-server-state>
     <controllers/>
     <configuration>
       <configItems>
         <config-item>
           <name>org.kie.server.id</name>
           <value>myapp-kieserver</value>
           <type>java.lang.String</type>
         </config-item>
         <config-item>
           <name>org.kie.server.location</name>
           <value>http://172.30.99.129:8080/services/rest/server</value>
           <type>java.lang.String</type>
         </config-item>
       </configItems>
     </configuration>
     <containers>
       <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>STOPPED</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>
