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

Add fixes and Junit for V3.1 #293

Open
wants to merge 3 commits into
base: wNetty41
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 62 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ local.properties
.loadpath
.pmd

############
## Intellij
############
.idea

# External tool builders
.externalToolBuilders/

Expand All @@ -34,19 +29,34 @@ local.properties
# PDT-specific
.buildpath


#################
# Intellij
#################
.idea
src/main/java/resources/

#################
## 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 @@ -144,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

54 changes: 44 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>WaarpR66</artifactId>
<name>Waarp OpenR66</name>
<version>3.1.0</version>
<version>3.1.1</version>
<description>
OpenR66 is a File Transfer Monitor to be used in real production to transfer files between servers.
It allows to start/restart a transfer, check the remote MD5, check status, make pre or post
Expand Down Expand Up @@ -75,7 +75,7 @@
<dependency>
<groupId>Waarp</groupId>
<artifactId>WaarpCommon</artifactId>
<version>3.0.12</version>
<version>3.1.1</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
Expand All @@ -98,7 +98,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<version>1.4.199</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -115,13 +115,13 @@
<dependency>
<groupId>Waarp</groupId>
<artifactId>WaarpExec</artifactId>
<version>3.0.4</version>
<version>3.1.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>Waarp</groupId>
<artifactId>WaarpSnmp</artifactId>
<version>3.0.6</version>
<version>3.1.0</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -137,7 +137,7 @@
<dependency>
<groupId>Waarp</groupId>
<artifactId>WaarpThrift</artifactId>
<version>3.0.6</version>
<version>3.1.0</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -149,7 +149,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5.jre6</version>
<version>42.2.6.jre6</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -167,12 +167,12 @@
<dependency>
<groupId>Waarp</groupId>
<artifactId>WaarpGatewayKernel</artifactId>
<version>3.0.10</version>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>Waarp</groupId>
<artifactId>WaarpFtpClient</artifactId>
<version>3.0.6</version>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -230,6 +230,40 @@
<artifactId>netty-http</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<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>
<dependency>
<groupId>Waarp</groupId>
<artifactId>WaarpCommon</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
<version>3.1.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -253,7 +287,7 @@
<source>1.6</source>
<target>1.6</target>
<optimize>true</optimize>
<showDeprecations>true</showDeprecations>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.waarp.common.logging.WaarpLogger;
import org.waarp.common.logging.WaarpLoggerFactory;
import org.waarp.common.logging.WaarpSlf4JLoggerFactory;
import org.waarp.common.utility.DetectionUtils;
import org.waarp.openr66.client.utils.OutputFormat;
import org.waarp.openr66.configuration.FileBasedConfiguration;
import org.waarp.openr66.context.ErrorCode;
Expand Down Expand Up @@ -149,6 +150,9 @@ public static void main(String[] args) {
if (DbConstant.admin != null && DbConstant.admin.isActive()) {
DbConstant.admin.close();
}
if (DetectionUtils.isJunit()) {
return;
}
ChannelUtils.stopLogger();
System.exit(2);
}
Expand Down Expand Up @@ -181,6 +185,9 @@ public static void main(String[] args) {
" <REMOTE>" + rhost + "</REMOTE>" +
" <ERROR>" + future.getCause() + "</ERROR>" +
" delay: " + delay);
if (DetectionUtils.isJunit()) {
return;
}
networkTransaction.closeAll();
System.exit(ErrorCode.Unknown.ordinal());
}
Expand Down
74 changes: 74 additions & 0 deletions src/main/java/org/waarp/openr66/client/AbstractTransfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.waarp.common.command.exception.CommandAbstractException;
import org.waarp.common.database.data.AbstractDbData.UpdatedInfo;
Expand All @@ -34,6 +36,7 @@
import org.waarp.openr66.context.ErrorCode;
import org.waarp.openr66.context.R66Result;
import org.waarp.openr66.context.R66Session;
import org.waarp.openr66.context.filesystem.R66Dir;
import org.waarp.openr66.context.filesystem.R66File;
import org.waarp.openr66.context.task.exception.OpenR66RunnerErrorException;
import org.waarp.openr66.database.DbConstant;
Expand All @@ -43,7 +46,10 @@
import org.waarp.openr66.protocol.configuration.Messages;
import org.waarp.openr66.protocol.configuration.PartnerConfiguration;
import org.waarp.openr66.protocol.exception.OpenR66DatabaseGlobalException;
import org.waarp.openr66.protocol.localhandler.packet.InformationPacket;
import org.waarp.openr66.protocol.localhandler.packet.RequestPacket;
import org.waarp.openr66.protocol.localhandler.packet.ValidPacket;
import org.waarp.openr66.protocol.networkhandler.NetworkTransaction;
import org.waarp.openr66.protocol.utils.FileUtils;
import org.waarp.openr66.protocol.utils.R66Future;

Expand Down Expand Up @@ -340,4 +346,72 @@ protected void finalizeInErrorTransferRequest(ClientRunner runner, DbTaskRunner
runner.changeUpdatedInfo(UpdatedInfo.INERROR, code, true);
}
}


public List<String> getRemoteFiles(DbRule dbrule, String[] localfilenames, String requested,
NetworkTransaction networkTransaction) {
List<String> files = new ArrayList<String>();
for (String filename : localfilenames) {
if (!(filename.contains("*") || filename.contains("?") || filename.contains("~"))) {
files.add(filename);
} else {
// remote query
R66Future futureInfo = new R66Future(true);
logger.info(Messages.getString("Transfer.3") + filename + " to " + requested); //$NON-NLS-1$
RequestInformation info = new RequestInformation(
futureInfo, requested, rulename, filename,
(byte) InformationPacket.ASKENUM.ASKLIST.ordinal(), -1, false, networkTransaction);
info.run();
futureInfo.awaitUninterruptibly();
if (futureInfo.isSuccess()) {
ValidPacket valid = (ValidPacket) futureInfo.getResult().getOther();
if (valid != null) {
String line = valid.getSheader();
String[] lines = line.split("\n");
for (String string : lines) {
File tmpFile = new File(string);
files.add(tmpFile.getPath());
}
}
} else {
logger.error(Messages.getString("Transfer.6") + filename + " to " + requested + ": " +
(futureInfo.getCause() == null ? "" : futureInfo.getCause().getMessage())); //$NON-NLS-1$
}
}
}
return files;
}

public List<String> getLocalFiles(DbRule dbrule, String[] localfilenames) {
List<String> files = new ArrayList<String>();
R66Session session = new R66Session();
session.getAuth().specialNoSessionAuth(false, Configuration.configuration.getHOST_ID());
R66Dir dir = new R66Dir(session);
try {
dir.changeDirectory(dbrule.getSendPath());
} catch (CommandAbstractException e) {
}
if (localfilenames != null) {
for (String filename : localfilenames) {
if (!(filename.contains("*") || filename.contains("?") || filename.contains("~"))) {
logger.info("Direct add: " + filename);
files.add(filename);
} else {
// local: must check
logger.info("Local Ask for " + filename + " from " + dir.getFullPath());
List<String> list;
try {
list = dir.list(filename);
if (list != null) {
files.addAll(list);
}
} catch (CommandAbstractException e) {
logger.warn(Messages.getString("Transfer.14") + filename + " : " + e.getMessage()); //$NON-NLS-1$
}
}
}
}
return files;
}

}
Loading