Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2165 - in development/planet/users/niclas/iso8583: . api/src/main/net/dpml/iso8583/data elements elements/src/main/net/dpml/iso8583/data/representation elements/src/test/net/dpml/iso8583/test/data/representation

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT hedhman.org
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2165 - in development/planet/users/niclas/iso8583: . api/src/main/net/dpml/iso8583/data elements elements/src/main/net/dpml/iso8583/data/representation elements/src/test/net/dpml/iso8583/test/data/representation
  • Date: Mon, 28 Mar 2005 13:48:37 -0500

Author: niclas AT hedhman.org
Date: Mon Mar 28 13:48:37 2005
New Revision: 2165

Added:

development/planet/users/niclas/iso8583/elements/src/test/net/dpml/iso8583/test/data/representation/ATestCase.java
(contents, props changed)
Modified:

development/planet/users/niclas/iso8583/api/src/main/net/dpml/iso8583/data/Representation.java
development/planet/users/niclas/iso8583/elements/elements.iml

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/A.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/AN.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANB.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANP.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANS.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANSB.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/AS.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/B.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/N.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableAN.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableANS.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableANSB.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableB.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableN.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableZ.java

development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/XN.java
development/planet/users/niclas/iso8583/index.xml
development/planet/users/niclas/iso8583/iso8583.iws
Log:
Work done on representation validation.

Modified:
development/planet/users/niclas/iso8583/api/src/main/net/dpml/iso8583/data/Representation.java
==============================================================================
---
development/planet/users/niclas/iso8583/api/src/main/net/dpml/iso8583/data/Representation.java
(original)
+++
development/planet/users/niclas/iso8583/api/src/main/net/dpml/iso8583/data/Representation.java
Mon Mar 28 13:48:37 2005
@@ -21,8 +21,6 @@
public interface Representation
{

- void validate( Object obj );
+ void validate( String value );

-
- String format( Object obj );
}

Modified: development/planet/users/niclas/iso8583/elements/elements.iml
==============================================================================
--- development/planet/users/niclas/iso8583/elements/elements.iml
(original)
+++ development/planet/users/niclas/iso8583/elements/elements.iml Mon
Mar 28 13:48:37 2005
@@ -15,6 +15,7 @@
<orderEntry type="library" name="Metro Public" level="application" />
<orderEntry type="library" name="JPos" level="project" />
<orderEntry type="library" name="Transit" level="application" />
+ <orderEntry type="library" name="junit" level="application" />
<orderEntryProperties />
</component>
</module>

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/A.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/A.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/A.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,32 @@
private int m_length;

public A( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
+ {
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
+ }
+ if( value.length() != m_length )
+ {
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected: " + value );
+ }
+ for( int i = 0; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ( ch < 'A' || ch > 'Z' ) && ( ch < 'a' || ch > 'z' ) )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }

- public String format( Object obj )
- {
- // TODO; generate string
- return null;
+ }
}
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/AN.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/AN.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/AN.java
Mon Mar 28 13:48:37 2005
@@ -20,28 +20,34 @@
import net.dpml.iso8583.data.Representation;
import net.dpml.lang.NullArgumentException;

-public class AN
+public class
+ AN
implements Representation
{
private int m_length;

public AN( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
+ if( value.length() != m_length )
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected: " + value );
+ for( int i = 0; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ( ch < 'A' || ch > 'Z' ) && ( ch < 'a' || ch > 'z' ) && ( ch
< '0' || ch > '9' ) )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }
+ }
}
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANB.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANB.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANB.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,23 @@
private int m_length;

public ANB( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
+ if( value.length() != m_length )
+ {
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected: " + value );
+ }
// TODO; check type
// TODO; check length
}
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
- }
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANP.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANP.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANP.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,29 @@
private int m_length;

public ANP( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
+ if( value instanceof String == false )
+ throw new IllegalArgumentException( "Incorrect type. String
expected." );
+ if( value.length() != m_length )
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected." );
+ for( int i = 0; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ( ch != ' ' ) && ( ch < 'A' || ch > 'Z' ) && ( ch < 'a' ||
ch > 'z' ) && ( ch < '0' || ch > '9' ) )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }
+ }
}
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANS.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANS.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANS.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,23 @@
private int m_length;

public ANS( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
+ if( value.length() != m_length )
+ {
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected: " + value );
+ }
// TODO; check type
// TODO; check length
}
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
- }
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANSB.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANSB.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/ANSB.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,23 @@
private int m_length;

public ANSB( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
+ if( value.length() != m_length )
+ {
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected: " + value );
+ }
// TODO; check type
// TODO; check length
}
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
- }
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/AS.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/AS.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/AS.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,23 @@
private int m_length;

