EAP_ZIP=jboss-eap-8.0.0.GA-redhat-20231106.zip
EAP_FOLDER=jboss-eap-8.0
rm -rdf ${EAP_FOLDER}_1
rm -rdf ${EAP_FOLDER}_2
unzip -q $EAP_ZIP
cp -r $EAP_FOLDER ${EAP_FOLDER}_2
mv $EAP_FOLDER ${EAP_FOLDER}_1
cat <<EOF > $PWD/test1.cli
embed-server --server-config=standalone-ha.xml
if (outcome != success) of /subsystem=jgroups:read-attribute(name=default-stack)
/subsystem=jgroups/channel=ee:write-attribute(name=stack,value=tcp)
else
/subsystem=jgroups:write-attribute(name=default-stack,value=tcp)
/subsystem=jgroups/channel=ee:write-attribute(name=stack,value=tcp)
end-if
/subsystem=transactions:write-attribute(name=node-identifier,value=wildfly1)
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=remote-jdg-server1:add(host=127.0.0.1, port=11322)
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=remote-jdg-server2:add(host=127.0.0.1, port=11422)
batch
/subsystem=infinispan/remote-cache-container=session_data_cc:add(default-remote-cluster=jdg-server-cluster, protocol-version=3.1, statistics-enabled=true, properties={infinispan.client.hotrod.auth_username=admin, infinispan.client.hotrod.auth_password=pass.1234})
/subsystem=infinispan/remote-cache-container=session_data_cc/remote-cluster=jdg-server-cluster:add(socket-bindings=[remote-jdg-server1,remote-jdg-server2])
run-batch
if (outcome == success) of /subsystem=infinispan/remote-cache-container=session_data_cc:read-attribute(name=modules)
/subsystem=infinispan/remote-cache-container=session_data_cc:write-attribute(name=modules,value=[org.wildfly.clustering.web.hotrod])
else
/subsystem=infinispan/remote-cache-container=session_data_cc:write-attribute(name=module,value=org.wildfly.clustering.web.hotrod)
end-if
/subsystem=distributable-web/hotrod-session-management=sm_offload:add(remote-cache-container=session_data_cc, granularity=ATTRIBUTE)
/subsystem=distributable-web/hotrod-session-management=sm_offload/affinity=local:add()
/subsystem=distributable-web/hotrod-session-management=sm_offload_granular:add(remote-cache-container=session_data_cc, granularity=ATTRIBUTE)
/subsystem=distributable-web/hotrod-session-management=sm_offload_granular/affinity=local:add()
if (outcome == success) of /subsystem=infinispan/remote-cache-container=session_data_cc:read-children-resources(child-type=near-cache)
/subsystem=infinispan/remote-cache-container=session_data_cc/near-cache=invalidation:add(max-entries=1000)
end-if
/subsystem=distributable-web:write-attribute(name=default-session-management,value=sm_offload_granular)
if (outcome == success) of /subsystem=infinispan/remote-cache-container=session_data_cc:read-attribute(name=marshaller)
/subsystem=infinispan/remote-cache-container=session_data_cc:write-attribute(name=marshaller,value=PROTOSTREAM)
end-if
EOF
./${EAP_FOLDER}_1/bin/jboss-cli.sh --file=$PWD/test1.cli
cat <<EOF > $PWD/test2.cli
embed-server --server-config=standalone-ha.xml
if (outcome != success) of /subsystem=jgroups:read-attribute(name=default-stack)
/subsystem=jgroups/channel=ee:write-attribute(name=stack,value=tcp)
else
/subsystem=jgroups:write-attribute(name=default-stack,value=tcp)
/subsystem=jgroups/channel=ee:write-attribute(name=stack,value=tcp)
end-if
/subsystem=transactions:write-attribute(name=node-identifier,value=wildfly2)
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=remote-jdg-server1:add(host=127.0.0.1, port=11322)
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=remote-jdg-server2:add(host=127.0.0.1, port=11422)
batch
/subsystem=infinispan/remote-cache-container=session_data_cc:add(default-remote-cluster=jdg-server-cluster, protocol-version=3.1, statistics-enabled=true, properties={infinispan.client.hotrod.auth_username=admin, infinispan.client.hotrod.auth_password=pass.1234})
/subsystem=infinispan/remote-cache-container=session_data_cc/remote-cluster=jdg-server-cluster:add(socket-bindings=[remote-jdg-server1,remote-jdg-server2])
run-batch
if (outcome == success) of /subsystem=infinispan/remote-cache-container=session_data_cc:read-attribute(name=modules)
/subsystem=infinispan/remote-cache-container=session_data_cc:write-attribute(name=modules,value=[org.wildfly.clustering.web.hotrod])
else
/subsystem=infinispan/remote-cache-container=session_data_cc:write-attribute(name=module,value=org.wildfly.clustering.web.hotrod)
end-if
/subsystem=distributable-web/hotrod-session-management=sm_offload:add(remote-cache-container=session_data_cc, granularity=ATTRIBUTE)
/subsystem=distributable-web/hotrod-session-management=sm_offload/affinity=local:add()
/subsystem=distributable-web/hotrod-session-management=sm_offload_granular:add(remote-cache-container=session_data_cc, granularity=ATTRIBUTE)
/subsystem=distributable-web/hotrod-session-management=sm_offload_granular/affinity=local:add()
if (outcome == success) of /subsystem=infinispan/remote-cache-container=session_data_cc:read-children-resources(child-type=near-cache)
/subsystem=infinispan/remote-cache-container=session_data_cc/near-cache=invalidation:add(max-entries=1000)
end-if
/subsystem=distributable-web:write-attribute(name=default-session-management,value=sm_offload_granular)
if (outcome == success) of /subsystem=infinispan/remote-cache-container=session_data_cc:read-attribute(name=marshaller)
/subsystem=infinispan/remote-cache-container=session_data_cc:write-attribute(name=marshaller,value=PROTOSTREAM)
end-if
EOF
./${EAP_FOLDER}_2/bin/jboss-cli.sh --file=$PWD/test2.cli
export CLUSTERBENCH_EAR=clusterbench-ee10.ear
cp $CLUSTERBENCH_EAR ${EAP_FOLDER}_1/standalone/deployments/
cp $CLUSTERBENCH_EAR ${EAP_FOLDER}_2/standalone/deployments/