Redeploy channels and procedures during recovery

Use the GlobalRecoveryManager extension to redeploy channels/procedures
Restart execution of channels during recovery
Some code cleanup
Added recovery test

Change-Id: I6897ccf9cddb9ec8d10256e252ee893afe6db145
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.1.ddl.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.1.ddl.sqlpp
new file mode 100644
index 0000000..bab0849
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.1.ddl.sqlpp
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Restart cluster and confirm that channels and procedures still work
+* Expected Res : Success
+* Date         : 2018
+* Author       : Steven Jacobs
+*/
+
+drop dataverse two if exists;
+drop dataverse channels if exists;
+create dataverse channels;
+use channels;
+
+create type userLocation as {
+  userId: int,
+  roomNumber: int
+};
+
+create dataset UserLocations(userLocation)
+primary key userId;
+
+create function RoomOccupants(room) {
+  (select location.userId
+  from UserLocations location
+  where location.roomNumber = room)
+};
+
+create broker brokerA at "http://www.notifyA.com";
+
+create repetitive channel roomRecords using RoomOccupants@1 period duration("PT5S");
+
+create procedure selectSome(r) {
+select roomNumber from channels.UserLocations
+where roomNumber = r
+order by userId
+};
+
+create procedure deleteSome(r) {
+delete from channels.UserLocations
+where roomNumber = r
+};
+
+create procedure addMe() {
+  insert into channels.UserLocations([
+    {"userId":2, "roomNumber":123}]
+  )
+};
+
+upsert into UserLocations([
+{"userId":1, "roomNumber":123},
+{"userId":3, "roomNumber":350}]
+);
+
+create repetitive channel roomRecords2 using RoomOccupants@1 period duration("PT5S");
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.10.update.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.10.update.sqlpp
new file mode 100644
index 0000000..65386e7
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.10.update.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that procedure still works after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+
+use channels;
+
+execute addMe();
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.11.query.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.11.query.sqlpp
new file mode 100644
index 0000000..f72d947
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.11.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that procedure still works after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+
+use channels;
+
+execute selectSome(123);
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.12.update.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.12.update.sqlpp
new file mode 100644
index 0000000..00a6277
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.12.update.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that procedure still works after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+
+use channels;
+
+execute deleteSome(123);
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.13.query.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.13.query.sqlpp
new file mode 100644
index 0000000..f72d947
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.13.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that procedure still works after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+
+use channels;
+
+execute selectSome(123);
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.14.ddl.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.14.ddl.sqlpp
new file mode 100644
index 0000000..dc023c4
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.14.ddl.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that channel is still running after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+use channels;
+
+drop channel roomRecords;
+drop channel roomRecords2;
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.2.script.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.2.script.sqlpp
new file mode 100644
index 0000000..8fd9780
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.2.script.sqlpp
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+stop_and_start.sh
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.3.query.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.3.query.sqlpp
new file mode 100644
index 0000000..4b866e6
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.3.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that channel is still running after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+use channels;
+
+array_count((select *
+from roomRecordsResults result));
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.4.query.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.4.query.sqlpp
new file mode 100644
index 0000000..9408860
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.4.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that channel is still running after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+use channels;
+
+array_count((select *
+from roomRecords2Results result));
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.5.update.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.5.update.sqlpp
new file mode 100644
index 0000000..9a3931b
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.5.update.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+use channels;
+
+subscribe to roomRecords (123) on brokerA;
+subscribe to roomRecords2 (123) on brokerA;
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.6.sleep.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.6.sleep.sqlpp
new file mode 100644
index 0000000..e3641a0
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.6.sleep.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that channel is still running after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+8000
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.7.query.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.7.query.sqlpp
new file mode 100644
index 0000000..3fb2ebc
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.7.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that channel is still running after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+use channels;
+
+array_count((select *
+from roomRecordsResults result)) > 0;
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.8.query.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.8.query.sqlpp
new file mode 100644
index 0000000..051738e
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.8.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that channel is still running after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+use channels;
+
+array_count((select *
+from roomRecords2Results result)) > 0;
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.9.query.sqlpp b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.9.query.sqlpp
new file mode 100644
index 0000000..f72d947
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/queries/recovery/restart_cluster/restart_cluster.9.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+/*
+* Description  : Confirm that procedure still works after cluster restart
+* Expected Res : Success
+* Date         : May 2018
+* Author       : Steven Jacobs
+*/
+
+use channels;
+
+execute selectSome(123);
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.11.adm b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.11.adm
new file mode 100644
index 0000000..acbb918
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.11.adm
@@ -0,0 +1,2 @@
+{ "roomNumber": 123 }
+{ "roomNumber": 123 }
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.13.adm b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.13.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.13.adm
diff --git a/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.3.adm b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.3.adm
new file mode 100644
index 0000000..c227083
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.3.adm
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.4.adm b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.4.adm
new file mode 100644
index 0000000..c227083
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.4.adm
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.7.adm b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.7.adm
new file mode 100644
index 0000000..f32a580
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.7.adm
@@ -0,0 +1 @@
+true
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.8.adm b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.8.adm
new file mode 100644
index 0000000..f32a580
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.8.adm
@@ -0,0 +1 @@
+true
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.9.adm b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.9.adm
new file mode 100644
index 0000000..30ffd5c
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/results/recovery/restart_cluster/restart_cluster.9.adm
@@ -0,0 +1 @@
+{ "roomNumber": 123 }
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/scripts/recovery/restart_cluster/stop_and_start.sh b/asterix-bad/src/test/resources/recoveryts/scripts/recovery/restart_cluster/stop_and_start.sh
new file mode 100755
index 0000000..a1d7114
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/scripts/recovery/restart_cluster/stop_and_start.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+$NCSERVICE_HOME/opt/local/bin/stop-sample-cluster.sh;
+$NCSERVICE_HOME/opt/local/bin/start-sample-cluster.sh;
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/scripts/setup_teardown/configure_and_validate.sh b/asterix-bad/src/test/resources/recoveryts/scripts/setup_teardown/configure_and_validate.sh
new file mode 100755
index 0000000..ab09dd2
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/scripts/setup_teardown/configure_and_validate.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+$NCSERVICE_HOME/opt/local/bin/start-sample-cluster.sh;
diff --git a/asterix-bad/src/test/resources/recoveryts/scripts/setup_teardown/stop_and_delete.sh b/asterix-bad/src/test/resources/recoveryts/scripts/setup_teardown/stop_and_delete.sh
new file mode 100755
index 0000000..99db8b2
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/scripts/setup_teardown/stop_and_delete.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+$NCSERVICE_HOME/opt/local/bin/stop-sample-cluster.sh -f;
+rm -rf $NCSERVICE_HOME/opt/local/data;
\ No newline at end of file
diff --git a/asterix-bad/src/test/resources/recoveryts/testsuite.xml b/asterix-bad/src/test/resources/recoveryts/testsuite.xml
new file mode 100644
index 0000000..c549a3e
--- /dev/null
+++ b/asterix-bad/src/test/resources/recoveryts/testsuite.xml
@@ -0,0 +1,30 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements. See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership. The ASF licenses this file
+ ! to you 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.
+ !-->
+<test-suite  xmlns="urn:xml.testframework.asterix.apache.org"
+             ResultOffsetPath="results"
+             QueryOffsetPath="queries"
+             QueryFileExtension=".sqlpp">
+  <test-group name="recovery">
+    <test-case FilePath="recovery">
+      <compilation-unit name="restart_cluster">
+        <output-dir compare="Text">restart_cluster</output-dir>
+      </compilation-unit>
+    </test-case>
+  </test-group>
+</test-suite>