public AS( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
+ if( value.length() != m_length )
+ {
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected: " + value );
+ }
// TODO; check type
// TODO; check length
}
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
- }
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/B.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/B.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/B.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,27 @@
private int m_length;

public B( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
+ if( value.length() != m_length * 8 )
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected." );
+ for( int i = 0; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ch != '0' && ch != '1' )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }
+ }
}
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
- }
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/N.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/N.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/N.java
Mon Mar 28 13:48:37 2005
@@ -27,21 +27,27 @@
private int m_length;

public N( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
-
- public String format( Object obj )
- {
- return null;
+ if( value.length() != m_length )
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected." );
+ for( int i = 0; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ch < '0' || ch > '9' )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }
+ }
}
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableAN.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableAN.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableAN.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,27 @@
private int m_length;

public VariableAN( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
+ if( value.length() > m_length )
+ throw new IllegalArgumentException( "Incorrect length. A maximum
of " + m_length + " characters are expected: " + value );
+ for( int i = 0; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ( ch < 'A' || ch > 'Z' ) && ( ch < 'a' || ch > 'z' ) && ( ch
< '0' || ch > '9' ) )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }
+ }
}
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableANS.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableANS.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableANS.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,21 @@
private int m_length;

public VariableANS( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
+ if( value.length() > m_length )
+ throw new IllegalArgumentException( "Incorrect length. A maximum
of " + m_length + " characters are expected: " + value );
// TODO; check type
// TODO; check length
}
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
- }
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableANSB.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableANSB.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableANSB.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,21 @@
private int m_length;

public VariableANSB( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
+ if( value.length() > m_length )
+ throw new IllegalArgumentException( "Incorrect length. A maximum
of " + m_length + " characters are expected: " + value );
// TODO; check type
// TODO; check length
}
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
- }
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableB.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableB.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableB.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,29 @@
private int m_length;

public VariableB( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
-
- public String format(Object obj)
- {
- // TODO; generate string
- return null;
+ if( value.length() % 8 == 0 )
+ throw new IllegalArgumentException( "Incorrect length. Binary
fields must be in blocks of 8 characters: " + value );
+ if( value.length() > m_length * 8 )
+ throw new IllegalArgumentException( "Incorrect length. A maximum
of " + m_length + " characters are expected: " + value );
+ for( int i = 0; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ch != '0' && ch != '1' )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }
+ }
}
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableN.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableN.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableN.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,27 @@
private int m_length;

public VariableN( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
+ if( value.length() > m_length )
+ throw new IllegalArgumentException( "Incorrect length. A maximum
of " + m_length + " characters are expected: " + value );
+ for( int i = 0; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ch < '0' || ch > '9' )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }
+ }
}
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableZ.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableZ.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/VariableZ.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,20 @@
private int m_length;

