summaryrefslogtreecommitdiff
path: root/java/tests/ServiceConfigurator
diff options
context:
space:
mode:
authoreea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-11-12 03:10:26 +0000
committereea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-11-12 03:10:26 +0000
commit8a79d73984529c66db645f7bf929641001fab726 (patch)
treede10a527c14bc78e03aeccc0800cef495983aaa8 /java/tests/ServiceConfigurator
parent8137b4663c0d47c953657bffcbafd86297a64ca9 (diff)
downloadATCD-8a79d73984529c66db645f7bf929641001fab726.tar.gz
These files form two tests for the Service Configurator:
suspendTest loads, suspends, and resumes a TestService using the three suspendTest*.conf files. reloadTest loads and then removes/reloads a TestService
Diffstat (limited to 'java/tests/ServiceConfigurator')
-rw-r--r--java/tests/ServiceConfigurator/Makefile3
-rw-r--r--java/tests/ServiceConfigurator/TestService.java30
-rw-r--r--java/tests/ServiceConfigurator/reloadTest.java64
-rw-r--r--java/tests/ServiceConfigurator/suspendTest.java80
-rw-r--r--java/tests/ServiceConfigurator/suspendTest1.conf1
-rw-r--r--java/tests/ServiceConfigurator/suspendTest2.conf1
-rw-r--r--java/tests/ServiceConfigurator/suspendTest3.conf1
-rw-r--r--java/tests/ServiceConfigurator/svc.conf1
8 files changed, 176 insertions, 5 deletions
diff --git a/java/tests/ServiceConfigurator/Makefile b/java/tests/ServiceConfigurator/Makefile
index 32b949ef298..b4e62f70997 100644
--- a/java/tests/ServiceConfigurator/Makefile
+++ b/java/tests/ServiceConfigurator/Makefile
@@ -14,7 +14,8 @@ doc:
files = TestService.java \
- mainTest.java
+ reloadTest.java \
+ suspendTest.java
packages = tests.Service_Configurator
diff --git a/java/tests/ServiceConfigurator/TestService.java b/java/tests/ServiceConfigurator/TestService.java
index 66eb04619c5..7b34c181c60 100644
--- a/java/tests/ServiceConfigurator/TestService.java
+++ b/java/tests/ServiceConfigurator/TestService.java
@@ -18,13 +18,35 @@ public class TestService extends ServiceObject
{
public int init (String [] args)
{
- ACE.DEBUG ("In Test_Service::init() with arguments: " +
- args[0] + args[1]);
+ System.out.println("TestService init with arguments: ");
+
+ if (args != null)
+ for (int i = 0; i < args.length; i++)
+ ACE.DEBUG (args[i]);
+
+ return 0;
+ }
+
+ public int suspend()
+ {
+ System.out.println("TestService suspend ----");
- //ACE.DEBUG ("In new Test_Service::init() with arguments: " +
- // args[0] + args[1]);
return 0;
}
+ public int resume()
+ {
+ System.out.println("TestService resume ----");
+
+ return 0;
+ }
+
+ public int fini()
+ {
+ System.out.println("TestService remove ----");
+
+ return 0;
+ }
+
}
diff --git a/java/tests/ServiceConfigurator/reloadTest.java b/java/tests/ServiceConfigurator/reloadTest.java
new file mode 100644
index 00000000000..3e8ac599841
--- /dev/null
+++ b/java/tests/ServiceConfigurator/reloadTest.java
@@ -0,0 +1,64 @@
+/*************************************************
+ *
+ * = PACKAGE
+ * tests.ServiceConfigurator
+ *
+ * = FILENAME
+ * mainTest.java
+ *
+ *@author Prashant Jain, Everett Anderson
+ *
+ *************************************************/
+package tests.ServiceConfigurator;
+
+import JACE.ServiceConfigurator.*;
+import JACE.OS.*;
+import java.io.*;
+
+public class reloadTest
+{
+
+ public static void main (String args [])
+ {
+ ServiceConfig daemon = new ServiceConfig ();
+ try
+ {
+ daemon.open (args);
+ Thread.sleep (10000);
+
+ // ***** Note: reloading requires the user to remove the
+ // service and prepare for reload!
+ daemon.remove("TimeService");
+ daemon.prepareForReload();
+
+ daemon.open (args);
+ }
+ catch (InterruptedException e)
+ {
+ ACE.ERROR (e);
+ }
+ catch (FileNotFoundException e)
+ {
+ ACE.ERROR (e);
+ }
+ catch (IOException e)
+ {
+ ACE.ERROR (e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ ACE.ERROR (e + "foo");
+ }
+ catch (IllegalAccessException e)
+ {
+ ACE.ERROR (e);
+ }
+ catch (InstantiationException e)
+ {
+ ACE.ERROR (e);
+ }
+
+ System.err.println("End of reloadTest");
+ }
+
+}
diff --git a/java/tests/ServiceConfigurator/suspendTest.java b/java/tests/ServiceConfigurator/suspendTest.java
new file mode 100644
index 00000000000..ab12d06f2f5
--- /dev/null
+++ b/java/tests/ServiceConfigurator/suspendTest.java
@@ -0,0 +1,80 @@
+/*************************************************
+ *
+ * = PACKAGE
+ * tests.ServiceConfigurator
+ *
+ * = FILENAME
+ * mainTest.java
+ *
+ *@author Prashant Jain, Everett Anderson
+ *
+ *************************************************/
+package tests.ServiceConfigurator;
+
+import JACE.ServiceConfigurator.*;
+import JACE.OS.*;
+import java.io.*;
+
+public class suspendTest
+{
+
+ public static void main (String args [])
+ {
+ ServiceConfig daemon = new ServiceConfig ();
+ ACE.enableDebugging();
+
+ try
+ {
+ String args1 = "-f suspendTest1.conf";
+ String[] argv1 = OS.createStringArray(args1, " ");
+
+ daemon.open (argv1);
+
+ Thread.sleep (10000);
+
+
+ System.err.println("Suspending");
+ String args2 = "-f suspendTest2.conf";
+ String[] argv2 = OS.createStringArray(args2, " ");
+
+ daemon.open (argv2);
+
+ Thread.sleep (10000);
+
+ System.err.println("Resuming");
+ String args3 = "-f suspendTest3.conf";
+ String[] argv3 = OS.createStringArray(args3, " ");
+
+ daemon.open (argv3);
+
+ Thread.sleep(10000);
+ }
+ catch (InterruptedException e)
+ {
+ ACE.ERROR (e);
+ }
+ catch (FileNotFoundException e)
+ {
+ ACE.ERROR (e);
+ }
+ catch (IOException e)
+ {
+ ACE.ERROR (e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ ACE.ERROR (e + "foo");
+ }
+ catch (IllegalAccessException e)
+ {
+ ACE.ERROR (e);
+ }
+ catch (InstantiationException e)
+ {
+ ACE.ERROR (e);
+ }
+
+ System.err.println("End of suspendTest");
+ }
+
+}
diff --git a/java/tests/ServiceConfigurator/suspendTest1.conf b/java/tests/ServiceConfigurator/suspendTest1.conf
new file mode 100644
index 00000000000..983af3234c1
--- /dev/null
+++ b/java/tests/ServiceConfigurator/suspendTest1.conf
@@ -0,0 +1 @@
+load TestService tests.ServiceConfigurator.TestService ServiceObject "-p 10002"
diff --git a/java/tests/ServiceConfigurator/suspendTest2.conf b/java/tests/ServiceConfigurator/suspendTest2.conf
new file mode 100644
index 00000000000..5cd6cd0fc77
--- /dev/null
+++ b/java/tests/ServiceConfigurator/suspendTest2.conf
@@ -0,0 +1 @@
+suspend TestService
diff --git a/java/tests/ServiceConfigurator/suspendTest3.conf b/java/tests/ServiceConfigurator/suspendTest3.conf
new file mode 100644
index 00000000000..71250c3acd7
--- /dev/null
+++ b/java/tests/ServiceConfigurator/suspendTest3.conf
@@ -0,0 +1 @@
+resume TestService
diff --git a/java/tests/ServiceConfigurator/svc.conf b/java/tests/ServiceConfigurator/svc.conf
new file mode 100644
index 00000000000..983af3234c1
--- /dev/null
+++ b/java/tests/ServiceConfigurator/svc.conf
@@ -0,0 +1 @@
+load TestService tests.ServiceConfigurator.TestService ServiceObject "-p 10002"