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

Commit

Permalink
Add Junit to v3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericBregier committed Jul 22, 2019
1 parent d2f228c commit 5a38073
Show file tree
Hide file tree
Showing 9 changed files with 689 additions and 252 deletions.
62 changes: 62 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,31 @@ local.properties
#################
## Java
#################
# Compiled class file
*.class
*.jardesc

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

#################
## Visual Studio
#################
Expand Down Expand Up @@ -132,3 +154,43 @@ Thumbs.db
Desktop.ini

runtime.properties

###############
## Intellij
###############
# User-specific stuff
.idea/

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
.idea/modules.xml
.idea/*.iml
.idea/modules
*.iml
*.ipr

# CMake
cmake-build-*/

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

*.log

6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>WaarpThrift</artifactId>
<version>3.0.7</version>
<version>3.1.0</version>
<name>WaarpThrift</name>
<description>Waarp Thrift interface for R66</description>
<url>http://waarp.github.com/WaarpThrift</url>
Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>Waarp</groupId>
<artifactId>WaarpCommon</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down Expand Up @@ -97,7 +97,7 @@
<source>1.6</source>
<target>1.6</target>
<optimize>true</optimize>
<showDeprecations>true</showDeprecations>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/waarp/thrift/util/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/** Provides the version information of Waarp Thrift. */
public final class Version {
/** The version identifier. */
public static final String ID = "3.0.7";
public static final String ID = "3.1.0";
/** Prints out the version identifier to stdout. */
public static void main(String[] args) { System.out.println(ID); }
private Version() { super(); }
Expand Down
Empty file added src/test/java/.gitkeep
Empty file.
201 changes: 102 additions & 99 deletions src/test/java/org/waarp/thrift/r66/ClientExample.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
/**
* This file is part of Waarp Project.
*
* Copyright 2009, Frederic Bregier, and individual contributors by the @author tags. See the
* COPYRIGHT.txt in the distribution for a full listing of individual contributors.
*
* All Waarp Project is free software: you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Waarp 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 General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Waarp . If not, see
* <http://www.gnu.org/licenses/>.
*/
/*******************************************************************************
* This file is part of Waarp Project (named also Waarp or GG).
*
* Copyright (c) 2019, Waarp SAS, and individual contributors by the @author
* tags. See the COPYRIGHT.txt in the distribution for a full listing of
* individual contributors.
*
* All Waarp Project is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* Waarp 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* Waarp . If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package org.waarp.thrift.r66;

import org.apache.thrift.TException;
Expand All @@ -23,106 +25,107 @@
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.waarp.thrift.r66.Action;
import org.waarp.thrift.r66.R66Request;
import org.waarp.thrift.r66.R66Result;
import org.waarp.thrift.r66.R66Service;
import org.waarp.thrift.r66.RequestMode;

/**
* Example of Java class to interact with the Thrift R66 service
*
*
* @author "Frederic Bregier"
*
*/
public class ClientExample implements Runnable {
private static final int PORT = 7911;
private static final int tries = 100000;
private static final int PORT = 7911;
private static final int tries = 100000;

public static void main(String[] args) {
new ClientExample().testClient();
}

public static void main(String[] args) {
try {
TTransport transport = null;
transport = new TSocket("localhost", PORT);
TProtocol protocol = new TBinaryProtocol(transport);
R66Service.Client client = new R66Service.Client(protocol);
transport.open();
R66Request request = new R66Request(RequestMode.SYNCTRANSFER);
request.setFromuid("myclient");
request.setDestuid("mypartner");
request.setRule("myruletouse");
request.setFile("pathtomyfile.txt");
request.setInfo("my info send on the wire");
request.setMd5(true);
public void testClient() {
try {
TTransport transport = null;
transport = new TSocket("localhost", PORT);
TProtocol protocol = new TBinaryProtocol(transport);
R66Service.Client client = new R66Service.Client(protocol);
transport.open();
R66Request request = new R66Request(RequestMode.SYNCTRANSFER);
request.setFromuid("myclient");
request.setDestuid("mypartner");
request.setRule("myruletouse");
request.setFile("pathtomyfile.txt");
request.setInfo("my info send on the wire");
request.setMd5(true);

System.out.println("REQUEST1: " + request.toString());
R66Result result = client.transferRequestQuery(request);
System.out.println("RESULT1: " + result.toString());
System.out.println("REQUEST1: " + request.toString());
R66Result result = client.transferRequestQuery(request);
System.out.println("RESULT1: " + result.toString());

long start = System.currentTimeMillis();
for (int i = 0; i < tries; i++) {
result = client.transferRequestQuery(request);
}
long end = System.currentTimeMillis();
System.out
.println("Delay: " + (end - start) + " : " + ((tries * 1000) / (end - start)));
long start = System.currentTimeMillis();
for (int i = 0; i < tries; i++) {
result = client.transferRequestQuery(request);
}
long end = System.currentTimeMillis();
System.out
.println("Delay: " + (end - start) + " : " +
((tries * 1000) / (end - start)));

request.setMode(RequestMode.INFOREQUEST);
request.setTid(result.getTid());
request.setAction(Action.Detail);
result = client.infoTransferQuery(request);
System.out.println("RESULT2: " + result.toString());
request.setMode(RequestMode.INFOREQUEST);
request.setTid(result.getTid());
request.setAction(Action.Detail);
result = client.infoTransferQuery(request);
System.out.println("RESULT2: " + result.toString());

System.out.println("Exist: "
+
client.isStillRunning(request.getFromuid(), request.getDestuid(),
request.getTid()));
System.out.println("Exist: "
+
client.isStillRunning(request.getFromuid(),
request.getDestuid(),
request.getTid()));

request.setMode(RequestMode.INFOFILE);
request.setAction(Action.List);
result = client.infoTransferQuery(request);
System.out.println("RESULT3: " + result.toString());
request.setMode(RequestMode.INFOFILE);
request.setAction(Action.List);
result = client.infoTransferQuery(request);
System.out.println("RESULT3: " + result.toString());

transport.close();
} catch (TTransportException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
}
transport.close();
} catch (TTransportException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
}
}

public void run() {
try {
TTransport transport = null;
transport = new TSocket("localhost", PORT);
TProtocol protocol = new TBinaryProtocol(transport);
R66Service.Client client = new R66Service.Client(protocol);
transport.open();
R66Request request = new R66Request(RequestMode.SYNCTRANSFER);
request.setFromuid("myclient");
request.setDestuid("mypartner");
request.setRule("myruletouse");
request.setFile("pathtomyfile.txt");
request.setInfo("my info send on the wire");
request.setMd5(true);
public void run() {
try {
TTransport transport = null;
transport = new TSocket("localhost", PORT);
TProtocol protocol = new TBinaryProtocol(transport);
R66Service.Client client = new R66Service.Client(protocol);
transport.open();
R66Request request = new R66Request(RequestMode.SYNCTRANSFER);
request.setFromuid("myclient");
request.setDestuid("mypartner");
request.setRule("myruletouse");
request.setFile("pathtomyfile.txt");
request.setInfo("my info send on the wire");
request.setMd5(true);

System.out.println("REQUEST1: " + request.toString());
R66Result result = client.transferRequestQuery(request);
System.out.println("RESULT1: " + result.toString());
System.out.println("REQUEST1: " + request.toString());
R66Result result = client.transferRequestQuery(request);
System.out.println("RESULT1: " + result.toString());

long start = System.currentTimeMillis();
for (int i = 0; i < tries; i++) {
result = client.transferRequestQuery(request);
}
long end = System.currentTimeMillis();
System.out
.println("Delay: " + (end - start) + " : " + ((tries * 1000) / (end - start)));
long start = System.currentTimeMillis();
for (int i = 0; i < tries; i++) {
result = client.transferRequestQuery(request);
}
long end = System.currentTimeMillis();
System.out
.println("Delay: " + (end - start) + " : " +
((tries * 1000) / (end - start)));

transport.close();
} catch (TTransportException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
}
transport.close();
} catch (TTransportException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
}
}

}
Loading

0 comments on commit 5a38073

Please sign in to comment.