public VariableZ( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
-
- public String format( Object obj )
- {
- // TODO; generate string
- return null;
+ if( value.length() > m_length )
+ throw new IllegalArgumentException( "Incorrect length. A maximum
of " + m_length + " characters are expected: " + value );
+
}
}

Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/XN.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/XN.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/representation/XN.java
Mon Mar 28 13:48:37 2005
@@ -27,22 +27,35 @@
private int m_length;

public XN( int length )
+ throws IllegalArgumentException
{
+ if( length < 1 )
+ throw new IllegalArgumentException( "length must be greater or
equal to 1." );
m_length = length;
}

- public void validate( Object value )
+ public void validate( String value )
throws IllegalArgumentException
{
if( value == null )
throw new NullArgumentException( "value" );
- // TODO; check type
- // TODO; check length
- }
+ if( value.length() != m_length )
+ {
+ throw new IllegalArgumentException( "Incorrect length. " +
m_length + " characters expected: " + value );
+ }
+ char first = value.charAt( 0 );
+ if( first != 'c' && first != 'd' )
+ {
+ throw new IllegalArgumentException( "First character in this
field must either be 'c' for credit or 'd' for debit" );
+ }
+ for( int i = 1; i < value.length(); i++ )
+ {
+ char ch = value.charAt( i );
+ if( ch < '0' || ch > '9' )
+ {
+ throw new IllegalArgumentException( "Illegal character in
string: '" + ch + "' at position " + i + "." );
+ }
+ }

- public String format( Object obj )
- {
- // TODO; generate string
- return null;
}
}

Added:
development/planet/users/niclas/iso8583/elements/src/test/net/dpml/iso8583/test/data/representation/ATestCase.java
==============================================================================
--- (empty file)
+++
development/planet/users/niclas/iso8583/elements/src/test/net/dpml/iso8583/test/data/representation/ATestCase.java
Mon Mar 28 13:48:37 2005
@@ -0,0 +1,111 @@
+package net.dpml.iso8583.test.data.representation;
+
+import junit.framework.TestCase;
+import net.dpml.iso8583.data.Representation;
+import net.dpml.iso8583.data.representation.A;
+
+public class ATestCase
+ extends TestCase
+{
+
+ Representation m_rep;
+
+ public void setUp()
+ throws Exception
+ {
+ m_rep = new A( 26 );
+ }
+
+ public void testNull()
+ throws Exception
+ {
+ try
+ {
+ m_rep.validate( null );
+ fail( "null passed" );
+ } catch( IllegalArgumentException e )
+ {
+ // expected
+ }
+ }
+
+ public void testValidateCorrectType()
+ throws Exception
+ {
+ m_rep.validate( "abcdefghijklmnopqrstuvwxyz" );
+ m_rep.validate( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
+ m_rep.validate( "aBcDeFgHiJkLmNoPqRsTuVwXyZ" );
+ }
+
+ public void testValidateWrongType()
+ throws Exception
+ {
+ try
+ {
+ m_rep.validate( "abcdefghi!" );
+ fail( "exclamation mark passed" );
+ } catch( IllegalArgumentException e )
+ {
+ // expected
+ }
+ try
+ {
+ m_rep.validate( "abcdefghi0" );
+ fail( "number passed" );
+ } catch( IllegalArgumentException e )
+ {
+ // expected
+ }
+ try
+ {
+ m_rep.validate( "abcdefghi." );
+ fail( "dot passed" );
+ } catch( IllegalArgumentException e )
+ {
+ // expected
+ }
+ try
+ {
+ char ch = 132;
+ m_rep.validate( "abcdefghi" + ch );
+ fail( "strange char passed" );
+ } catch( IllegalArgumentException e )
+ {
+ // expected
+ }
+ }
+
+ public void testValidateTooShort()
+ throws Exception
+ {
+ try
+ {
+ m_rep.validate( "abcdefghijklmnopqrstuvwxy" );
+ fail( "too short passed" );
+ } catch( IllegalArgumentException e )
+ {
+ // expected
+ }
+
+ }
+
+ public void testValidateTooLong()
+ throws Exception
+ {
+ try
+ {
+ m_rep.validate( "abcdefghijklmnopqrstuvwxyzz" );
+ fail( "too long passed" );
+ } catch( IllegalArgumentException e )
+ {
+ // expected
+ }
+ }
+
+ public void testValidateCorrectLength()
+ throws Exception
+ {
+ m_rep.validate( "abcdefghijklmnopqrstuvwxyz" );
+ }
+
+}

Modified: development/planet/users/niclas/iso8583/index.xml
==============================================================================
--- development/planet/users/niclas/iso8583/index.xml (original)
+++ development/planet/users/niclas/iso8583/index.xml Mon Mar 28 13:48:37
2005
@@ -61,6 +61,7 @@
<include key="dpml-context-api" />
<include key="dpml-parameters-api"/>
<include key="dpml-service-api" />
+ <include key="dpml-transit-main" />
</dependencies>
<plugins>
<include key="dpml-meta-tools" />

Modified: development/planet/users/niclas/iso8583/iso8583.iws
==============================================================================
--- development/planet/users/niclas/iso8583/iso8583.iws (original)
+++ development/planet/users/niclas/iso8583/iso8583.iws Mon Mar 28 13:48:37
2005
@@ -146,76 +146,94 @@
<option name="HIDE_WARNINGS" value="false" />
</component>
<component name="FileEditorManager" split-orientation="vertical"
split-proportion="0.5">
- <first-group
selected-file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/ContinuationBit.java">
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/SystemsTraceAuditNumber.java"
pinned="false">
+ <first-group
selected-file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableZ.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableANS.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1319"
selection-end="1319" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/TransactionLifeCycleIdentificationData.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/ANS.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1351"
selection-end="1351" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="45" column="0" selection-start="1410"
selection-end="1410" vertical-scroll-proportion="0.55484694">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/XX.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/ANSB.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1304"
selection-end="1304" vertical-scroll-proportion="0.45335084">
+ <state line="45" column="0" selection-start="1412"
selection-end="1412" vertical-scroll-proportion="0.55484694">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountCardHolderBilling.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/AS.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1319"
selection-end="1319" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="45" column="0" selection-start="1408"
selection-end="1408" vertical-scroll-proportion="0.55484694">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountCardholderBillingFee.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/B.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1325"
selection-end="1325" vertical-scroll-proportion="0.32325888">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.114795916">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountReconciliation.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/N.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1313"
selection-end="1313" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.114795916">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountsOriginal.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableAN.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1303"
selection-end="1303" vertical-scroll-proportion="0.32325888">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountTransaction.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableB.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1307"
selection-end="1307" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/CardSequenceNumber.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableN.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1309"
selection-end="1309" vertical-scroll-proportion="0.32325888">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/ContinuationBit.java"
pinned="false">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableZ.java"
pinned="false">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1303"
selection-end="1303" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
@@ -235,9 +253,12 @@
<component name="J2EEProjectPane" />
<component name="NamedScopeManager" />
<component name="PackagesPane">
+ <expanded_node url="net.dpml.iso8583.data.elements" module="elements"
type="package" />
+ <expanded_node url="net.dpml.iso8583.test.data.representation"
module="elements" type="package" />
<expanded_node url="net.dpml.iso8583.data.representation"
module="elements" type="package" />
<expanded_node url="" module="elements" type="module" />
- <expanded_node url="net.dpml.iso8583.data.elements" module="elements"
type="package" />
+ <expanded_node url="net.dpml.iso8583.data" module="api" type="package" />
+ <expanded_node url="" module="api" type="module" />
</component>
<component name="ProjectPane">
<expanded_node url="file://$PROJECT_DIR$/elements/src/main/net/dpml"
module="elements" type="directory" />
@@ -363,7 +384,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
- <frame x="10" y="0" width="1260" height="977" extended-state="1" />
+ <frame x="10" y="0" width="1260" height="977" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false"
internal_type="docked" type="docked" visible="false" weight="0.33" order="8"
/>
@@ -456,114 +477,136 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/PosCapability.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/ANP.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="66" column="0" selection-start="2050"
selection-end="2050" vertical-scroll-proportion="0.8646518">
+ <state line="47" column="27" selection-start="1601"
selection-end="1601" vertical-scroll-proportion="0.59311223">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/PosDataCode.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/AN.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="68" column="0" selection-start="2038"
selection-end="2038" vertical-scroll-proportion="0.8646518">
+ <state line="23" column="4" selection-start="775"
selection-end="775" vertical-scroll-proportion="0.13392857">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/PrimaryAccountNumber.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/A.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="66" column="0" selection-start="2096"
selection-end="2096" vertical-scroll-proportion="0.8672799">
- <folding />
+ <state line="47" column="0" selection-start="1247"
selection-end="1426" vertical-scroll-proportion="0.59311223">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/ProcessingCode.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/ANB.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="66" column="0" selection-start="2051"
selection-end="2051" vertical-scroll-proportion="0.8646518">
+ <state line="45" column="0" selection-start="1410"
selection-end="1410" vertical-scroll-proportion="0.53571427">
<folding />
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/ReconciliationIndicator.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/ANS.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="66" column="0" selection-start="2095"
selection-end="2095" vertical-scroll-proportion="0.8646518">
- <folding />
+ <state line="45" column="0" selection-start="1410"
selection-end="1410" vertical-scroll-proportion="0.55484694">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/SystemsTraceAuditNumber.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/ANSB.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1319"
selection-end="1319" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="45" column="0" selection-start="1412"
selection-end="1412" vertical-scroll-proportion="0.55484694">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/TransactionLifeCycleIdentificationData.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/AS.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1351"
selection-end="1351" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="45" column="0" selection-start="1408"
selection-end="1408" vertical-scroll-proportion="0.55484694">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/XX.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/B.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1304"
selection-end="1304" vertical-scroll-proportion="0.45335084">
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.114795916">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountCardHolderBilling.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/N.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1319"
selection-end="1319" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.114795916">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountCardholderBillingFee.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableAN.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1325"
selection-end="1325" vertical-scroll-proportion="0.32325888">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountReconciliation.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableANS.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1313"
selection-end="1313" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountsOriginal.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableANSB.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1303"
selection-end="1303" vertical-scroll-proportion="0.32325888">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/AmountTransaction.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableB.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1307"
selection-end="1307" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/ContinuationBit.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableN.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1303"
selection-end="1303" vertical-scroll-proportion="0.3324573">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/elements/CardSequenceNumber.java">
+ <entry
file="file://$PROJECT_DIR$/elements/src/main/net/dpml/iso8583/data/representation/VariableZ.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="39" column="13" selection-start="1309"
selection-end="1309" vertical-scroll-proportion="0.32325888">
- <folding />
+ <state line="22" column="13" selection-start="771"
selection-end="771" vertical-scroll-proportion="0.11703511">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>



  • svn commit: r2165 - in development/planet/users/niclas/iso8583: . api/src/main/net/dpml/iso8583/data elements elements/src/main/net/dpml/iso8583/data/representation elements/src/test/net/dpml/iso8583/test/data/representation, niclas, 03/28/2005

Archive powered by MHonArc 2.6.24.

Top of Page