Commit ad9bb263 authored by Andre Freyssinet's avatar Andre Freyssinet
Browse files

No longer use useless Transaction.UseLockFile configuration property.

parent 65091187
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2012 - 2020 ScalAgent Distributed Technologies
* Copyright (C) 2012 - 2022 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -62,7 +62,6 @@ import fr.dyade.aaa.common.Debug;
* <property name="pathToConf">your_path/conf</property>
* <!-- properties -->
* <property name="Transaction">fr.dyade.aaa.util.NTransaction</property>
* <property name="Transaction.UseLockFile">false</property>
* </configuration>
* </configadmin>
* </pre></blockquote>
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2012 - 2020 ScalAgent Distributed Technologies
* Copyright (C) 2012 - 2022 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -62,7 +62,6 @@ import fr.dyade.aaa.common.Debug;
* &lt;property name="pathToConf"&gt;your_path/conf&lt;/property&gt;
* &lt;!-- properties --&gt;
* &lt;property name="Transaction"&gt;fr.dyade.aaa.util.NTransaction&lt;/property&gt;
* &lt;property name="Transaction.UseLockFile"&gt;false&lt;/property&gt;
* &lt;/configuration&gt;
* &lt;/configadmin&gt;
* </pre></blockquote>
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2022 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -36,7 +36,7 @@ public class test14 extends TestCase {
protected void setUp() throws Exception {
timeout = 30000L;
startAgentServer((short) 1, new String[] { "-DTransaction.UseLockFile=false" });
startAgentServer((short) 1);
Test14Master master = new Test14Master();
Test14Slave slave = new Test14Slave((short) 1);
......@@ -80,7 +80,7 @@ public class test14 extends TestCase {
TestCase.assertTrue(((Test14Not) not).creation);
// Stop, then start AgentServer#1
killAgentServer((short) 1);
startAgentServer((short) 1, new String[] { "-DTransaction.UseLockFile=false" });
startAgentServer((short) 1);
// Then send a not to slave in order to reload it !!
sendTo(slave, new Notification());
break;
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2009 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package a3.recovery;
import java.util.Random;
import java.util.Timer;
import fr.dyade.aaa.agent.Agent;
import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.agent.Notification;
import framework.TestCase;
public class test1 extends TestCase {
public test1() {
super();
}
static short ServerPing = (short) 0;
static short ServerPong = (short) 1;
static int nbStopTask =0;
static Object lock = null;
static Random rand = null;
protected void setUp() throws Exception {
startAgentServer(ServerPong, new String[] { "-DTransaction.UseLockFile=false" });
int bounce = Integer.getInteger("bounce", 1500).intValue();
timeout = 250L * bounce;
timeout = Long.getLong("timeout", timeout).longValue();
lock = new Object();
rand = new Random(0x1234L);
Timer timer = new Timer(true);
Ping ping = new Ping(ServerPing);
Pong pong = new Pong(ServerPong);
ping.pong = pong.getId();
ping.bounce = bounce;
ping.deploy();
pong.deploy();
}
protected void startTest() throws Exception {
super.startTest();
for (int i=0; i<5; i++) {
synchronized(lock) {
try {
lock.wait();
} catch (InterruptedException exc) {}
}
Thread.sleep(250);
if (rand.nextBoolean()) {
System.out.println("stop");
TestCase.stopAgentServer(ServerPong);
} else {
System.out.println("crash");
TestCase.killAgentServer(ServerPong);
}
// Wait in order to prevent WAIT status on TCP connection
Thread.currentThread().sleep(500L);
// Start server#1
TestCase.startAgentServer(ServerPong, new String[] { "-DTransaction.UseLockFile=false" });
}
// timer.schedule(new StopTask(ping.getId(), new StopNot()), 5000L, 15000L);
}
protected void tearDown() {
killAgentServer(ServerPong);
}
public static void main(String args[]) {
new test1().runTest(args);
}
static class Ball extends Notification {
public int bounce;
public Ball(int bounce) {
this.bounce = bounce;
}
public StringBuffer toString(StringBuffer output) {
output.append('(');
super.toString(output);
output.append(",bounce=").append(bounce);
output.append(')');
return output;
}
}
// static class StopNot extends Notification {}
//
// static class StopTask extends TimerTask {
// AgentId to;
// Notification not;
//
// StopTask(AgentId to, Notification not) {
// this.to = to;
// this.not = not;
// }
//
// public void run() {
// Channel.sendTo(to, not);
// }
// }
static class Ping extends Agent {
AgentId pong;
int bounce;
// Random rand = null;
public Ping(short to) {
super(to);
// rand = new Random(0x1234L);
}
protected void agentInitialize(boolean firstime) throws Exception {
if (firstime) {
sendTo(pong, new Ball(bounce));
}
}
public void react(AgentId from, Notification not) {
try {
// if (not instanceof StopNot) {
// if (rand.nextBoolean()) {
// System.out.println("stop");
// TestCase.stopAgentServer(test1.ServerPong);
// } else {
// System.out.println("crash");
// TestCase.crashAgentServer(test1.ServerPong);
// }
// // Wait in order to prevent WAIT status on TCP connection
// Thread.currentThread().sleep(500L);
// // Start server#1
// TestCase.startAgentServer(test1.ServerPong);
// nbStopTask++;
// if(nbStopTask > 20 ) endTest();
// } else {
assertTrue(from.equals(pong));
assertEquals(not.getClass().getName(), "a3.recovery.test1$Ball");
if (not instanceof Ball) {
Ball ball = (Ball) not;
if ((ball.bounce %50) == 0) System.out.println("bounce: " + ball.bounce);
if ((ball.bounce %250) == 0) {
synchronized(lock) {
lock.notify();
}
}
assertEquals(ball.bounce, bounce);
if (ball.bounce == 0) {
endTest();
// never reached
} else {
bounce -= 1;
sendTo(pong, new Ball(bounce));
}
}
// }
} catch (Exception exc) {
error(exc);
endTest();
}
}
}
static class Pong extends Agent {
public Pong(short to) {
super(to);
}
public void react(AgentId from, Notification not) throws Exception {
if (not instanceof Ball) {
sendTo(from, new Ball(((Ball) not).bounce));
}
}
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2022 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package a3.recovery;
import java.util.Random;
import java.util.Timer;
import fr.dyade.aaa.agent.Agent;
import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.agent.Notification;
import framework.TestCase;
public class test1 extends TestCase {
public test1() {
super();
}
static short ServerPing = (short) 0;
static short ServerPong = (short) 1;
static int nbStopTask =0;
static Object lock = null;
static Random rand = null;
protected void setUp() throws Exception {
startAgentServer(ServerPong);
int bounce = Integer.getInteger("bounce", 1500).intValue();
timeout = 250L * bounce;
timeout = Long.getLong("timeout", timeout).longValue();
lock = new Object();
rand = new Random(0x1234L);
Timer timer = new Timer(true);
Ping ping = new Ping(ServerPing);
Pong pong = new Pong(ServerPong);
ping.pong = pong.getId();
ping.bounce = bounce;
ping.deploy();
pong.deploy();
}
protected void startTest() throws Exception {
super.startTest();
for (int i=0; i<5; i++) {
synchronized(lock) {
try {
lock.wait();
} catch (InterruptedException exc) {}
}
Thread.sleep(250);
if (rand.nextBoolean()) {
System.out.println("stop");
TestCase.stopAgentServer(ServerPong);
} else {
System.out.println("crash");
TestCase.killAgentServer(ServerPong);
}
// Wait in order to prevent WAIT status on TCP connection
Thread.currentThread().sleep(500L);
// Start server#1
TestCase.startAgentServer(ServerPong);
}
// timer.schedule(new StopTask(ping.getId(), new StopNot()), 5000L, 15000L);
}
protected void tearDown() {
killAgentServer(ServerPong);
}
public static void main(String args[]) {
new test1().runTest(args);
}
static class Ball extends Notification {
public int bounce;
public Ball(int bounce) {
this.bounce = bounce;
}
public StringBuffer toString(StringBuffer output) {
output.append('(');
super.toString(output);
output.append(",bounce=").append(bounce);
output.append(')');
return output;
}
}
// static class StopNot extends Notification {}
//
// static class StopTask extends TimerTask {
// AgentId to;
// Notification not;
//
// StopTask(AgentId to, Notification not) {
// this.to = to;
// this.not = not;
// }
//
// public void run() {
// Channel.sendTo(to, not);
// }
// }
static class Ping extends Agent {
AgentId pong;
int bounce;
// Random rand = null;
public Ping(short to) {
super(to);
// rand = new Random(0x1234L);
}
protected void agentInitialize(boolean firstime) throws Exception {
if (firstime) {
sendTo(pong, new Ball(bounce));
}
}
public void react(AgentId from, Notification not) {
try {
// if (not instanceof StopNot) {
// if (rand.nextBoolean()) {
// System.out.println("stop");
// TestCase.stopAgentServer(test1.ServerPong);
// } else {
// System.out.println("crash");
// TestCase.crashAgentServer(test1.ServerPong);
// }
// // Wait in order to prevent WAIT status on TCP connection
// Thread.currentThread().sleep(500L);
// // Start server#1
// TestCase.startAgentServer(test1.ServerPong);
// nbStopTask++;
// if(nbStopTask > 20 ) endTest();
// } else {
assertTrue(from.equals(pong));
assertEquals(not.getClass().getName(), "a3.recovery.test1$Ball");
if (not instanceof Ball) {
Ball ball = (Ball) not;
if ((ball.bounce %50) == 0) System.out.println("bounce: " + ball.bounce);
if ((ball.bounce %250) == 0) {
synchronized(lock) {
lock.notify();
}
}
assertEquals(ball.bounce, bounce);
if (ball.bounce == 0) {
endTest();
// never reached
} else {
bounce -= 1;
sendTo(pong, new Ball(bounce));
}
}
// }
} catch (Exception exc) {
error(exc);
endTest();
}
}
}
static class Pong extends Agent {
public Pong(short to) {
super(to);
}
public void react(AgentId from, Notification not) throws Exception {
if (not instanceof Ball) {
sendTo(from, new Ball(((Ball) not).bounce));
}
}
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2022 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -45,7 +45,7 @@ public class test2 extends TestCase {
protected void setUp() throws Exception {
startAgentServer(ServerPong);
startAgentServer(router, new String[] { "-DTransaction.UseLockFile=false" });
startAgentServer(router);
Thread.sleep(1000L);
int bounce = Integer.getInteger("bounce", 600).intValue();
......@@ -133,7 +133,7 @@ public class test2 extends TestCase {
// Wait in order to prevent WAIT status on TCP connection
Thread.sleep(1000L);
// Start server#2
TestCase.startAgentServer(test2.router, new String[] { "-DTransaction.UseLockFile=false" });
TestCase.startAgentServer(test2.router);
nbStopTask++;
if(nbStopTask > 20 ) endTest();
} else {
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2022 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -35,7 +35,7 @@ public class test3 extends TestCase {
}
protected void setUp() throws Exception {
startAgentServer((short) 1, new String[] { "-DTransaction.UseLockFile=false" });
startAgentServer((short) 1);
timeout = Long.getLong("timeout", 60000L).longValue();
......@@ -102,7 +102,7 @@ public class test3 extends TestCase {
}
killAgentServer((short) 1);
Thread.sleep(1000);
startAgentServer((short) 1, new String[] { "-DTransaction.UseLockFile=false" });
startAgentServer((short) 1);
sendTo(slave1, new Echo());
} else if (state == 3) {
......@@ -128,7 +128,7 @@ public class test3 extends TestCase {
stopAgentServer((short) 1);
// Wait in order to prevent WAIT status on TCP connection
Thread.currentThread().sleep(2000L);
startAgentServer((short) 1, new String[] { "-DTransaction.UseLockFile=false" });
startAgentServer((short) 1);
sendTo(slave2, new Echo());
} else if (state < 100) {
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2009 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s):ScalAgent D.T.
* Contributor(s):
*/
package a3.recovery;
import java.util.Random;
import fr.dyade.aaa.agent.Agent;
import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.agent.Notification;
import framework.TestCase;
public class test6 extends TestCase {
public test6() {
super();
}
static short ServerPing = (short) 1;
static short ServerPong = (short) 1;
static int nbStopTask =0;
protected void setUp() throws Exception {
ServerPing = Integer.getInteger("Ping", ServerPing).shortValue();
ServerPong = Integer.getInteger("Pong", ServerPong).shortValue();
startAgentServer(ServerPing, new String[] { "-DTransaction.UseLockFile=false" });
if (ServerPong != ServerPing)
startAgentServer(ServerPong, new String[] { "-DTransaction.UseLockFile=false" });
// int bounce = Integer.getInteger("bounce", 325).intValue();
int bounce = 5000;
timeout = 1200000;
// timeout = Long.getLong("timeout", timeout).longValue();
Test6Agent test = new Test6Agent((short) 0);
Ping ping = new Ping(ServerPing);
Pong pong = new Pong(ServerPong);
ping.pong = pong.getId();
ping.test = test.getId();
ping.bounce = bounce;
test.ping = ping.getId();
test.deploy();
pong.deploy();
ping.deploy();
}
protected void tearDown() {
killAgentServer(ServerPing);
if (ServerPong != ServerPing) killAgentServer(ServerPong);