Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f3cdec460 | ||
|
|
327041d3c0 | ||
|
|
a8f699343f | ||
|
|
a09b72e66e | ||
|
|
1cbda9aaa9 | ||
|
|
bb1b23b282 |
+4
-4
@@ -1,7 +1,7 @@
|
||||
apply plugin:'java'
|
||||
apply plugin: 'maven'
|
||||
defaultTasks 'build'
|
||||
version='1.10.0'
|
||||
version='1.10.1'
|
||||
description='Java implementation of the ISO 8583 protocol, focused on making the creation, edition and reading of ISO8583 messages as simple and flexible as possible.'
|
||||
sourceCompatibility=6
|
||||
targetCompatibility=6
|
||||
@@ -17,9 +17,9 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'org.slf4j:slf4j-api:1.7.5'
|
||||
compile 'org.slf4j:slf4j-api:1.7.6'
|
||||
testCompile 'junit:junit:4.11'
|
||||
testRuntime 'org.slf4j:slf4j-simple:1.7.5'
|
||||
testRuntime 'org.slf4j:slf4j-simple:1.7.6'
|
||||
}
|
||||
|
||||
tasks.javadoc.options.use=true
|
||||
@@ -56,7 +56,7 @@ uploadArchives {
|
||||
beforeDeployment { MavenDeployment deployment ->
|
||||
signing.signPom(deployment)
|
||||
}
|
||||
repository(url:'http://oss.sonatype.org/service/local/staging/deploy/maven2/') {
|
||||
repository(url:'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
|
||||
authentication(userName:nexusUsername, password:nexusPassword)
|
||||
}
|
||||
pom.project {
|
||||
|
||||
@@ -373,7 +373,7 @@ public class MessageFactory<T extends IsoMessage> {
|
||||
throw new ParseException("Insufficient length for secondary bitmap", minlength);
|
||||
}
|
||||
if (forceStringEncoding) {
|
||||
byte[] _bb = new String(buf, isoHeaderLength+4, 16, encoding).getBytes();
|
||||
byte[] _bb = new String(buf, isoHeaderLength+20, 16, encoding).getBytes();
|
||||
System.arraycopy(_bb, 0, bitmapBuffer, 20+isoHeaderLength, 16);
|
||||
}
|
||||
for (int i = isoHeaderLength + 20; i < isoHeaderLength + 36; i++) {
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
package j8583;
|
||||
|
||||
import com.solab.iso8583.CustomField;
|
||||
package com.solab.iso8583;
|
||||
|
||||
/** This is an example of a custom field codec, which converts between strings and instances of this same class.
|
||||
* It's used to test the encoding and decoding of custom fields by the message factory.
|
||||
+1
-4
@@ -1,17 +1,14 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
|
||||
import com.solab.iso8583.IsoType;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.solab.iso8583.IsoMessage;
|
||||
import com.solab.iso8583.MessageFactory;
|
||||
import com.solab.iso8583.util.HexCodec;
|
||||
|
||||
/** Test binary message encoding and binary fields. */
|
||||
+1
-5
@@ -1,9 +1,5 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583;
|
||||
|
||||
import com.solab.iso8583.IsoMessage;
|
||||
import com.solab.iso8583.IsoType;
|
||||
import com.solab.iso8583.IsoValue;
|
||||
import com.solab.iso8583.MessageFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
+1
-5
@@ -1,9 +1,5 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583;
|
||||
|
||||
import com.solab.iso8583.IsoMessage;
|
||||
import com.solab.iso8583.IsoType;
|
||||
import com.solab.iso8583.IsoValue;
|
||||
import com.solab.iso8583.MessageFactory;
|
||||
import com.solab.iso8583.parse.*;
|
||||
import com.solab.iso8583.util.HexCodec;
|
||||
import org.junit.Assert;
|
||||
+1
-3
@@ -1,4 +1,4 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -7,8 +7,6 @@ import java.util.TimeZone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.solab.iso8583.IsoType;
|
||||
|
||||
/** Tests formatting of certain IsoTypes.
|
||||
*
|
||||
* @author Enrique Zamudio
|
||||
+22
-7
@@ -1,18 +1,15 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.ParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.solab.iso8583.IsoValue;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.solab.iso8583.IsoMessage;
|
||||
import com.solab.iso8583.IsoType;
|
||||
import com.solab.iso8583.MessageFactory;
|
||||
|
||||
/** These are very simple tests for creating and manipulating messages.
|
||||
*
|
||||
* @author Enrique Zamudio
|
||||
@@ -82,7 +79,7 @@ public class TestIsoMessage {
|
||||
@Test
|
||||
public void testParsing() throws IOException, ParseException {
|
||||
InputStream ins = getClass().getResourceAsStream("/parse1.txt");
|
||||
byte[] buf = new byte[400];
|
||||
final byte[] buf = new byte[400];
|
||||
int pos = 0;
|
||||
while (ins.available() > 0) {
|
||||
buf[pos++] = (byte)ins.read();
|
||||
@@ -96,6 +93,15 @@ public class TestIsoMessage {
|
||||
byte[] b3 = new byte[b2.length];
|
||||
System.arraycopy(buf, 0, b3, 0, b3.length);
|
||||
Assert.assertArrayEquals(b3, b2);
|
||||
|
||||
//Test it contains the correct fields
|
||||
final List<Integer> fields = Arrays.asList(3, 4, 7, 11, 12, 13, 15, 17, 32, 35, 37, 38, 39, 41, 43, 49, 60, 61, 100, 102, 126);
|
||||
testFields(iso, fields);
|
||||
//Again, but now with forced encoding
|
||||
mf.setForceStringEncoding(true);
|
||||
iso = mf.parseMessage(buf, mf.getIsoHeader(0x210).length());
|
||||
Assert.assertEquals(0x210, iso.getType());
|
||||
testFields(iso, fields);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -129,4 +135,13 @@ public class TestIsoMessage {
|
||||
throw new RuntimeException("Update failed!");
|
||||
}
|
||||
|
||||
private void testFields(IsoMessage m, List<Integer> fields) {
|
||||
for (int i = 2; i < 128; i++) {
|
||||
if (fields.contains(i)) {
|
||||
Assert.assertTrue(m.hasField(i));
|
||||
} else {
|
||||
Assert.assertFalse(m.hasField(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583;
|
||||
|
||||
import com.solab.iso8583.IsoMessage;
|
||||
import com.solab.iso8583.MessageFactory;
|
||||
import com.solab.iso8583.parse.ConfigParser;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
+1
-5
@@ -1,4 +1,4 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@@ -8,16 +8,12 @@ import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.solab.iso8583.IsoMessage;
|
||||
import com.solab.iso8583.IsoValue;
|
||||
import com.solab.iso8583.codecs.CompositeField;
|
||||
import com.solab.iso8583.parse.NumericParseInfo;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.solab.iso8583.MessageFactory;
|
||||
|
||||
/** Test that parsing invalid messages is properly handled.
|
||||
*
|
||||
* @author Enrique Zamudio
|
||||
+1
-4
@@ -1,13 +1,10 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583.parse;
|
||||
|
||||
import com.solab.iso8583.IsoType;
|
||||
import com.solab.iso8583.MessageFactory;
|
||||
import com.solab.iso8583.IsoMessage;
|
||||
import com.solab.iso8583.codecs.BigIntBcdCodec;
|
||||
import com.solab.iso8583.codecs.LongBcdCodec;
|
||||
import com.solab.iso8583.parse.FieldParseInfo;
|
||||
import com.solab.iso8583.parse.LlbinParseInfo;
|
||||
import com.solab.iso8583.parse.LllbinParseInfo;
|
||||
import com.solab.iso8583.util.HexCodec;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
+1
-4
@@ -1,11 +1,8 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583.parse;
|
||||
|
||||
import com.solab.iso8583.IsoType;
|
||||
import com.solab.iso8583.IsoValue;
|
||||
import com.solab.iso8583.codecs.CompositeField;
|
||||
import com.solab.iso8583.parse.AlphaParseInfo;
|
||||
import com.solab.iso8583.parse.LlvarParseInfo;
|
||||
import com.solab.iso8583.parse.NumericParseInfo;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
+1
-3
@@ -1,4 +1,4 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583.parse;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -10,8 +10,6 @@ import org.junit.*;
|
||||
|
||||
import com.solab.iso8583.IsoType;
|
||||
import com.solab.iso8583.IsoValue;
|
||||
import com.solab.iso8583.parse.Date10ParseInfo;
|
||||
import com.solab.iso8583.parse.Date4ParseInfo;
|
||||
|
||||
/** Test that the dates are formatted and parsed correctly.
|
||||
*
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.solab.iso8583.parse;
|
||||
|
||||
import com.solab.iso8583.IsoValue;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* Test parsing of data with different encodings.
|
||||
*
|
||||
* @author Enrique Zamudio
|
||||
* Date: 05/03/14 16:55
|
||||
*/
|
||||
public class TestEncoding {
|
||||
|
||||
@Test
|
||||
public void windowsToUtf8() throws UnsupportedEncodingException, ParseException {
|
||||
final String data = "05ácido";
|
||||
final byte[] buf = data.getBytes("ISO-8859-1");
|
||||
final LlvarParseInfo parser = new LlvarParseInfo();
|
||||
parser.setCharacterEncoding("UTF-8");
|
||||
IsoValue<?> field = parser.parse(1, buf, 0, null);
|
||||
Assert.assertNotEquals(field.getValue(), data.substring(2));
|
||||
parser.setCharacterEncoding("ISO-8859-1");
|
||||
field = parser.parse(1, buf, 0, null);
|
||||
Assert.assertEquals(data.substring(2), field.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583.util;
|
||||
|
||||
import com.solab.iso8583.util.Bcd;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
+1
-4
@@ -1,11 +1,8 @@
|
||||
package j8583;
|
||||
package com.solab.iso8583.util;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.solab.iso8583.util.HexCodec;
|
||||
|
||||
|
||||
public class TestHexCodec {
|
||||
|
||||
public void encodeDecode(String hex) {
|
||||
Reference in New Issue
Block a user