Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Commit

Permalink
Fix Shutdown through SigTerm
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericBregier committed Aug 10, 2019
1 parent 944b89e commit 5dfc055
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,26 @@
<version>1.10.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.0.50</version>
<!-- For Testing purpose but could be used in production too -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.6</version>
<!-- For Testing purpose but could be used in production too -->
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.apache.tools.ant.Project;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
Expand All @@ -40,6 +41,7 @@
import org.waarp.common.database.exception.WaarpDatabaseNoConnectionException;
import org.waarp.common.database.exception.WaarpDatabaseSqlException;
import org.waarp.common.digest.FilesystemBasedDigest;
import org.waarp.common.utility.Processes;
import org.waarp.openr66.client.Message;
import org.waarp.openr66.client.MultipleDirectTransfer;
import org.waarp.openr66.client.MultipleSubmitTransfer;
Expand Down Expand Up @@ -87,6 +89,7 @@
import org.waarp.openr66.protocol.test.TestTransferNoDb;
import org.waarp.openr66.protocol.utils.ChannelUtils;
import org.waarp.openr66.protocol.utils.R66Future;
import org.waarp.openr66.server.R66Server;
import org.waarp.thrift.r66.Action;
import org.waarp.thrift.r66.R66Request;
import org.waarp.thrift.r66.R66Service;
Expand Down Expand Up @@ -1427,4 +1430,24 @@ public void test90_RestR66() throws Exception {
logger.info("Key filename: {}", HttpTestRestR66Client.keydesfilename);
HttpTestRestR66Client.main(new String[] { "1" });
}


@Test
public void test99_SigTermR66() throws InterruptedException {
// global ant project settings
final Project project = Processes.getProject(homeDir);
final String[] argsServer = {
new File(dir, "config-serverA-minimal.xml").getAbsolutePath()
};
int pid = Processes.executeJvm(project, homeDir, R66Server.class,
argsServer, true);
Thread.sleep(1000);
assertTrue(Processes.exists(pid));
Processes.kill(pid, true);
while (Processes.exists(pid)) {
logger.warn("{} still running", pid);
Thread.sleep(10000);
}
Processes.finalizeProject(project);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public abstract class TestAbstract extends TestAbstractMinimal {

protected static NetworkTransaction networkTransaction = null;
private static Project project;
private static File homeDir;
static File homeDir;

public static void setUpDbBeforeClass() throws Exception {
deleteBase();
Expand Down

0 comments on commit 5dfc055

Please sign in to comment.