target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testEqualsSids() { assertEquals( 0, comparator.compare( "000", "000" ) ); assertEquals( 0, comparator.compare( "000", "0" ) ); assertEquals( 0, comparator.compare( "fff", "fff" ) ); }
public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; }
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; } }
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; } CsnSidComparator( String oid ); }
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; } CsnSidComparator( String oid ); int compare( String sidStr1, String sidStr2 ); }
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; } CsnSidComparator( String oid ); int compare( String sidStr1, String sidStr2 ); }
@Test public void testDifferentSids() { assertEquals( -1, comparator.compare( "123", "456" ) ); assertEquals( 1, comparator.compare( "FFF", "000" ) ); assertEquals( 1, comparator.compare( "FFF", "GGG" ) ); }
public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; }
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; } }
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; } CsnSidComparator( String oid ); }
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; } CsnSidComparator( String oid ); int compare( String sidStr1, String sidStr2 ); }
CsnSidComparator extends LdapComparator<String> { public int compare( String sidStr1, String sidStr2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13744_COMPARING_CSN_SID, sidStr1, sidStr2 ) ); } if ( sidStr1 == null ) { return ( sidStr2 == null ) ? 0 : -1; } if ( sidStr2 == null ) { return 1; } int sid1 = 0; int sid2; try { sid1 = Integer.parseInt( sidStr1, 16 ); } catch ( NumberFormatException nfe ) { return -1; } try { sid2 = Integer.parseInt( sidStr2, 16 ); } catch ( NumberFormatException nfe ) { return 1; } if ( sid1 > sid2 ) { return 1; } else if ( sid2 > sid1 ) { return -1; } return 0; } CsnSidComparator( String oid ); int compare( String sidStr1, String sidStr2 ); }
@Test public void testNullBitString() { assertEquals( 0, comparator.compare( null, null ) ); assertEquals( -1, comparator.compare( null, "0101B" ) ); assertEquals( -1, comparator.compare( null, "000B" ) ); assertEquals( 1, comparator.compare( "0101B", null ) ); assertEquals( 1, comparator.compare( "111B", null ) ); }
public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); int compare( String bs1, String bs2 ); }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); int compare( String bs1, String bs2 ); }
@Test public void testBitStringsEquals() { assertEquals( 0, comparator.compare( "0B", "0B" ) ); assertEquals( 0, comparator.compare( "1B", "1B" ) ); assertEquals( 0, comparator.compare( "101010B", "101010B" ) ); assertEquals( 0, comparator.compare( "00000101010B", "00101010B" ) ); }
public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); int compare( String bs1, String bs2 ); }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); int compare( String bs1, String bs2 ); }
@Test public void testBitStringsNotEquals() { assertEquals( -1, comparator.compare( "0B", "1B" ) ); assertEquals( 1, comparator.compare( "1B", "0B" ) ); assertEquals( 1, comparator.compare( "101110B", "101010B" ) ); assertEquals( -1, comparator.compare( "00000101010B", "00111010B" ) ); }
public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); int compare( String bs1, String bs2 ); }
BitStringComparator extends LdapComparator<String> { public int compare( String bs1, String bs2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13743_COMPARING_BITSTRING, bs1, bs2 ) ); } if ( bs1 == bs2 ) { return 0; } if ( ( bs1 == null ) || ( bs2 == null ) ) { return bs1 == null ? -1 : 1; } char[] array1 = bs1.toCharArray(); char[] array2 = bs2.toCharArray(); int pos1 = bs1.indexOf( '1' ); int pos2 = bs2.indexOf( '1' ); if ( pos1 == -1 ) { if ( pos2 == -1 ) { return 0; } else { return -1; } } else if ( pos2 == -1 ) { return 1; } int length1 = array1.length - pos1; int length2 = array2.length - pos2; if ( length1 == length2 ) { for ( int i = 0; i < length1; i++ ) { int i1 = i + pos1; int i2 = i + pos2; if ( array1[i1] < array2[i2] ) { return -1; } else if ( array1[i1] > array2[i2] ) { return 1; } } return 0; } if ( length1 < length2 ) { return -1; } else { return 1; } } BitStringComparator( String oid ); int compare( String bs1, String bs2 ); }
@Test public void testBothNull() { assertEquals( 0, new ByteArrayComparator( null ).compare( null, null ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testB2Null() { assertEquals( 1, new ByteArrayComparator( null ).compare( new byte[0], null ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testB1Null() { assertEquals( -1, new ByteArrayComparator( null ).compare( null, new byte[0] ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testCalendar() throws ParseException { Calendar calendar = new GregorianCalendar( GMT, Locale.ROOT ); calendar.set( Calendar.YEAR, 2008 ); calendar.set( Calendar.MONTH, 0 ); calendar.set( Calendar.DAY_OF_MONTH, 2 ); calendar.set( Calendar.HOUR_OF_DAY, 12 ); calendar.set( Calendar.MINUTE, 13 ); calendar.set( Calendar.SECOND, 14 ); calendar.set( Calendar.MILLISECOND, 222 ); calendar.setTimeZone( TimeZone.getTimeZone( "GMT" ) ); GeneralizedTime generalizedTime = new GeneralizedTime( calendar ); String result = generalizedTime.toGeneralizedTime(); assertEquals( "20080102121314.222Z", result ); }
public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); }
GeneralizedTime implements Comparable<GeneralizedTime> { public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } }
GeneralizedTime implements Comparable<GeneralizedTime> { public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); }
GeneralizedTime implements Comparable<GeneralizedTime> { public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneralizedTimeWithoutFraction(); String toGeneralizedTime( Format format, FractionDelimiter fractionDelimiter, int fractionLength, TimeZoneFormat timeZoneFormat ); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override int compareTo( GeneralizedTime other ); long getTime(); Date getDate(); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinutes(); int getSeconds(); int getFraction(); static Date getDate( String zuluTime ); }
GeneralizedTime implements Comparable<GeneralizedTime> { public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneralizedTimeWithoutFraction(); String toGeneralizedTime( Format format, FractionDelimiter fractionDelimiter, int fractionLength, TimeZoneFormat timeZoneFormat ); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override int compareTo( GeneralizedTime other ); long getTime(); Date getDate(); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinutes(); int getSeconds(); int getFraction(); static Date getDate( String zuluTime ); }
@Test public void testBothEmpty() { assertEquals( 0, new ByteArrayComparator( null ).compare( new byte[0], new byte[0] ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testBothEqualLengthOne() { assertEquals( 0, new ByteArrayComparator( null ).compare( new byte[1], new byte[1] ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testBothEqualLengthTen() { assertEquals( 0, new ByteArrayComparator( null ).compare( new byte[10], new byte[10] ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testB1PrefixOfB2() { byte[] b1 = new byte[] { 0, 1, 2 }; byte[] b2 = new byte[] { 0, 1, 2, 3 }; assertEquals( -1, new ByteArrayComparator( null ).compare( b1, b2 ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testB2PrefixOfB1() { byte[] b1 = new byte[] { 0, 1, 2, 3 }; byte[] b2 = new byte[] { 0, 1, 2 }; assertEquals( 1, new ByteArrayComparator( null ).compare( b1, b2 ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testB1GreaterThanB2() { byte[] b1 = new byte[] { 0, 5 }; byte[] b2 = new byte[] { 0, 1, 2 }; assertEquals( 1, new ByteArrayComparator( null ).compare( b1, b2 ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testB1GreaterThanB2SameLength() { byte[] b1 = new byte[] { 0, 5 }; byte[] b2 = new byte[] { 0, 1 }; assertEquals( 1, new ByteArrayComparator( null ).compare( b1, b2 ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testB2GreaterThanB1() { byte[] b1 = new byte[] { 0, 1, 2 }; byte[] b2 = new byte[] { 0, 5 }; assertEquals( -1, new ByteArrayComparator( null ).compare( b1, b2 ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testB2GreaterThanB1SameLength() { byte[] b1 = new byte[] { 0, 1 }; byte[] b2 = new byte[] { 0, 5 }; assertEquals( -1, new ByteArrayComparator( null ).compare( b1, b2 ) ); }
public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
ByteArrayComparator extends LdapComparator<byte[]> { public int compare( byte[] b1, byte[] b2 ) { return Strings.compare( b1, b2 ); } ByteArrayComparator( String oid ); int compare( byte[] b1, byte[] b2 ); }
@Test public void testNullObjectIdentifiers() { assertEquals( 0, comparator.compare( null, null ) ); String c2 = "( 1.1 FQCN org.apache.directory.SimpleComparator BYTECODE ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )"; assertEquals( -1, comparator.compare( null, c2 ) ); assertEquals( -1, comparator.compare( c2, null ) ); }
public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); int compare( String s1, String s2 ); }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); int compare( String s1, String s2 ); }
@Test public void testCompareTo() throws ParseException { String gt1 = "20080102121313,999Z"; GeneralizedTime generalizedTime1 = new GeneralizedTime( gt1 ); String gt2 = "20080102121314Z"; GeneralizedTime generalizedTime2 = new GeneralizedTime( gt2 ); String gt3 = "20080102121314,001Z"; GeneralizedTime generalizedTime3 = new GeneralizedTime( gt3 ); assertTrue( generalizedTime1.compareTo( generalizedTime2 ) < 0 ); assertTrue( generalizedTime1.compareTo( generalizedTime3 ) < 0 ); assertTrue( generalizedTime2.compareTo( generalizedTime3 ) < 0 ); assertTrue( generalizedTime2.compareTo( generalizedTime1 ) > 0 ); assertTrue( generalizedTime3.compareTo( generalizedTime1 ) > 0 ); assertTrue( generalizedTime3.compareTo( generalizedTime2 ) > 0 ); assertTrue( generalizedTime1.compareTo( generalizedTime1 ) == 0 ); assertTrue( generalizedTime2.compareTo( generalizedTime2 ) == 0 ); assertTrue( generalizedTime3.compareTo( generalizedTime3 ) == 0 ); }
@Override public int compareTo( GeneralizedTime other ) { return calendar.compareTo( other.calendar ); }
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public int compareTo( GeneralizedTime other ) { return calendar.compareTo( other.calendar ); } }
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public int compareTo( GeneralizedTime other ) { return calendar.compareTo( other.calendar ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); }
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public int compareTo( GeneralizedTime other ) { return calendar.compareTo( other.calendar ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneralizedTimeWithoutFraction(); String toGeneralizedTime( Format format, FractionDelimiter fractionDelimiter, int fractionLength, TimeZoneFormat timeZoneFormat ); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override int compareTo( GeneralizedTime other ); long getTime(); Date getDate(); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinutes(); int getSeconds(); int getFraction(); static Date getDate( String zuluTime ); }
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public int compareTo( GeneralizedTime other ) { return calendar.compareTo( other.calendar ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneralizedTimeWithoutFraction(); String toGeneralizedTime( Format format, FractionDelimiter fractionDelimiter, int fractionLength, TimeZoneFormat timeZoneFormat ); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override int compareTo( GeneralizedTime other ); long getTime(); Date getDate(); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinutes(); int getSeconds(); int getFraction(); static Date getDate( String zuluTime ); }
@Test public void testNewOidNull() { try { Oid.fromBytes( ( byte[] ) null ); fail( "Should not reach this point ..." ); } catch ( DecoderException de ) { assertTrue( true ); } }
public static Oid fromBytes( byte[] oidBytes ) throws DecoderException { if ( ( oidBytes == null ) || ( oidBytes.length < 1 ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } StringBuilder builder = new StringBuilder(); long value = 0; int valStart = 0; int valLength = 0; boolean firstArc = true; for ( int i = 0; i < oidBytes.length; i++ ) { value |= oidBytes[i] & 0x7F; if ( oidBytes[i] < 0 ) { value = value << 7; valLength++; } else { valLength++; if ( valLength > 8 ) { int nbBytes = valLength * 7 / 8; if ( valLength % 7 != 0 ) { nbBytes++; } byte[] result = new byte[nbBytes]; int pos = nbBytes - 1; int valEnd = valStart + valLength - 1; int j = 0; while ( j < valLength - 8 ) { result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 1] << 7 ) | ( oidBytes[valEnd - j] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 2] << 6 ) | ( ( oidBytes[valEnd - j - 1] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 3] << 5 ) | ( ( oidBytes[valEnd - j - 2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 4] << 4 ) | ( ( oidBytes[valEnd - j - 3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 5] << 3 ) | ( ( oidBytes[valEnd - j - 4] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 6] << 2 ) | ( ( oidBytes[valEnd - j - 5] & 0x60 ) >> 5 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 7] << 1 ) | ( ( oidBytes[valEnd - j - 6] & 0x40 ) >> 6 ) ); j += 8; } switch ( valLength - j ) { case 7 : result[pos--] = ( byte ) ( ( oidBytes[5] << 7 ) | ( oidBytes[6] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[4] << 6 ) | ( ( oidBytes[5] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 5 ) | ( ( oidBytes[4] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 4 ) | ( ( oidBytes[3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 3 ) | ( ( oidBytes[2] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 2 ) | ( ( oidBytes[1] & 0x60 ) >> 5 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x40 ) >> 6 ); break; case 6 : result[pos--] = ( byte ) ( ( oidBytes[4] << 7 ) | ( oidBytes[5] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 6 ) | ( ( oidBytes[4] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 5 ) | ( ( oidBytes[3] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 4 ) | ( ( oidBytes[2] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 3 ) | ( ( oidBytes[1] & 0x70 ) >> 4 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x60 ) >> 5 ); break; case 5 : result[pos--] = ( byte ) ( ( oidBytes[3] << 7 ) | ( oidBytes[4] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 6 ) | ( ( oidBytes[3] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 5 ) | ( ( oidBytes[2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 4 ) | ( ( oidBytes[1] & 0x78 ) >> 3 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x70 ) >> 4 ); break; case 4 : result[pos--] = ( byte ) ( ( oidBytes[2] << 7 ) | ( oidBytes[3] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 6 ) | ( ( oidBytes[2] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 5 ) | ( ( oidBytes[1] & 0x7C ) >> 2 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x78 ) >> 3 ); break; case 3 : result[pos--] = ( byte ) ( ( oidBytes[1] << 7 ) | ( oidBytes[2] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 6 ) | ( ( oidBytes[1] & 0x7E ) >> 1 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7C ) >> 2 ); break; case 2 : result[pos--] = ( byte ) ( ( oidBytes[0] << 7 ) | ( oidBytes[1] & 0x7F ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7E ) >> 1 ); break; case 1 : result[pos] = ( byte ) ( oidBytes[0] & 0x7F ); break; default : break; } BigInteger bigInteger; if ( ( result[0] & 0x80 ) == 0x80 ) { byte[] newResult = new byte[result.length + 1]; System.arraycopy( result, 0, newResult, 1, result.length ); result = newResult; } bigInteger = new BigInteger( result ); if ( firstArc ) { bigInteger = bigInteger.subtract( JOINT_ISO_ITU_T ); builder.append( '2' ); } builder.append( '.' ).append( bigInteger.toString() ); } else { if ( firstArc ) { if ( value >= 80 ) { builder.append( '2' ); value = value - 80; } else { long one = value / 40; long two = value % 40; if ( ( one < 0 ) || ( one > 2 ) || ( two < 0 ) || ( ( one < 2 ) && ( two > 39 ) ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } if ( one < 2 ) { builder.append( one ); value = two; } } firstArc = false; } builder.append( '.' ).append( value ); } valStart = i; valLength = 0; value = 0; } } return new Oid( builder.toString(), oidBytes ); }
Oid { public static Oid fromBytes( byte[] oidBytes ) throws DecoderException { if ( ( oidBytes == null ) || ( oidBytes.length < 1 ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } StringBuilder builder = new StringBuilder(); long value = 0; int valStart = 0; int valLength = 0; boolean firstArc = true; for ( int i = 0; i < oidBytes.length; i++ ) { value |= oidBytes[i] & 0x7F; if ( oidBytes[i] < 0 ) { value = value << 7; valLength++; } else { valLength++; if ( valLength > 8 ) { int nbBytes = valLength * 7 / 8; if ( valLength % 7 != 0 ) { nbBytes++; } byte[] result = new byte[nbBytes]; int pos = nbBytes - 1; int valEnd = valStart + valLength - 1; int j = 0; while ( j < valLength - 8 ) { result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 1] << 7 ) | ( oidBytes[valEnd - j] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 2] << 6 ) | ( ( oidBytes[valEnd - j - 1] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 3] << 5 ) | ( ( oidBytes[valEnd - j - 2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 4] << 4 ) | ( ( oidBytes[valEnd - j - 3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 5] << 3 ) | ( ( oidBytes[valEnd - j - 4] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 6] << 2 ) | ( ( oidBytes[valEnd - j - 5] & 0x60 ) >> 5 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 7] << 1 ) | ( ( oidBytes[valEnd - j - 6] & 0x40 ) >> 6 ) ); j += 8; } switch ( valLength - j ) { case 7 : result[pos--] = ( byte ) ( ( oidBytes[5] << 7 ) | ( oidBytes[6] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[4] << 6 ) | ( ( oidBytes[5] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 5 ) | ( ( oidBytes[4] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 4 ) | ( ( oidBytes[3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 3 ) | ( ( oidBytes[2] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 2 ) | ( ( oidBytes[1] & 0x60 ) >> 5 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x40 ) >> 6 ); break; case 6 : result[pos--] = ( byte ) ( ( oidBytes[4] << 7 ) | ( oidBytes[5] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 6 ) | ( ( oidBytes[4] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 5 ) | ( ( oidBytes[3] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 4 ) | ( ( oidBytes[2] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 3 ) | ( ( oidBytes[1] & 0x70 ) >> 4 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x60 ) >> 5 ); break; case 5 : result[pos--] = ( byte ) ( ( oidBytes[3] << 7 ) | ( oidBytes[4] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 6 ) | ( ( oidBytes[3] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 5 ) | ( ( oidBytes[2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 4 ) | ( ( oidBytes[1] & 0x78 ) >> 3 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x70 ) >> 4 ); break; case 4 : result[pos--] = ( byte ) ( ( oidBytes[2] << 7 ) | ( oidBytes[3] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 6 ) | ( ( oidBytes[2] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 5 ) | ( ( oidBytes[1] & 0x7C ) >> 2 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x78 ) >> 3 ); break; case 3 : result[pos--] = ( byte ) ( ( oidBytes[1] << 7 ) | ( oidBytes[2] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 6 ) | ( ( oidBytes[1] & 0x7E ) >> 1 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7C ) >> 2 ); break; case 2 : result[pos--] = ( byte ) ( ( oidBytes[0] << 7 ) | ( oidBytes[1] & 0x7F ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7E ) >> 1 ); break; case 1 : result[pos] = ( byte ) ( oidBytes[0] & 0x7F ); break; default : break; } BigInteger bigInteger; if ( ( result[0] & 0x80 ) == 0x80 ) { byte[] newResult = new byte[result.length + 1]; System.arraycopy( result, 0, newResult, 1, result.length ); result = newResult; } bigInteger = new BigInteger( result ); if ( firstArc ) { bigInteger = bigInteger.subtract( JOINT_ISO_ITU_T ); builder.append( '2' ); } builder.append( '.' ).append( bigInteger.toString() ); } else { if ( firstArc ) { if ( value >= 80 ) { builder.append( '2' ); value = value - 80; } else { long one = value / 40; long two = value % 40; if ( ( one < 0 ) || ( one > 2 ) || ( two < 0 ) || ( ( one < 2 ) && ( two > 39 ) ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } if ( one < 2 ) { builder.append( one ); value = two; } } firstArc = false; } builder.append( '.' ).append( value ); } valStart = i; valLength = 0; value = 0; } } return new Oid( builder.toString(), oidBytes ); } }
Oid { public static Oid fromBytes( byte[] oidBytes ) throws DecoderException { if ( ( oidBytes == null ) || ( oidBytes.length < 1 ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } StringBuilder builder = new StringBuilder(); long value = 0; int valStart = 0; int valLength = 0; boolean firstArc = true; for ( int i = 0; i < oidBytes.length; i++ ) { value |= oidBytes[i] & 0x7F; if ( oidBytes[i] < 0 ) { value = value << 7; valLength++; } else { valLength++; if ( valLength > 8 ) { int nbBytes = valLength * 7 / 8; if ( valLength % 7 != 0 ) { nbBytes++; } byte[] result = new byte[nbBytes]; int pos = nbBytes - 1; int valEnd = valStart + valLength - 1; int j = 0; while ( j < valLength - 8 ) { result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 1] << 7 ) | ( oidBytes[valEnd - j] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 2] << 6 ) | ( ( oidBytes[valEnd - j - 1] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 3] << 5 ) | ( ( oidBytes[valEnd - j - 2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 4] << 4 ) | ( ( oidBytes[valEnd - j - 3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 5] << 3 ) | ( ( oidBytes[valEnd - j - 4] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 6] << 2 ) | ( ( oidBytes[valEnd - j - 5] & 0x60 ) >> 5 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 7] << 1 ) | ( ( oidBytes[valEnd - j - 6] & 0x40 ) >> 6 ) ); j += 8; } switch ( valLength - j ) { case 7 : result[pos--] = ( byte ) ( ( oidBytes[5] << 7 ) | ( oidBytes[6] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[4] << 6 ) | ( ( oidBytes[5] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 5 ) | ( ( oidBytes[4] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 4 ) | ( ( oidBytes[3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 3 ) | ( ( oidBytes[2] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 2 ) | ( ( oidBytes[1] & 0x60 ) >> 5 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x40 ) >> 6 ); break; case 6 : result[pos--] = ( byte ) ( ( oidBytes[4] << 7 ) | ( oidBytes[5] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 6 ) | ( ( oidBytes[4] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 5 ) | ( ( oidBytes[3] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 4 ) | ( ( oidBytes[2] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 3 ) | ( ( oidBytes[1] & 0x70 ) >> 4 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x60 ) >> 5 ); break; case 5 : result[pos--] = ( byte ) ( ( oidBytes[3] << 7 ) | ( oidBytes[4] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 6 ) | ( ( oidBytes[3] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 5 ) | ( ( oidBytes[2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 4 ) | ( ( oidBytes[1] & 0x78 ) >> 3 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x70 ) >> 4 ); break; case 4 : result[pos--] = ( byte ) ( ( oidBytes[2] << 7 ) | ( oidBytes[3] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 6 ) | ( ( oidBytes[2] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 5 ) | ( ( oidBytes[1] & 0x7C ) >> 2 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x78 ) >> 3 ); break; case 3 : result[pos--] = ( byte ) ( ( oidBytes[1] << 7 ) | ( oidBytes[2] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 6 ) | ( ( oidBytes[1] & 0x7E ) >> 1 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7C ) >> 2 ); break; case 2 : result[pos--] = ( byte ) ( ( oidBytes[0] << 7 ) | ( oidBytes[1] & 0x7F ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7E ) >> 1 ); break; case 1 : result[pos] = ( byte ) ( oidBytes[0] & 0x7F ); break; default : break; } BigInteger bigInteger; if ( ( result[0] & 0x80 ) == 0x80 ) { byte[] newResult = new byte[result.length + 1]; System.arraycopy( result, 0, newResult, 1, result.length ); result = newResult; } bigInteger = new BigInteger( result ); if ( firstArc ) { bigInteger = bigInteger.subtract( JOINT_ISO_ITU_T ); builder.append( '2' ); } builder.append( '.' ).append( bigInteger.toString() ); } else { if ( firstArc ) { if ( value >= 80 ) { builder.append( '2' ); value = value - 80; } else { long one = value / 40; long two = value % 40; if ( ( one < 0 ) || ( one > 2 ) || ( two < 0 ) || ( ( one < 2 ) && ( two > 39 ) ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } if ( one < 2 ) { builder.append( one ); value = two; } } firstArc = false; } builder.append( '.' ).append( value ); } valStart = i; valLength = 0; value = 0; } } return new Oid( builder.toString(), oidBytes ); } private Oid( String oidString, byte[] oidBytes ); }
Oid { public static Oid fromBytes( byte[] oidBytes ) throws DecoderException { if ( ( oidBytes == null ) || ( oidBytes.length < 1 ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } StringBuilder builder = new StringBuilder(); long value = 0; int valStart = 0; int valLength = 0; boolean firstArc = true; for ( int i = 0; i < oidBytes.length; i++ ) { value |= oidBytes[i] & 0x7F; if ( oidBytes[i] < 0 ) { value = value << 7; valLength++; } else { valLength++; if ( valLength > 8 ) { int nbBytes = valLength * 7 / 8; if ( valLength % 7 != 0 ) { nbBytes++; } byte[] result = new byte[nbBytes]; int pos = nbBytes - 1; int valEnd = valStart + valLength - 1; int j = 0; while ( j < valLength - 8 ) { result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 1] << 7 ) | ( oidBytes[valEnd - j] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 2] << 6 ) | ( ( oidBytes[valEnd - j - 1] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 3] << 5 ) | ( ( oidBytes[valEnd - j - 2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 4] << 4 ) | ( ( oidBytes[valEnd - j - 3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 5] << 3 ) | ( ( oidBytes[valEnd - j - 4] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 6] << 2 ) | ( ( oidBytes[valEnd - j - 5] & 0x60 ) >> 5 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 7] << 1 ) | ( ( oidBytes[valEnd - j - 6] & 0x40 ) >> 6 ) ); j += 8; } switch ( valLength - j ) { case 7 : result[pos--] = ( byte ) ( ( oidBytes[5] << 7 ) | ( oidBytes[6] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[4] << 6 ) | ( ( oidBytes[5] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 5 ) | ( ( oidBytes[4] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 4 ) | ( ( oidBytes[3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 3 ) | ( ( oidBytes[2] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 2 ) | ( ( oidBytes[1] & 0x60 ) >> 5 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x40 ) >> 6 ); break; case 6 : result[pos--] = ( byte ) ( ( oidBytes[4] << 7 ) | ( oidBytes[5] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 6 ) | ( ( oidBytes[4] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 5 ) | ( ( oidBytes[3] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 4 ) | ( ( oidBytes[2] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 3 ) | ( ( oidBytes[1] & 0x70 ) >> 4 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x60 ) >> 5 ); break; case 5 : result[pos--] = ( byte ) ( ( oidBytes[3] << 7 ) | ( oidBytes[4] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 6 ) | ( ( oidBytes[3] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 5 ) | ( ( oidBytes[2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 4 ) | ( ( oidBytes[1] & 0x78 ) >> 3 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x70 ) >> 4 ); break; case 4 : result[pos--] = ( byte ) ( ( oidBytes[2] << 7 ) | ( oidBytes[3] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 6 ) | ( ( oidBytes[2] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 5 ) | ( ( oidBytes[1] & 0x7C ) >> 2 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x78 ) >> 3 ); break; case 3 : result[pos--] = ( byte ) ( ( oidBytes[1] << 7 ) | ( oidBytes[2] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 6 ) | ( ( oidBytes[1] & 0x7E ) >> 1 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7C ) >> 2 ); break; case 2 : result[pos--] = ( byte ) ( ( oidBytes[0] << 7 ) | ( oidBytes[1] & 0x7F ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7E ) >> 1 ); break; case 1 : result[pos] = ( byte ) ( oidBytes[0] & 0x7F ); break; default : break; } BigInteger bigInteger; if ( ( result[0] & 0x80 ) == 0x80 ) { byte[] newResult = new byte[result.length + 1]; System.arraycopy( result, 0, newResult, 1, result.length ); result = newResult; } bigInteger = new BigInteger( result ); if ( firstArc ) { bigInteger = bigInteger.subtract( JOINT_ISO_ITU_T ); builder.append( '2' ); } builder.append( '.' ).append( bigInteger.toString() ); } else { if ( firstArc ) { if ( value >= 80 ) { builder.append( '2' ); value = value - 80; } else { long one = value / 40; long two = value % 40; if ( ( one < 0 ) || ( one > 2 ) || ( two < 0 ) || ( ( one < 2 ) && ( two > 39 ) ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } if ( one < 2 ) { builder.append( one ); value = two; } } firstArc = false; } builder.append( '.' ).append( value ); } valStart = i; valLength = 0; value = 0; } } return new Oid( builder.toString(), oidBytes ); } private Oid( String oidString, byte[] oidBytes ); @Override boolean equals( Object other ); static Oid fromBytes( byte[] oidBytes ); static Oid fromString( String oidString ); int getEncodedLength(); @Override int hashCode(); static boolean isOid( String oidString ); byte[] toBytes(); @Override String toString(); void writeBytesTo( ByteBuffer buffer ); void writeBytesTo( OutputStream outputStream ); }
Oid { public static Oid fromBytes( byte[] oidBytes ) throws DecoderException { if ( ( oidBytes == null ) || ( oidBytes.length < 1 ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } StringBuilder builder = new StringBuilder(); long value = 0; int valStart = 0; int valLength = 0; boolean firstArc = true; for ( int i = 0; i < oidBytes.length; i++ ) { value |= oidBytes[i] & 0x7F; if ( oidBytes[i] < 0 ) { value = value << 7; valLength++; } else { valLength++; if ( valLength > 8 ) { int nbBytes = valLength * 7 / 8; if ( valLength % 7 != 0 ) { nbBytes++; } byte[] result = new byte[nbBytes]; int pos = nbBytes - 1; int valEnd = valStart + valLength - 1; int j = 0; while ( j < valLength - 8 ) { result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 1] << 7 ) | ( oidBytes[valEnd - j] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 2] << 6 ) | ( ( oidBytes[valEnd - j - 1] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 3] << 5 ) | ( ( oidBytes[valEnd - j - 2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 4] << 4 ) | ( ( oidBytes[valEnd - j - 3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 5] << 3 ) | ( ( oidBytes[valEnd - j - 4] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 6] << 2 ) | ( ( oidBytes[valEnd - j - 5] & 0x60 ) >> 5 ) ); result[pos--] = ( byte ) ( ( oidBytes[valEnd - j - 7] << 1 ) | ( ( oidBytes[valEnd - j - 6] & 0x40 ) >> 6 ) ); j += 8; } switch ( valLength - j ) { case 7 : result[pos--] = ( byte ) ( ( oidBytes[5] << 7 ) | ( oidBytes[6] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[4] << 6 ) | ( ( oidBytes[5] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 5 ) | ( ( oidBytes[4] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 4 ) | ( ( oidBytes[3] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 3 ) | ( ( oidBytes[2] & 0x70 ) >> 4 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 2 ) | ( ( oidBytes[1] & 0x60 ) >> 5 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x40 ) >> 6 ); break; case 6 : result[pos--] = ( byte ) ( ( oidBytes[4] << 7 ) | ( oidBytes[5] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[3] << 6 ) | ( ( oidBytes[4] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 5 ) | ( ( oidBytes[3] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 4 ) | ( ( oidBytes[2] & 0x78 ) >> 3 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 3 ) | ( ( oidBytes[1] & 0x70 ) >> 4 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x60 ) >> 5 ); break; case 5 : result[pos--] = ( byte ) ( ( oidBytes[3] << 7 ) | ( oidBytes[4] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[2] << 6 ) | ( ( oidBytes[3] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 5 ) | ( ( oidBytes[2] & 0x7C ) >> 2 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 4 ) | ( ( oidBytes[1] & 0x78 ) >> 3 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x70 ) >> 4 ); break; case 4 : result[pos--] = ( byte ) ( ( oidBytes[2] << 7 ) | ( oidBytes[3] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[1] << 6 ) | ( ( oidBytes[2] & 0x7E ) >> 1 ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 5 ) | ( ( oidBytes[1] & 0x7C ) >> 2 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x78 ) >> 3 ); break; case 3 : result[pos--] = ( byte ) ( ( oidBytes[1] << 7 ) | ( oidBytes[2] & 0x7F ) ); result[pos--] = ( byte ) ( ( oidBytes[0] << 6 ) | ( ( oidBytes[1] & 0x7E ) >> 1 ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7C ) >> 2 ); break; case 2 : result[pos--] = ( byte ) ( ( oidBytes[0] << 7 ) | ( oidBytes[1] & 0x7F ) ); result[pos] = ( byte ) ( ( oidBytes[0] & 0x7E ) >> 1 ); break; case 1 : result[pos] = ( byte ) ( oidBytes[0] & 0x7F ); break; default : break; } BigInteger bigInteger; if ( ( result[0] & 0x80 ) == 0x80 ) { byte[] newResult = new byte[result.length + 1]; System.arraycopy( result, 0, newResult, 1, result.length ); result = newResult; } bigInteger = new BigInteger( result ); if ( firstArc ) { bigInteger = bigInteger.subtract( JOINT_ISO_ITU_T ); builder.append( '2' ); } builder.append( '.' ).append( bigInteger.toString() ); } else { if ( firstArc ) { if ( value >= 80 ) { builder.append( '2' ); value = value - 80; } else { long one = value / 40; long two = value % 40; if ( ( one < 0 ) || ( one > 2 ) || ( two < 0 ) || ( ( one < 2 ) && ( two > 39 ) ) ) { throw new DecoderException( I18n.err( I18n.ERR_00003_INVALID_OID, Arrays.toString( oidBytes ) ) ); } if ( one < 2 ) { builder.append( one ); value = two; } } firstArc = false; } builder.append( '.' ).append( value ); } valStart = i; valLength = 0; value = 0; } } return new Oid( builder.toString(), oidBytes ); } private Oid( String oidString, byte[] oidBytes ); @Override boolean equals( Object other ); static Oid fromBytes( byte[] oidBytes ); static Oid fromString( String oidString ); int getEncodedLength(); @Override int hashCode(); static boolean isOid( String oidString ); byte[] toBytes(); @Override String toString(); void writeBytesTo( ByteBuffer buffer ); void writeBytesTo( OutputStream outputStream ); }
@Test public void testEqualsObjectIdentifiers() { String c1 = "( 1.1 FQCN org.apache.directory.SimpleComparator BYTECODE ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )"; String c2 = "( 1.1 fqcn org.apache.directory.SimpleComparator bytecode ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )"; assertEquals( 0, comparator.compare( c1, c2 ) ); String c3 = "( 1.1 FQCN org.apache.directory.SimpleComparator BYTECODE ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== X-SCHEMA 'system' )"; String c4 = "( 1.1 fqcn org.apache.directory.SimpleComparator bytecode ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )"; assertEquals( 0, comparator.compare( c3, c4 ) ); }
public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); int compare( String s1, String s2 ); }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); int compare( String s1, String s2 ); }
@Test public void testDifferentObjectIdentifiers() { String c1 = "( 1.1 FQCN org.apache.directory.SimpleComparator BYTECODE ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )"; String c2 = "( 1.2 fqcn org.apache.directory.SimpleComparator bytecode ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )"; assertEquals( -1, comparator.compare( c1, c2 ) ); String c3 = "( 1.1 FQCN org.apache.directory.SimpleComparator BYTECODE ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== X-SCHEMA 'system' )"; String c4 = "( 1.1.1 fqcn org.apache.directory.SimpleComparator bytecode ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )"; assertNotSame( 0, comparator.compare( c3, c4 ) ); }
public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); int compare( String s1, String s2 ); }
ObjectIdentifierFirstComponentComparator extends LdapComparator<String> { public int compare( String s1, String s2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13748_COMPARING_OBJECT_IDENTIFIER_FIRST_COMPONENT, s1, s2 ) ); } if ( s1 == null ) { return ( s2 == null ) ? 0 : -1; } if ( s2 == null ) { return -1; } if ( s1.equals( s2 ) ) { return 0; } String oid1 = getNumericOid( s1 ); if ( oid1 == null ) { return -1; } String oid2 = getNumericOid( s2 ); if ( oid2 == null ) { return -1; } if ( oid1.equals( oid2 ) ) { return 0; } else { return -1; } } ObjectIdentifierFirstComponentComparator( String oid ); int compare( String s1, String s2 ); }
@Test public void testNullWordss() { assertEquals( 0, comparator.compare( null, null ) ); assertEquals( -1, comparator.compare( null, " abc " ) ); assertEquals( 1, comparator.compare( " abc def ghi ", null ) ); }
public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); int compare( String value, String assertion ); }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); int compare( String value, String assertion ); }
@Test public void testEqualsWords() { assertEquals( 0, comparator.compare( "abc", "abc" ) ); assertEquals( 0, comparator.compare( "abc", " abc " ) ); assertEquals( 0, comparator.compare( "abc def ghi", "def" ) ); assertEquals( 0, comparator.compare( "abc def ghi", " def " ) ); assertEquals( 0, comparator.compare( "abc def ghi", "abc" ) ); assertEquals( 0, comparator.compare( "abc def ghi", "ghi" ) ); }
public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); int compare( String value, String assertion ); }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); int compare( String value, String assertion ); }
@Test public void testNotEqualsWords() { assertEquals( -1, comparator.compare( "abc", "" ) ); assertEquals( -1, comparator.compare( "abc", "ab" ) ); assertEquals( -1, comparator.compare( "abc", " ab " ) ); assertEquals( -1, comparator.compare( "abc def ghi", "dkf" ) ); assertEquals( -1, comparator.compare( "abc def ghi", " dkf " ) ); assertEquals( -1, comparator.compare( "abc def ghi", "hi" ) ); assertEquals( -1, comparator.compare( "abc def ghi", "e" ) ); }
public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); int compare( String value, String assertion ); }
WordComparator extends LdapComparator<String> { public int compare( String value, String assertion ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13749_COMPARING_STRING, value, assertion ) ); } if ( value == assertion ) { return 0; } if ( ( value == null ) || ( assertion == null ) ) { return ( assertion == null ) ? 1 : -1; } String trimmedAssertion = Strings.trim( assertion ); int pos = value.indexOf( trimmedAssertion ); if ( pos != -1 ) { int assertionLength = trimmedAssertion.length(); if ( assertionLength == value.length() ) { return 0; } if ( pos == 0 ) { char after = value.charAt( assertionLength ); if ( !Character.isLetterOrDigit( after ) ) { return 0; } else { return -1; } } if ( pos + assertionLength == value.length() ) { char before = value.charAt( value.length() - assertionLength - 1 ); if ( !Character.isLetterOrDigit( before ) ) { return 0; } else { return -1; } } char before = value.charAt( value.length() - assertionLength ); char after = value.charAt( assertionLength ); if ( Character.isLetterOrDigit( after ) ) { return -1; } if ( !Character.isLetterOrDigit( before ) ) { return -1; } return 0; } return -1; } WordComparator( String oid ); int compare( String value, String assertion ); }
@Test public void testNullBooleans() { assertEquals( 0, comparator.compare( null, null ) ); assertEquals( -1, comparator.compare( null, "TRUE" ) ); assertEquals( -1, comparator.compare( null, "FALSE" ) ); assertEquals( 1, comparator.compare( "TRUE", null ) ); assertEquals( 1, comparator.compare( "FALSE", null ) ); }
public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; }
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; } }
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; } BooleanComparator( String oid ); }
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; } BooleanComparator( String oid ); int compare( String b1, String b2 ); }
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; } BooleanComparator( String oid ); int compare( String b1, String b2 ); }
@Test public void testBooleans() { assertEquals( 0, comparator.compare( "TRUE", "TRUE" ) ); assertEquals( 0, comparator.compare( "FALSE", "FALSE" ) ); assertEquals( -1, comparator.compare( "FALSE", "TRUE" ) ); assertEquals( 1, comparator.compare( "TRUE", "FALSE" ) ); String b1 = "TRUE"; String b2 = "true"; assertEquals( 0, comparator.compare( b1, Strings.upperCase( b2 ) ) ); }
public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; }
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; } }
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; } BooleanComparator( String oid ); }
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; } BooleanComparator( String oid ); int compare( String b1, String b2 ); }
BooleanComparator extends LdapComparator<String> { public int compare( String b1, String b2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13752_COMPARING_BOOLEAN, b1, b2 ) ); } if ( b1 == b2 ) { return 0; } if ( ( b1 == null ) || ( b2 == null ) ) { return b1 == null ? -1 : 1; } boolean boolean1 = Boolean.parseBoolean( b1 ); boolean boolean2 = Boolean.parseBoolean( b2 ); if ( boolean1 == boolean2 ) { return 0; } return boolean1 ? 1 : -1; } BooleanComparator( String oid ); int compare( String b1, String b2 ); }
@Test public void testNullTelephoneNumbers() { String tel1 = null; String tel2 = null; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel2 = "abc"; assertEquals( -1, comparator.compare( tel1, tel2 ) ); String tel3 = null; assertEquals( 1, comparator.compare( tel2, tel3 ) ); }
public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
@Test public void testEmptyTelephoneNumbers() { String tel1 = ""; String tel2 = ""; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel2 = "abc"; assertTrue( comparator.compare( tel1, tel2 ) < 0 ); String tel3 = ""; assertTrue( comparator.compare( tel2, tel3 ) > 0 ); }
public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
@Test public void testSimpleTelephoneNumbers() { String tel1 = "01 02 03 04 05"; String tel2 = "01 02 03 04 05"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel2 = "0102030405"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); }
public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
@Test public void testEquals() throws ParseException { String gt1 = "20080102121314Z"; GeneralizedTime generalizedTime1 = new GeneralizedTime( gt1 ); String gt2 = "20080102121314Z"; GeneralizedTime generalizedTime2 = new GeneralizedTime( gt2 ); String gt3 = "20080102121314,001Z"; GeneralizedTime generalizedTime3 = new GeneralizedTime( gt3 ); assertTrue( generalizedTime1.equals( generalizedTime2 ) ); assertFalse( generalizedTime1.equals( generalizedTime3 ) ); assertFalse( generalizedTime1.equals( null ) ); }
@Override public boolean equals( Object obj ) { if ( obj instanceof GeneralizedTime ) { GeneralizedTime other = ( GeneralizedTime ) obj; return calendar.equals( other.calendar ); } else { return false; } }
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public boolean equals( Object obj ) { if ( obj instanceof GeneralizedTime ) { GeneralizedTime other = ( GeneralizedTime ) obj; return calendar.equals( other.calendar ); } else { return false; } } }
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public boolean equals( Object obj ) { if ( obj instanceof GeneralizedTime ) { GeneralizedTime other = ( GeneralizedTime ) obj; return calendar.equals( other.calendar ); } else { return false; } } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); }
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public boolean equals( Object obj ) { if ( obj instanceof GeneralizedTime ) { GeneralizedTime other = ( GeneralizedTime ) obj; return calendar.equals( other.calendar ); } else { return false; } } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneralizedTimeWithoutFraction(); String toGeneralizedTime( Format format, FractionDelimiter fractionDelimiter, int fractionLength, TimeZoneFormat timeZoneFormat ); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override int compareTo( GeneralizedTime other ); long getTime(); Date getDate(); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinutes(); int getSeconds(); int getFraction(); static Date getDate( String zuluTime ); }
GeneralizedTime implements Comparable<GeneralizedTime> { @Override public boolean equals( Object obj ) { if ( obj instanceof GeneralizedTime ) { GeneralizedTime other = ( GeneralizedTime ) obj; return calendar.equals( other.calendar ); } else { return false; } } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneralizedTimeWithoutFraction(); String toGeneralizedTime( Format format, FractionDelimiter fractionDelimiter, int fractionLength, TimeZoneFormat timeZoneFormat ); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override int compareTo( GeneralizedTime other ); long getTime(); Date getDate(); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinutes(); int getSeconds(); int getFraction(); static Date getDate( String zuluTime ); }
@Test public void testComplexTelephoneNumbers() { String tel1 = " + 33 1 01-02-03-04-05 "; String tel2 = "+3310102030405"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); tel1 = "1-801-555-1212"; tel2 = "18015551212"; assertEquals( 0, comparator.compare( tel1, tel2 ) ); assertEquals( 0, comparator.compare( "1 801 555 1212", tel1 ) ); assertEquals( 0, comparator.compare( "1 801 555 1212", tel2 ) ); }
public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
TelephoneNumberComparator extends LdapComparator<String> { public int compare( String telephoneNumber1, String telephoneNumber2 ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13750_COMPARING_TELEPHONE_NUMBER, telephoneNumber1, telephoneNumber2 ) ); } if ( telephoneNumber1 == null ) { return ( telephoneNumber2 == null ) ? 0 : -1; } if ( telephoneNumber2 == null ) { return 1; } String strippedTelephoneNumber1 = strip( telephoneNumber1 ); String strippedTelephoneNumber2 = strip( telephoneNumber2 ); return strippedTelephoneNumber1.compareToIgnoreCase( strippedTelephoneNumber2 ); } TelephoneNumberComparator( String oid ); int compare( String telephoneNumber1, String telephoneNumber2 ); }
@Test public void testToString() throws Exception { String string = nameForm.toString(); assertNotNull( string ); assertTrue( string.startsWith( "nameform (" ) ); assertTrue( string.contains( " NAME " ) ); assertTrue( string.contains( "\n\tDESC " ) ); assertTrue( string.contains( "\n\tOC" ) ); assertTrue( string.contains( "\n\tMUST" ) ); assertTrue( string.contains( "\n\tMAY" ) ); }
@Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); }
NameForm extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } }
NameForm extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } NameForm( String oid ); }
NameForm extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } NameForm( String oid ); String getStructuralObjectClassOid(); ObjectClass getStructuralObjectClass(); void setStructuralObjectClassOid( String structuralObjectClassOid ); void setStructuralObjectClass( ObjectClass structuralObjectClass ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); void addMustAttributeTypeOids( String oid ); void addMustAttributeTypes( AttributeType attributeType ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); void addMayAttributeTypeOids( String oid ); void addMayAttributeTypes( AttributeType attributeType ); @Override String toString(); @Override NameForm copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
NameForm extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } NameForm( String oid ); String getStructuralObjectClassOid(); ObjectClass getStructuralObjectClass(); void setStructuralObjectClassOid( String structuralObjectClassOid ); void setStructuralObjectClass( ObjectClass structuralObjectClass ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); void addMustAttributeTypeOids( String oid ); void addMustAttributeTypes( AttributeType attributeType ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); void addMayAttributeTypeOids( String oid ); void addMayAttributeTypes( AttributeType attributeType ); @Override String toString(); @Override NameForm copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testToString() throws Exception { String string = matchingRule.toString(); assertNotNull( string ); assertTrue( string.startsWith( "matchingrule (" ) ); assertTrue( string.contains( " NAME " ) ); assertTrue( string.contains( "\n\tDESC " ) ); assertTrue( string.contains( "\n\tSYNTAX " ) ); }
@Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); }
MatchingRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } }
MatchingRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } MatchingRule( String oid ); }
MatchingRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } MatchingRule( String oid ); LdapSyntax getSyntax(); void setSyntax( LdapSyntax ldapSyntax ); String getSyntaxOid(); void setSyntaxOid( String oid ); LdapComparator<? super Object> getLdapComparator(); @SuppressWarnings("unchecked") void setLdapComparator( LdapComparator<?> ldapComparator ); Normalizer getNormalizer(); void setNormalizer( Normalizer normalizer ); @Override String toString(); @Override MatchingRule copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
MatchingRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } MatchingRule( String oid ); LdapSyntax getSyntax(); void setSyntax( LdapSyntax ldapSyntax ); String getSyntaxOid(); void setSyntaxOid( String oid ); LdapComparator<? super Object> getLdapComparator(); @SuppressWarnings("unchecked") void setLdapComparator( LdapComparator<?> ldapComparator ); Normalizer getNormalizer(); void setNormalizer( Normalizer normalizer ); @Override String toString(); @Override MatchingRule copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testToString() throws Exception { String string = ldapSyntax.toString(); assertNotNull( string ); assertTrue( string.startsWith( "ldapsyntax (" ) ); assertTrue( string.contains( "\n\tDESC " ) ); assertTrue( string.contains( "\n\tX-NOT-HUMAN-READABLE " ) ); }
@Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); }
LdapSyntax extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } }
LdapSyntax extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } LdapSyntax( String oid ); LdapSyntax( String oid, String description ); LdapSyntax( String oid, String description, boolean isHumanReadable ); }
LdapSyntax extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } LdapSyntax( String oid ); LdapSyntax( String oid, String description ); LdapSyntax( String oid, String description, boolean isHumanReadable ); boolean isHumanReadable(); void setHumanReadable( boolean humanReadable ); SyntaxChecker getSyntaxChecker(); void setSyntaxChecker( SyntaxChecker syntaxChecker ); void updateSyntaxChecker( SyntaxChecker newSyntaxChecker ); @Override String toString(); @Override LdapSyntax copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
LdapSyntax extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } LdapSyntax( String oid ); LdapSyntax( String oid, String description ); LdapSyntax( String oid, String description, boolean isHumanReadable ); boolean isHumanReadable(); void setHumanReadable( boolean humanReadable ); SyntaxChecker getSyntaxChecker(); void setSyntaxChecker( SyntaxChecker syntaxChecker ); void updateSyntaxChecker( SyntaxChecker newSyntaxChecker ); @Override String toString(); @Override LdapSyntax copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testOpenLdapSchemaRendererObjectClassMinimal() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( new ObjectClass( "1.2.3" ) ); String expected = "objectclass ( 1.2.3\n\tSTRUCTURAL )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testOpenLdapSchemaRendererObjectClassSimple() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( objectClassSimple ); String expected = "objectclass ( 1.2.3.4 NAME 'name0'\n\tSTRUCTURAL\n\tMUST att0 )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testOpenLdapSchemaRendererObjectClassComplex() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( objectClassComplex ); String expected = "objectclass ( 1.2.3.4 NAME ( 'name1' 'name2' )\n\tDESC 'description with \\27quotes\\27'\n\tOBSOLETE\n\tSUP 1.3.5.7\n\tAUXILIARY\n\tMUST ( att1 $ att2 )\n\tMAY ( att3 $ att4 ) )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererObjectClassMinimal() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( new ObjectClass( "1.2.3" ) ); String expected = "( 1.2.3 STRUCTURAL X-SCHEMA 'null' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererObjectClassSimple() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( objectClassSimple ); String expected = "( 1.2.3.4 NAME 'name0' STRUCTURAL MUST att0 X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererObjectClassComplex() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( objectClassComplex ); String expected = "( 1.2.3.4 NAME ( 'name1' 'name2' ) DESC 'description with \\27quotes\\27' OBSOLETE SUP 1.3.5.7 AUXILIARY MUST ( att1 $ att2 ) MAY ( att3 $ att4 ) X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void fractionCloseToOne() throws ParseException { GeneralizedTime close = new GeneralizedTime( "20000101000000.9994Z" ); assertThat( close.getDate(), is( equalTo( format.parse( "01/01/2000 00:00:00.999 GMT" ) ) ) ); GeneralizedTime closer = new GeneralizedTime( "20000101000000.9995Z" ); assertThat( closer.getDate(), is( equalTo( format.parse( "01/01/2000 00:00:00.999 GMT" ) ) ) ); GeneralizedTime larger = new GeneralizedTime( "20000101000000.9Z" ); assertThat( larger.getDate(), is( equalTo( format.parse( "01/01/2000 00:00:00.900 GMT" ) ) ) ); }
public Date getDate() { return calendar.getTime(); }
GeneralizedTime implements Comparable<GeneralizedTime> { public Date getDate() { return calendar.getTime(); } }
GeneralizedTime implements Comparable<GeneralizedTime> { public Date getDate() { return calendar.getTime(); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); }
GeneralizedTime implements Comparable<GeneralizedTime> { public Date getDate() { return calendar.getTime(); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneralizedTimeWithoutFraction(); String toGeneralizedTime( Format format, FractionDelimiter fractionDelimiter, int fractionLength, TimeZoneFormat timeZoneFormat ); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override int compareTo( GeneralizedTime other ); long getTime(); Date getDate(); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinutes(); int getSeconds(); int getFraction(); static Date getDate( String zuluTime ); }
GeneralizedTime implements Comparable<GeneralizedTime> { public Date getDate() { return calendar.getTime(); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( String generalizedTime ); String toGeneralizedTime(); String toGeneralizedTimeWithoutFraction(); String toGeneralizedTime( Format format, FractionDelimiter fractionDelimiter, int fractionLength, TimeZoneFormat timeZoneFormat ); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override int compareTo( GeneralizedTime other ); long getTime(); Date getDate(); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinutes(); int getSeconds(); int getFraction(); static Date getDate( String zuluTime ); }
@Test public void testOpenLdapSchemaRendererAttributeTypeSimple() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( attributeTypeSimple ); String expected = "attributetype ( 1.2.3.4 NAME 'name0'\n\tEQUALITY matchingRule0\n\tSYNTAX 2.3.4.5{512}\n\tCOLLECTIVE\n\tUSAGE userApplications )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testOpenLdapSchemaRendererAttributeTypeComplex() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( attributeTypeComplex ); String expected = "attributetype ( 1.2.3.4 NAME ( 'name1' 'name2' )\n\tDESC 'description with \\27quotes\\27'\n\tOBSOLETE\n\tSUP superAttr\n\tEQUALITY matchingRule1\n\tORDERING matchingRule2\n\tSUBSTR matchingRule3\n\tSINGLE-VALUE\n\tNO-USER-MODIFICATION\n\tUSAGE directoryOperation )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererAttributeTypeSimple() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( attributeTypeSimple ); String expected = "( 1.2.3.4 NAME 'name0' EQUALITY matchingRule0 SYNTAX 2.3.4.5{512} COLLECTIVE USAGE userApplications X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererAttributeTypeComplex() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( attributeTypeComplex ); String expected = "( 1.2.3.4 NAME ( 'name1' 'name2' ) DESC 'description with \\27quotes\\27' OBSOLETE SUP superAttr EQUALITY matchingRule1 ORDERING matchingRule2 SUBSTR matchingRule3 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testOpenLdapSchemaRendererMatchingRule() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( matchingRule ); String expected = "matchingrule ( 1.2.3.4 NAME 'name0'\n\tDESC 'description with \\27quotes\\27'\n\tOBSOLETE\n\tSYNTAX 2.3.4.5 )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererMatchingRule() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( matchingRule ); String expected = "( 1.2.3.4 NAME 'name0' DESC 'description with \\27quotes\\27' OBSOLETE SYNTAX 2.3.4.5 X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testOpenLdapSchemaRendererLdapSyntax() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( ldapSyntax ); String expected = "ldapsyntax ( 1.2.3.4\n\tDESC 'description with \\27quotes\\27'\n\tX-NOT-HUMAN-READABLE 'true' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererLdapSyntax() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( ldapSyntax ); String expected = "( 1.2.3.4 DESC 'description with \\27quotes\\27' X-SCHEMA 'dummy' X-NOT-HUMAN-READABLE 'true' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testOpenLdapSchemaRendererMatchingRuleUse() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( matchingRuleUse ); String expected = "matchingruleuse ( 1.2.3.4 NAME 'name0'\n\tDESC 'description with \\27quotes\\27'\n\tOBSOLETE\n\tAPPLIES ( 2.3.4.5 $ 1.3.4.5.6 ) )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererMatchingRuleUse() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( matchingRuleUse ); String expected = "( 1.2.3.4 NAME 'name0' DESC 'description with \\27quotes\\27' OBSOLETE APPLIES ( 2.3.4.5 $ 1.3.4.5.6 ) X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSameBehaviourOfStandardGetMethod() { Method m1 = null; Method m2 = null; try { m1 = TestClass.class.getMethod( "methodA", new Class[] { String.class } ); } catch ( SecurityException e ) { e.printStackTrace(); } catch ( NoSuchMethodException e ) { e.printStackTrace(); } try { m2 = MethodUtils.getAssignmentCompatibleMethod( TestClass.class, "methodA", new Class[] { String.class } ); } catch ( NoSuchMethodException e ) { e.printStackTrace(); } assertEquals( m1, m2 ); }
public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); }
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); } }
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); } private MethodUtils(); }
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); } private MethodUtils(); static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ); }
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); } private MethodUtils(); static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ); }
@Test public void testOpenLdapSchemaRendererDitContentRule() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( ditContentRule ); String expected = "ditcontentrule ( 1.2.3.4 NAME ( 'name1' 'name2' )\n\tDESC 'description with \\27quotes\\27'\n\tOBSOLETE\n\tAUX ( oc1 $ oc2 )\n\tMUST ( must1 $ must2 )\n\tMAY ( may1 $ may2 )\n\tNOT ( not1 $ not2 ) )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererDitContentRule() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( ditContentRule ); String expected = "( 1.2.3.4 NAME ( 'name1' 'name2' ) DESC 'description with \\27quotes\\27' OBSOLETE AUX ( oc1 $ oc2 ) MUST ( must1 $ must2 ) MAY ( may1 $ may2 ) NOT ( not1 $ not2 ) X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testOpenLdapSchemaRendererDitStructureRule() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( ditStructureRule ); String expected = "ditstructurerule ( 1234 NAME ( 'name1' 'name2' )\n\tDESC 'description with \\27quotes\\27'\n\tOBSOLETE\n\tFORM form1\n\tSUP ( 111 222 333 ) )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererDitStructureRule() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( ditStructureRule ); String expected = "( 1234 NAME ( 'name1' 'name2' ) DESC 'description with \\27quotes\\27' OBSOLETE FORM form1 SUP ( 111 222 333 ) X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); ditStructureRule.setSuperRules( null ); String actual2 = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( ditStructureRule ); String expected2 = "( 1234 NAME ( 'name1' 'name2' ) DESC 'description with \\27quotes\\27' OBSOLETE FORM form1 X-SCHEMA 'dummy' )"; assertEquals( expected2, actual2 ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testOpenLdapSchemaRendererNameForm() { String actual = SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( nameForm ); String expected = "nameform ( 1.2.3.4 NAME ( 'name1' 'name2' )\n\tDESC 'description with \\27quotes\\27'\n\tOBSOLETE\n\tOC oc1\n\tMUST ( must1 $ must2 )\n\tMAY may0 )"; assertEquals( expected, actual ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testSubschemSubentryRendererNameForm() { String actual = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( nameForm ); String expected = "( 1.2.3.4 NAME ( 'name1' 'name2' ) DESC 'description with \\27quotes\\27' OBSOLETE OC oc1 MUST ( must1 $ must2 ) MAY may0 X-SCHEMA 'dummy' )"; assertEquals( expected, actual ); nameForm.setMayAttributeTypeOids( new ArrayList<String>() ); String actual2 = SchemaObjectRenderer.SUBSCHEMA_SUBENTRY_RENDERER.render( nameForm ); String expected2 = "( 1.2.3.4 NAME ( 'name1' 'name2' ) DESC 'description with \\27quotes\\27' OBSOLETE OC oc1 MUST ( must1 $ must2 ) X-SCHEMA 'dummy' )"; assertEquals( expected2, actual2 ); }
public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); }
SchemaObjectRenderer { public String render( ObjectClass oc ) { StringBuilder buf = renderStartOidNamesDescObsolete( oc, "objectclass" ); renderOids( buf, "SUP", oc.getSuperiorOids() ); if ( oc.getType() != null ) { prettyPrintIndent( buf ); buf.append( oc.getType() ); prettyPrintNewLine( buf ); } renderOids( buf, "MUST", oc.getMustAttributeTypeOids() ); renderOids( buf, "MAY", oc.getMayAttributeTypeOids() ); renderXSchemaName( oc, buf ); renderClose( buf ); return buf.toString(); } private SchemaObjectRenderer( Style style ); String render( ObjectClass oc ); String render( AttributeType at ); String render( MatchingRule mr ); String render( LdapSyntax syntax ); String render( MatchingRuleUse mru ); String render( DitContentRule dcr ); String render( DitStructureRule dsr ); String render( NameForm nf ); static final SchemaObjectRenderer SUBSCHEMA_SUBENTRY_RENDERER; static final SchemaObjectRenderer OPEN_LDAP_SCHEMA_RENDERER; }
@Test public void testRenderQdescrs() { assertEquals( "", SchemaUtils.renderQDescrs( new StringBuilder(), ( List<String> ) null ).toString() ); assertEquals( "", SchemaUtils.renderQDescrs( new StringBuilder(), Arrays.asList( new String[] {} ) ).toString() ); assertEquals( "'name1'", SchemaUtils.renderQDescrs( new StringBuilder(), Arrays.asList( new String[] { "name1" } ) ).toString() ); assertEquals( "( 'name1' 'name2' )", SchemaUtils.renderQDescrs( new StringBuilder(), Arrays.asList( new String[] { "name1", "name2" } ) ).toString() ); assertEquals( "( 'name1' 'name2' 'name3' )", SchemaUtils.renderQDescrs( new StringBuilder(), Arrays.asList( new String[] { "name1", "name2", "name3" } ) ).toString() ); assertEquals( "", SchemaUtils.renderQDescrs( new StringBuilder(), ( List<String> ) null ).toString() ); assertEquals( "", SchemaUtils.renderQDescrs( new StringBuilder(), Arrays.asList( new String[] {} ) ).toString() ); assertEquals( "'name1'", SchemaUtils.renderQDescrs( new StringBuilder(), Arrays.asList( new String[] { "name1" } ) ).toString() ); assertEquals( "( 'name1' 'name2' )", SchemaUtils.renderQDescrs( new StringBuilder(), Arrays.asList( new String[] { "name1", "name2" } ) ).toString() ); assertEquals( "( 'name1' 'name2' 'name3' )", SchemaUtils.renderQDescrs( new StringBuilder(), Arrays.asList( new String[] { "name1", "name2", "name3" } ) ).toString() ); }
static StringBuilder renderQDescrs( StringBuilder buf, List<String> qdescrs ) { if ( ( qdescrs == null ) || qdescrs.isEmpty() ) { return buf; } if ( qdescrs.size() == 1 ) { buf.append( '\'' ).append( qdescrs.get( 0 ) ).append( '\'' ); } else { buf.append( "( " ); for ( String qdescr : qdescrs ) { buf.append( '\'' ).append( qdescr ).append( "' " ); } buf.append( ")" ); } return buf; }
SchemaUtils { static StringBuilder renderQDescrs( StringBuilder buf, List<String> qdescrs ) { if ( ( qdescrs == null ) || qdescrs.isEmpty() ) { return buf; } if ( qdescrs.size() == 1 ) { buf.append( '\'' ).append( qdescrs.get( 0 ) ).append( '\'' ); } else { buf.append( "( " ); for ( String qdescr : qdescrs ) { buf.append( '\'' ).append( qdescr ).append( "' " ); } buf.append( ")" ); } return buf; } }
SchemaUtils { static StringBuilder renderQDescrs( StringBuilder buf, List<String> qdescrs ) { if ( ( qdescrs == null ) || qdescrs.isEmpty() ) { return buf; } if ( qdescrs.size() == 1 ) { buf.append( '\'' ).append( qdescrs.get( 0 ) ).append( '\'' ); } else { buf.append( "( " ); for ( String qdescr : qdescrs ) { buf.append( '\'' ).append( qdescr ).append( "' " ); } buf.append( ")" ); } return buf; } private SchemaUtils(); }
SchemaUtils { static StringBuilder renderQDescrs( StringBuilder buf, List<String> qdescrs ) { if ( ( qdescrs == null ) || qdescrs.isEmpty() ) { return buf; } if ( qdescrs.size() == 1 ) { buf.append( '\'' ).append( qdescrs.get( 0 ) ).append( '\'' ); } else { buf.append( "( " ); for ( String qdescr : qdescrs ) { buf.append( '\'' ).append( qdescr ).append( "' " ); } buf.append( ")" ); } return buf; } private SchemaUtils(); static Entry getTargetEntry( List<? extends Modification> mods, Entry entry ); static StringBuilder render( StringBuilder buf, List<String> qdescrs ); static StringBuilder render( ObjectClass[] ocs ); static StringBuilder render( StringBuilder buf, ObjectClass[] ocs ); static StringBuilder render( AttributeType[] ats ); static StringBuilder render( StringBuilder buf, AttributeType[] ats ); static StringBuilder render( Map<String, List<String>> extensions ); static String render( LoadableSchemaObject description ); static String stripOptions( String attributeId ); static Set<String> getOptions( String attributeId ); static byte[] uuidToBytes( UUID uuid ); static boolean isAttributeNameValid( String attributeName ); }
SchemaUtils { static StringBuilder renderQDescrs( StringBuilder buf, List<String> qdescrs ) { if ( ( qdescrs == null ) || qdescrs.isEmpty() ) { return buf; } if ( qdescrs.size() == 1 ) { buf.append( '\'' ).append( qdescrs.get( 0 ) ).append( '\'' ); } else { buf.append( "( " ); for ( String qdescr : qdescrs ) { buf.append( '\'' ).append( qdescr ).append( "' " ); } buf.append( ")" ); } return buf; } private SchemaUtils(); static Entry getTargetEntry( List<? extends Modification> mods, Entry entry ); static StringBuilder render( StringBuilder buf, List<String> qdescrs ); static StringBuilder render( ObjectClass[] ocs ); static StringBuilder render( StringBuilder buf, ObjectClass[] ocs ); static StringBuilder render( AttributeType[] ats ); static StringBuilder render( StringBuilder buf, AttributeType[] ats ); static StringBuilder render( Map<String, List<String>> extensions ); static String render( LoadableSchemaObject description ); static String stripOptions( String attributeId ); static Set<String> getOptions( String attributeId ); static byte[] uuidToBytes( UUID uuid ); static boolean isAttributeNameValid( String attributeName ); }
@Test public void testIsAttributeNameValid() { assertFalse( SchemaUtils.isAttributeNameValid( null ) ); assertFalse( SchemaUtils.isAttributeNameValid( "" ) ); assertFalse( SchemaUtils.isAttributeNameValid( " " ) ); assertTrue( SchemaUtils.isAttributeNameValid( "a" ) ); assertTrue( SchemaUtils.isAttributeNameValid( "ObjectClass-text_test123" ) ); assertFalse( SchemaUtils.isAttributeNameValid( "-text_test123" ) ); assertFalse( SchemaUtils.isAttributeNameValid( "text_te&st123" ) ); assertFalse( SchemaUtils.isAttributeNameValid( "text_te st123" ) ); assertTrue( SchemaUtils.isAttributeNameValid( "0" ) ); assertTrue( SchemaUtils.isAttributeNameValid( "0" ) ); assertFalse( SchemaUtils.isAttributeNameValid( "00.1.2.3" ) ); assertFalse( SchemaUtils.isAttributeNameValid( "0.1.2..3" ) ); assertFalse( SchemaUtils.isAttributeNameValid( "0.01.2.3" ) ); }
public static boolean isAttributeNameValid( String attributeName ) { if ( Strings.isEmpty( attributeName ) ) { return false; } boolean descr; boolean zero = false; boolean dot = false; char c = attributeName.charAt( 0 ); if ( ( ( c >= 'a' ) && ( c <= 'z' ) ) || ( ( c >= 'A' ) && ( c <= 'Z' ) ) ) { descr = true; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { descr = false; zero = c == '0'; } else { return false; } for ( int i = 1; i < attributeName.length(); i++ ) { c = attributeName.charAt( i ); if ( descr ) { if ( ( ( c < 'a' ) || ( c > 'z' ) ) && ( ( c < 'A' ) || ( c > 'Z' ) ) && ( ( c < '0' ) || ( c > '9' ) ) && ( c != '-' ) && ( c != '_' ) ) { return false; } } else { if ( c == '.' ) { if ( dot ) { return false; } dot = true; zero = false; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { dot = false; if ( zero ) { return false; } else if ( c == '0' ) { zero = true; } } else { return false; } } } return true; }
SchemaUtils { public static boolean isAttributeNameValid( String attributeName ) { if ( Strings.isEmpty( attributeName ) ) { return false; } boolean descr; boolean zero = false; boolean dot = false; char c = attributeName.charAt( 0 ); if ( ( ( c >= 'a' ) && ( c <= 'z' ) ) || ( ( c >= 'A' ) && ( c <= 'Z' ) ) ) { descr = true; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { descr = false; zero = c == '0'; } else { return false; } for ( int i = 1; i < attributeName.length(); i++ ) { c = attributeName.charAt( i ); if ( descr ) { if ( ( ( c < 'a' ) || ( c > 'z' ) ) && ( ( c < 'A' ) || ( c > 'Z' ) ) && ( ( c < '0' ) || ( c > '9' ) ) && ( c != '-' ) && ( c != '_' ) ) { return false; } } else { if ( c == '.' ) { if ( dot ) { return false; } dot = true; zero = false; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { dot = false; if ( zero ) { return false; } else if ( c == '0' ) { zero = true; } } else { return false; } } } return true; } }
SchemaUtils { public static boolean isAttributeNameValid( String attributeName ) { if ( Strings.isEmpty( attributeName ) ) { return false; } boolean descr; boolean zero = false; boolean dot = false; char c = attributeName.charAt( 0 ); if ( ( ( c >= 'a' ) && ( c <= 'z' ) ) || ( ( c >= 'A' ) && ( c <= 'Z' ) ) ) { descr = true; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { descr = false; zero = c == '0'; } else { return false; } for ( int i = 1; i < attributeName.length(); i++ ) { c = attributeName.charAt( i ); if ( descr ) { if ( ( ( c < 'a' ) || ( c > 'z' ) ) && ( ( c < 'A' ) || ( c > 'Z' ) ) && ( ( c < '0' ) || ( c > '9' ) ) && ( c != '-' ) && ( c != '_' ) ) { return false; } } else { if ( c == '.' ) { if ( dot ) { return false; } dot = true; zero = false; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { dot = false; if ( zero ) { return false; } else if ( c == '0' ) { zero = true; } } else { return false; } } } return true; } private SchemaUtils(); }
SchemaUtils { public static boolean isAttributeNameValid( String attributeName ) { if ( Strings.isEmpty( attributeName ) ) { return false; } boolean descr; boolean zero = false; boolean dot = false; char c = attributeName.charAt( 0 ); if ( ( ( c >= 'a' ) && ( c <= 'z' ) ) || ( ( c >= 'A' ) && ( c <= 'Z' ) ) ) { descr = true; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { descr = false; zero = c == '0'; } else { return false; } for ( int i = 1; i < attributeName.length(); i++ ) { c = attributeName.charAt( i ); if ( descr ) { if ( ( ( c < 'a' ) || ( c > 'z' ) ) && ( ( c < 'A' ) || ( c > 'Z' ) ) && ( ( c < '0' ) || ( c > '9' ) ) && ( c != '-' ) && ( c != '_' ) ) { return false; } } else { if ( c == '.' ) { if ( dot ) { return false; } dot = true; zero = false; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { dot = false; if ( zero ) { return false; } else if ( c == '0' ) { zero = true; } } else { return false; } } } return true; } private SchemaUtils(); static Entry getTargetEntry( List<? extends Modification> mods, Entry entry ); static StringBuilder render( StringBuilder buf, List<String> qdescrs ); static StringBuilder render( ObjectClass[] ocs ); static StringBuilder render( StringBuilder buf, ObjectClass[] ocs ); static StringBuilder render( AttributeType[] ats ); static StringBuilder render( StringBuilder buf, AttributeType[] ats ); static StringBuilder render( Map<String, List<String>> extensions ); static String render( LoadableSchemaObject description ); static String stripOptions( String attributeId ); static Set<String> getOptions( String attributeId ); static byte[] uuidToBytes( UUID uuid ); static boolean isAttributeNameValid( String attributeName ); }
SchemaUtils { public static boolean isAttributeNameValid( String attributeName ) { if ( Strings.isEmpty( attributeName ) ) { return false; } boolean descr; boolean zero = false; boolean dot = false; char c = attributeName.charAt( 0 ); if ( ( ( c >= 'a' ) && ( c <= 'z' ) ) || ( ( c >= 'A' ) && ( c <= 'Z' ) ) ) { descr = true; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { descr = false; zero = c == '0'; } else { return false; } for ( int i = 1; i < attributeName.length(); i++ ) { c = attributeName.charAt( i ); if ( descr ) { if ( ( ( c < 'a' ) || ( c > 'z' ) ) && ( ( c < 'A' ) || ( c > 'Z' ) ) && ( ( c < '0' ) || ( c > '9' ) ) && ( c != '-' ) && ( c != '_' ) ) { return false; } } else { if ( c == '.' ) { if ( dot ) { return false; } dot = true; zero = false; } else if ( ( c >= '0' ) && ( c <= '9' ) ) { dot = false; if ( zero ) { return false; } else if ( c == '0' ) { zero = true; } } else { return false; } } } return true; } private SchemaUtils(); static Entry getTargetEntry( List<? extends Modification> mods, Entry entry ); static StringBuilder render( StringBuilder buf, List<String> qdescrs ); static StringBuilder render( ObjectClass[] ocs ); static StringBuilder render( StringBuilder buf, ObjectClass[] ocs ); static StringBuilder render( AttributeType[] ats ); static StringBuilder render( StringBuilder buf, AttributeType[] ats ); static StringBuilder render( Map<String, List<String>> extensions ); static String render( LoadableSchemaObject description ); static String stripOptions( String attributeId ); static Set<String> getOptions( String attributeId ); static byte[] uuidToBytes( UUID uuid ); static boolean isAttributeNameValid( String attributeName ); }
@Test public void testSortAttributeTypesAlreadySorted() { List<AttributeType> attributeTypes = new ArrayList<AttributeType>(); addAttributeType( attributeTypes, "1.1.1", "att1", null ); addAttributeType( attributeTypes, "1.1.2", "att2", "att1" ); addAttributeType( attributeTypes, "1.1.3", "att3", "att2" ); addAttributeType( attributeTypes, "1.1.4", "att4", "att3" ); addAttributeType( attributeTypes, "1.1.5", "att5", "att1" ); addAttributeType( attributeTypes, "1.1.6", "att6", null ); addAttributeType( attributeTypes, "1.1.7", "att7", "other" ); Iterable<AttributeType> sorted = SchemaObjectSorter.hierarchicalOrdered( attributeTypes ); assertHierarchicalOrderAT( sorted ); }
public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
@Test public void testSortAttributeTypesShuffled() { List<String> oids = Arrays.asList( "1.1.1", "1.1.2", "1.1.3", "1.1.4", "1.1.5", "1.1.6", "1.1.7" ); for ( int i = 0; i < 1000; i++ ) { Collections.shuffle( oids ); Iterator<String> oidIterator = oids.iterator(); List<AttributeType> attributeTypes = new ArrayList<AttributeType>(); addAttributeType( attributeTypes, oidIterator.next(), "att1", null ); addAttributeType( attributeTypes, oidIterator.next(), "aTT2", "att1" ); addAttributeType( attributeTypes, oidIterator.next(), "att3", "att2" ); addAttributeType( attributeTypes, oidIterator.next(), "att4", "atT3" ); addAttributeType( attributeTypes, oidIterator.next(), "att5", "aTt1" ); addAttributeType( attributeTypes, oidIterator.next(), "att6", null ); addAttributeType( attributeTypes, oidIterator.next(), "att7", "other" ); Iterable<AttributeType> sorted = SchemaObjectSorter.hierarchicalOrdered( attributeTypes ); assertHierarchicalOrderAT( sorted ); } }
public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
@Test public void testNewBehaviourOfAssignmentCompatibleGetMethod() { Method m2 = null; try { TestClass.class.getMethod( "methodB", new Class[] { ArrayList.class } ); fail( "We should not have come here." ); } catch ( SecurityException e ) { e.printStackTrace(); } catch ( NoSuchMethodException e ) { assertNotNull( e ); } try { m2 = MethodUtils.getAssignmentCompatibleMethod( TestClass.class, "methodB", new Class[] { ArrayList.class } ); } catch ( NoSuchMethodException e ) { e.printStackTrace(); } assertNotNull( m2 ); }
public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); }
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); } }
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); } private MethodUtils(); }
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); } private MethodUtils(); static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ); }
MethodUtils { public static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ) throws NoSuchMethodException { if ( LOG.isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); buf.append( "call to getAssignmentCompatibleMethod(): \n\tclazz = " ); buf.append( clazz.getName() ); buf.append( "\n\tcandidateMethodName = " ); buf.append( candidateMethodName ); buf.append( "\n\tcandidateParameterTypes = " ); for ( Class<?> argClass : candidateParameterTypes ) { buf.append( "\n\t\t" ); buf.append( argClass.getName() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( buf.toString() ); } } try { Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes ); if ( exactMethod != null ) { return exactMethod; } } catch ( Exception e ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17009_NO_EXACT_MATCH, candidateMethodName, e ) ); } } Method[] methods = clazz.getMethods(); for ( int mx = 0; mx < methods.length; mx++ ) { if ( !candidateMethodName.equals( methods[mx].getName() ) ) { continue; } Class<?>[] parameterTypes = methods[mx].getParameterTypes(); if ( parameterTypes.length != candidateParameterTypes.length ) { continue; } for ( int px = 0; px < parameterTypes.length; px++ ) { if ( !parameterTypes[px].isAssignableFrom( candidateParameterTypes[px] ) ) { break; } } return methods[mx]; } throw new NoSuchMethodException( clazz.getName() + "." + candidateMethodName + "(" + Arrays.toString( candidateParameterTypes ) + ")" ); } private MethodUtils(); static Method getAssignmentCompatibleMethod( Class<?> clazz, String candidateMethodName, Class<?>[] candidateParameterTypes ); }
@Test public void testSortAttributeTypesLoop() { List<AttributeType> attributeTypes = new ArrayList<AttributeType>(); addAttributeType( attributeTypes, "1.1.1", "att1", "att4" ); addAttributeType( attributeTypes, "1.1.2", "att2", "att1" ); addAttributeType( attributeTypes, "1.1.3", "att3", "att2" ); addAttributeType( attributeTypes, "1.1.4", "att4", "att3" ); Iterable<AttributeType> sorted = SchemaObjectSorter.hierarchicalOrdered( attributeTypes ); assertThrows( IllegalStateException.class, () -> { sorted.iterator().next(); } ); }
public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
SchemaObjectSorter { public static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ) { return new SchemaObjectIterable<>( attributeTypes, new ReferenceCallback<AttributeType>() { @Override public Collection<String> getSuperiorOids( AttributeType at ) { return Collections.singleton( at.getSuperiorOid() ); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
@Test public void testSortObjectClassesAlreadySorted() { List<ObjectClass> objectClasses = new ArrayList<ObjectClass>(); addObjectClass( objectClasses, "1.2.1", "oc1" ); addObjectClass( objectClasses, "1.2.2", "OC2", "oc1" ); addObjectClass( objectClasses, "1.2.3", "oc3", "oC2" ); addObjectClass( objectClasses, "1.2.4", "oc4" ); addObjectClass( objectClasses, "1.2.5", "oc5", "Oc2", "oC4" ); addObjectClass( objectClasses, "1.2.6", "oc6", "other" ); Iterable<ObjectClass> sorted = SchemaObjectSorter.sortObjectClasses( objectClasses ); assertHierarchicalOrderOC( sorted ); }
public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
@Test public void testSortObjectClassesShuffled() { List<String> oids = Arrays.asList( "1.1.1", "1.1.2", "1.1.3", "1.1.4", "1.1.5", "1.1.6" ); for ( int i = 0; i < 1000; i++ ) { Collections.shuffle( oids ); Iterator<String> oidIterator = oids.iterator(); List<ObjectClass> objectClasses = new ArrayList<ObjectClass>(); addObjectClass( objectClasses, oidIterator.next(), "oc1" ); addObjectClass( objectClasses, oidIterator.next(), "OC2", "oc1" ); addObjectClass( objectClasses, oidIterator.next(), "oc3", "Oc2" ); addObjectClass( objectClasses, oidIterator.next(), "oc4" ); addObjectClass( objectClasses, oidIterator.next(), "oc5", "oC2", "OC4" ); addObjectClass( objectClasses, oidIterator.next(), "oc6", "other" ); Iterable<ObjectClass> sorted = SchemaObjectSorter.sortObjectClasses( objectClasses ); assertHierarchicalOrderOC( sorted ); } }
public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
@Test public void testSortObjectClassesLoop() { List<ObjectClass> objectClasses = new ArrayList<ObjectClass>(); addObjectClass( objectClasses, "1.2.1", "oc1", "oc3" ); addObjectClass( objectClasses, "1.2.2", "oc2", "oc1" ); addObjectClass( objectClasses, "1.2.3", "oc3", "oc2" ); Iterable<ObjectClass> sorted = SchemaObjectSorter.sortObjectClasses( objectClasses ); assertThrows( IllegalStateException.class, () -> { sorted.iterator().next(); } ); }
public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
SchemaObjectSorter { public static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ) { return new SchemaObjectIterable<>( objectClasses, new ReferenceCallback<ObjectClass>() { @Override public Collection<String> getSuperiorOids( ObjectClass oc ) { return oc.getSuperiorOids(); } } ); } private SchemaObjectSorter(); static Iterable<AttributeType> hierarchicalOrdered( List<AttributeType> attributeTypes ); static Iterable<ObjectClass> sortObjectClasses( List<ObjectClass> objectClasses ); }
@Test public void testEqualsNull() throws Exception { assertFalse( objectClassA.equals( null ) ); }
@Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; }
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; } }
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; } ObjectClass( String oid ); }
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testHashCodeReflexive() throws Exception { assertEquals( objectClassA.hashCode(), objectClassA.hashCode() ); }
@Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testHashCodeSymmetric() throws Exception { assertEquals( objectClassA.hashCode(), objectClassACopy.hashCode() ); assertEquals( objectClassACopy.hashCode(), objectClassA.hashCode() ); }
@Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testHashCodeTransitive() throws Exception { assertEquals( objectClassA.hashCode(), objectClassACopy.hashCode() ); assertEquals( objectClassACopy.hashCode(), objectClassB.hashCode() ); assertEquals( objectClassA.hashCode(), objectClassB.hashCode() ); }
@Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
ObjectClass extends AbstractSchemaObject { @Override public int hashCode() { int hash = h; hash = hash * 17 + objectClassType.getValue(); int tempHash = 0; for ( String oid : superiorOids ) { tempHash += oid.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String may : mayAttributeTypeOids ) { tempHash += may.hashCode(); } hash = hash * 17 + tempHash; tempHash = 0; for ( String must : mustAttributeTypeOids ) { tempHash += must.hashCode(); } hash = hash * 17 + tempHash; return hash; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testNotEqualDiffValue() throws Exception { assertFalse( objectClassA.equals( objectClassC ) ); assertFalse( objectClassC.equals( objectClassA ) ); }
@Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; }
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; } }
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; } ObjectClass( String oid ); }
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
ObjectClass extends AbstractSchemaObject { @Override public boolean equals( Object o ) { if ( !super.equals( o ) ) { return false; } if ( !( o instanceof ObjectClass ) ) { return false; } ObjectClass that = ( ObjectClass ) o; if ( objectClassType != that.objectClassType ) { return false; } if ( superiorOids.size() != that.superiorOids.size() ) { return false; } for ( String oid : superiorOids ) { if ( !that.superiorOids.contains( oid ) ) { return false; } } for ( String oid : that.superiorOids ) { if ( !superiorOids.contains( oid ) ) { return false; } } if ( superiors.size() != that.superiors.size() ) { return false; } for ( ObjectClass superior : superiors ) { if ( !that.superiors.contains( superior ) ) { return false; } } for ( ObjectClass superior : that.superiors ) { if ( !superiors.contains( superior ) ) { return false; } } if ( mayAttributeTypeOids.size() != that.mayAttributeTypeOids.size() ) { return false; } for ( String oid : mayAttributeTypeOids ) { if ( !that.mayAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mayAttributeTypeOids ) { if ( !mayAttributeTypeOids.contains( oid ) ) { return false; } } if ( mayAttributeTypes.size() != that.mayAttributeTypes.size() ) { return false; } for ( AttributeType oid : mayAttributeTypes ) { if ( !that.mayAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mayAttributeTypes ) { if ( !mayAttributeTypes.contains( oid ) ) { return false; } } if ( mustAttributeTypeOids.size() != that.mustAttributeTypeOids.size() ) { return false; } for ( String oid : mustAttributeTypeOids ) { if ( !that.mustAttributeTypeOids.contains( oid ) ) { return false; } } for ( String oid : that.mustAttributeTypeOids ) { if ( !mustAttributeTypeOids.contains( oid ) ) { return false; } } if ( mustAttributeTypes.size() != that.mustAttributeTypes.size() ) { return false; } for ( AttributeType oid : mustAttributeTypes ) { if ( !that.mustAttributeTypes.contains( oid ) ) { return false; } } for ( AttributeType oid : that.mustAttributeTypes ) { if ( !mustAttributeTypes.contains( oid ) ) { return false; } } return true; } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testToString() throws Exception { String string = objectClass.toString(); assertNotNull( string ); assertTrue( string.startsWith( "objectclass (" ) ); assertTrue( string.contains( " NAME " ) ); assertTrue( string.contains( "\n\tDESC " ) ); assertTrue( string.contains( "\n\tSUP " ) ); assertTrue( string.contains( "\n\tSTRUCTURAL" ) ); assertTrue( string.contains( "\n\tMUST" ) ); assertTrue( string.contains( "\n\tMAY" ) ); assertTrue( string.endsWith( " )" ) ); }
@Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); }
ObjectClass extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } }
ObjectClass extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } ObjectClass( String oid ); }
ObjectClass extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
ObjectClass extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } ObjectClass( String oid ); List<String> getMayAttributeTypeOids(); List<AttributeType> getMayAttributeTypes(); void addMayAttributeTypeOids( String... oids ); void addMayAttributeTypes( AttributeType... attributeTypes ); void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ); void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ); List<String> getMustAttributeTypeOids(); List<AttributeType> getMustAttributeTypes(); void addMustAttributeTypeOids( String... oids ); void addMustAttributeTypes( AttributeType... attributeTypes ); void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ); void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ); List<ObjectClass> getSuperiors(); List<String> getSuperiorOids(); void addSuperiorOids( String... oids ); void addSuperior( ObjectClass... objectClasses ); void setSuperiors( List<ObjectClass> superiors ); void setSuperiorOids( List<String> superiorOids ); ObjectClassTypeEnum getType(); void setType( ObjectClassTypeEnum objectClassType ); boolean isStructural(); boolean isAbstract(); boolean isAuxiliary(); @Override String toString(); @Override ObjectClass copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testTrimConsecutiveToOne() { String input = null; String result = null; input = "akarasulu**"; result = Strings.trimConsecutiveToOne( input, '*' ); assertEquals( "akarasulu*", result ); input = "*****akarasulu**"; result = Strings.trimConsecutiveToOne( input, '*' ); assertEquals( "*akarasulu*", result ); input = "**akarasulu"; result = Strings.trimConsecutiveToOne( input, '*' ); assertEquals( "*akarasulu", result ); input = "**akar****asulu**"; result = Strings.trimConsecutiveToOne( input, '*' ); assertEquals( "*akar*asulu*", result ); input = "akarasulu"; result = Strings.trimConsecutiveToOne( input, '*' ); assertEquals( "akarasulu", result ); input = "*a*k*a*r*a*s*u*l*u*"; result = Strings.trimConsecutiveToOne( input, '*' ); assertEquals( "*a*k*a*r*a*s*u*l*u*", result ); }
public static String trimConsecutiveToOne( String str, char ch ) { if ( ( null == str ) || ( str.length() == 0 ) ) { return ""; } char[] buffer = str.toCharArray(); char[] newbuf = new char[buffer.length]; int pos = 0; boolean same = false; for ( int i = 0; i < buffer.length; i++ ) { char car = buffer[i]; if ( car == ch ) { if ( !same ) { same = true; newbuf[pos++] = car; } } else { same = false; newbuf[pos++] = car; } } return new String( newbuf, 0, pos ); }
Strings { public static String trimConsecutiveToOne( String str, char ch ) { if ( ( null == str ) || ( str.length() == 0 ) ) { return ""; } char[] buffer = str.toCharArray(); char[] newbuf = new char[buffer.length]; int pos = 0; boolean same = false; for ( int i = 0; i < buffer.length; i++ ) { char car = buffer[i]; if ( car == ch ) { if ( !same ) { same = true; newbuf[pos++] = car; } } else { same = false; newbuf[pos++] = car; } } return new String( newbuf, 0, pos ); } }
Strings { public static String trimConsecutiveToOne( String str, char ch ) { if ( ( null == str ) || ( str.length() == 0 ) ) { return ""; } char[] buffer = str.toCharArray(); char[] newbuf = new char[buffer.length]; int pos = 0; boolean same = false; for ( int i = 0; i < buffer.length; i++ ) { char car = buffer[i]; if ( car == ch ) { if ( !same ) { same = true; newbuf[pos++] = car; } } else { same = false; newbuf[pos++] = car; } } return new String( newbuf, 0, pos ); } private Strings(); }
Strings { public static String trimConsecutiveToOne( String str, char ch ) { if ( ( null == str ) || ( str.length() == 0 ) ) { return ""; } char[] buffer = str.toCharArray(); char[] newbuf = new char[buffer.length]; int pos = 0; boolean same = false; for ( int i = 0; i < buffer.length; i++ ) { char car = buffer[i]; if ( car == ch ) { if ( !same ) { same = true; newbuf[pos++] = car; } } else { same = false; newbuf[pos++] = car; } } return new String( newbuf, 0, pos ); } private Strings(); static String dumpBytes( byte[] buffer ); static String byteToString( byte b ); static String dumpByte( byte octet ); static char dumpHex( byte hex ); static String dumpHexPairs( byte[] buffer ); static String deepTrim( String str, boolean toLowerCase ); static String deepTrimToLower( String string ); static String deepTrim( String string ); static String trimConsecutiveToOne( String str, char ch ); static String centerTrunc( String str, int head, int tail ); static String toHexString( byte[] res ); static byte[] toByteArray( String hexString ); static String formatHtml( String source, boolean replaceNl, boolean replaceTag, boolean replaceQuote ); static boolean areEquals( String string, int index, String text ); static boolean isCharASCII( byte[] byteArray, int index, char car ); static boolean isCharASCII( char[] charArray, int index, char car ); static boolean isCharASCII( String string, int index, char car ); static String utf8ToString( byte[] bytes ); static String utf8ToString( byte[] bytes, int length ); static String utf8ToString( byte[] bytes, int start, int length ); static int areEquals( byte[] bytes, int index, String text ); static int areEquals( char[] chars, int index, String text ); static int areEquals( char[] chars, int index, String text, boolean caseSensitive ); static int areEquals( char[] chars, int index, char[] chars2 ); static int areEquals( char[] chars, int index, char[] chars2, boolean caseSensitive ); static int areEquals( byte[] bytes, int index, byte[] bytes2 ); static boolean isEmpty( String str ); static boolean isEmpty( byte[] bytes ); static String trim( String str ); static byte[] trim( byte[] bytes ); static String trimLeft( String str ); static int trimLeft( char[] chars, int pos ); static void trimLeft( String string, Position pos ); static void trimLeft( byte[] bytes, Position pos ); static int trimLeft( byte[] bytes, int pos ); static String trimRight( String str ); static String trimRight( String str, int escapedSpace ); static int trimRight( char[] chars, int pos ); static String trimRight( String string, Position pos ); static String trimRight( byte[] bytes, Position pos ); static int trimRight( byte[] bytes, int pos ); static char charAt( String string, int index ); static byte byteAt( byte[] bytes, int index ); static char charAt( char[] chars, int index ); static String asciiBytesToString( byte[] bytes ); static byte[] getBytesUtf8( String string ); static byte[] getBytesUtf8Ascii( String string ); static String getDefaultCharsetName(); static boolean equals( String str1, String str2 ); static String listToString( List<?> list ); static String setToString( Set<?> set ); static String listToString( List<?> list, String tabs ); static String mapToString( Map<?, ?> map ); static String mapToString( Map<?, ?> map, String tabs ); @Deprecated static String toLowerCase( String value ); static String toLowerCaseAscii( String value ); static String toLowerCase( byte[] value ); @Deprecated static String toUpperCase( String value ); static String toUpperCaseAscii( String value ); static String upperCase( String str ); static String lowerCase( String str ); static String lowerCaseAscii( String str ); static boolean isPrintableString( String str ); static boolean isNotEmpty( String str ); static boolean isIA5String( String str ); static boolean isValidUuid( String uuid ); static String uuidToString( byte[] bytes ); static byte[] uuidToBytes( String string ); static byte[] copy( byte[] value ); static String getString( final byte[] data, int offset, int length, String charset ); static String getString( final byte[] data, int offset, int length, Charset charset ); static String getString( final byte[] data, String charset ); static String getString( final byte[] data, Charset charset ); static String getUUID( long value ); static int parseInt( String value ); static int compare( byte[] b1, byte[] b2 ); }
Strings { public static String trimConsecutiveToOne( String str, char ch ) { if ( ( null == str ) || ( str.length() == 0 ) ) { return ""; } char[] buffer = str.toCharArray(); char[] newbuf = new char[buffer.length]; int pos = 0; boolean same = false; for ( int i = 0; i < buffer.length; i++ ) { char car = buffer[i]; if ( car == ch ) { if ( !same ) { same = true; newbuf[pos++] = car; } } else { same = false; newbuf[pos++] = car; } } return new String( newbuf, 0, pos ); } private Strings(); static String dumpBytes( byte[] buffer ); static String byteToString( byte b ); static String dumpByte( byte octet ); static char dumpHex( byte hex ); static String dumpHexPairs( byte[] buffer ); static String deepTrim( String str, boolean toLowerCase ); static String deepTrimToLower( String string ); static String deepTrim( String string ); static String trimConsecutiveToOne( String str, char ch ); static String centerTrunc( String str, int head, int tail ); static String toHexString( byte[] res ); static byte[] toByteArray( String hexString ); static String formatHtml( String source, boolean replaceNl, boolean replaceTag, boolean replaceQuote ); static boolean areEquals( String string, int index, String text ); static boolean isCharASCII( byte[] byteArray, int index, char car ); static boolean isCharASCII( char[] charArray, int index, char car ); static boolean isCharASCII( String string, int index, char car ); static String utf8ToString( byte[] bytes ); static String utf8ToString( byte[] bytes, int length ); static String utf8ToString( byte[] bytes, int start, int length ); static int areEquals( byte[] bytes, int index, String text ); static int areEquals( char[] chars, int index, String text ); static int areEquals( char[] chars, int index, String text, boolean caseSensitive ); static int areEquals( char[] chars, int index, char[] chars2 ); static int areEquals( char[] chars, int index, char[] chars2, boolean caseSensitive ); static int areEquals( byte[] bytes, int index, byte[] bytes2 ); static boolean isEmpty( String str ); static boolean isEmpty( byte[] bytes ); static String trim( String str ); static byte[] trim( byte[] bytes ); static String trimLeft( String str ); static int trimLeft( char[] chars, int pos ); static void trimLeft( String string, Position pos ); static void trimLeft( byte[] bytes, Position pos ); static int trimLeft( byte[] bytes, int pos ); static String trimRight( String str ); static String trimRight( String str, int escapedSpace ); static int trimRight( char[] chars, int pos ); static String trimRight( String string, Position pos ); static String trimRight( byte[] bytes, Position pos ); static int trimRight( byte[] bytes, int pos ); static char charAt( String string, int index ); static byte byteAt( byte[] bytes, int index ); static char charAt( char[] chars, int index ); static String asciiBytesToString( byte[] bytes ); static byte[] getBytesUtf8( String string ); static byte[] getBytesUtf8Ascii( String string ); static String getDefaultCharsetName(); static boolean equals( String str1, String str2 ); static String listToString( List<?> list ); static String setToString( Set<?> set ); static String listToString( List<?> list, String tabs ); static String mapToString( Map<?, ?> map ); static String mapToString( Map<?, ?> map, String tabs ); @Deprecated static String toLowerCase( String value ); static String toLowerCaseAscii( String value ); static String toLowerCase( byte[] value ); @Deprecated static String toUpperCase( String value ); static String toUpperCaseAscii( String value ); static String upperCase( String str ); static String lowerCase( String str ); static String lowerCaseAscii( String str ); static boolean isPrintableString( String str ); static boolean isNotEmpty( String str ); static boolean isIA5String( String str ); static boolean isValidUuid( String uuid ); static String uuidToString( byte[] bytes ); static byte[] uuidToBytes( String string ); static byte[] copy( byte[] value ); static String getString( final byte[] data, int offset, int length, String charset ); static String getString( final byte[] data, int offset, int length, Charset charset ); static String getString( final byte[] data, String charset ); static String getString( final byte[] data, Charset charset ); static String getUUID( long value ); static int parseInt( String value ); static int compare( byte[] b1, byte[] b2 ); static final byte[] HEX_CHAR; static final byte[] EMPTY_BYTES; static final String EMPTY_STRING; static final String[] EMPTY_STRING_ARRAY; }
@Test public void testCopy() throws Exception { }
public OidRegistry<T> copy() { OidRegistry<T> copy = new OidRegistry<>(); copy.byOid = new HashMap<>(); return copy; }
OidRegistry implements Iterable<T> { public OidRegistry<T> copy() { OidRegistry<T> copy = new OidRegistry<>(); copy.byOid = new HashMap<>(); return copy; } }
OidRegistry implements Iterable<T> { public OidRegistry<T> copy() { OidRegistry<T> copy = new OidRegistry<>(); copy.byOid = new HashMap<>(); return copy; } }
OidRegistry implements Iterable<T> { public OidRegistry<T> copy() { OidRegistry<T> copy = new OidRegistry<>(); copy.byOid = new HashMap<>(); return copy; } boolean contains( String oid ); String getPrimaryName( String oid ); T getSchemaObject( String oid ); List<String> getNameSet( String oid ); Iterator<String> iteratorOids(); @Override Iterator<T> iterator(); boolean isRelaxed(); boolean isStrict(); void setRelaxed(); void setStrict(); SchemaErrorHandler getErrorHandler(); void setErrorHandler( SchemaErrorHandler errorHandler ); void register( T schemaObject ); void unregister( String oid ); OidRegistry<T> copy(); int size(); void clear(); @Override String toString(); }
OidRegistry implements Iterable<T> { public OidRegistry<T> copy() { OidRegistry<T> copy = new OidRegistry<>(); copy.byOid = new HashMap<>(); return copy; } boolean contains( String oid ); String getPrimaryName( String oid ); T getSchemaObject( String oid ); List<String> getNameSet( String oid ); Iterator<String> iteratorOids(); @Override Iterator<T> iterator(); boolean isRelaxed(); boolean isStrict(); void setRelaxed(); void setStrict(); SchemaErrorHandler getErrorHandler(); void setErrorHandler( SchemaErrorHandler errorHandler ); void register( T schemaObject ); void unregister( String oid ); OidRegistry<T> copy(); int size(); void clear(); @Override String toString(); }
@Test public void testClone() { }
@Override public Registries clone() throws CloneNotSupportedException { Registries clone = ( Registries ) super.clone(); clone.globalOidRegistry = globalOidRegistry.copy(); clone.attributeTypeRegistry = attributeTypeRegistry.copy(); clone.comparatorRegistry = comparatorRegistry.copy(); clone.ditContentRuleRegistry = ditContentRuleRegistry.copy(); clone.ditStructureRuleRegistry = ditStructureRuleRegistry.copy(); clone.ldapSyntaxRegistry = ldapSyntaxRegistry.copy(); clone.matchingRuleRegistry = matchingRuleRegistry.copy(); clone.matchingRuleUseRegistry = matchingRuleUseRegistry.copy(); clone.nameFormRegistry = nameFormRegistry.copy(); clone.normalizerRegistry = normalizerRegistry.copy(); clone.objectClassRegistry = objectClassRegistry.copy(); clone.syntaxCheckerRegistry = syntaxCheckerRegistry.copy(); clone.errorHandler = errorHandler; for ( AttributeType attributeType : clone.attributeTypeRegistry ) { clone.globalOidRegistry.put( attributeType ); } for ( DitContentRule ditContentRule : clone.ditContentRuleRegistry ) { clone.globalOidRegistry.put( ditContentRule ); } for ( DitStructureRule ditStructureRule : clone.ditStructureRuleRegistry ) { clone.globalOidRegistry.put( ditStructureRule ); } for ( MatchingRule matchingRule : clone.matchingRuleRegistry ) { clone.globalOidRegistry.put( matchingRule ); } for ( MatchingRuleUse matchingRuleUse : clone.matchingRuleUseRegistry ) { clone.globalOidRegistry.put( matchingRuleUse ); } for ( NameForm nameForm : clone.nameFormRegistry ) { clone.globalOidRegistry.put( nameForm ); } for ( ObjectClass objectClass : clone.objectClassRegistry ) { clone.globalOidRegistry.put( objectClass ); } for ( LdapSyntax syntax : clone.ldapSyntaxRegistry ) { clone.globalOidRegistry.put( syntax ); } clone.loadedSchemas = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { clone.loadedSchemas.put( entry.getKey(), loadedSchemas.get( entry.getKey() ) ); } clone.using = new HashMap<>(); clone.usedBy = new HashMap<>(); clone.buildReferences(); clone.checkRefInteg(); clone.schemaObjects = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { Set<SchemaObjectWrapper> objects = new HashSet<>(); for ( SchemaObjectWrapper schemaObjectWrapper : entry.getValue() ) { SchemaObject original = schemaObjectWrapper.get(); try { if ( !( original instanceof LoadableSchemaObject ) ) { SchemaObject copy = clone.globalOidRegistry.getSchemaObject( original.getOid() ); SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( copy ); objects.add( newWrapper ); } else { SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( original ); objects.add( newWrapper ); } } catch ( LdapException ne ) { } } clone.schemaObjects.put( entry.getKey(), objects ); } return clone; }
Registries implements SchemaLoaderListener, Cloneable { @Override public Registries clone() throws CloneNotSupportedException { Registries clone = ( Registries ) super.clone(); clone.globalOidRegistry = globalOidRegistry.copy(); clone.attributeTypeRegistry = attributeTypeRegistry.copy(); clone.comparatorRegistry = comparatorRegistry.copy(); clone.ditContentRuleRegistry = ditContentRuleRegistry.copy(); clone.ditStructureRuleRegistry = ditStructureRuleRegistry.copy(); clone.ldapSyntaxRegistry = ldapSyntaxRegistry.copy(); clone.matchingRuleRegistry = matchingRuleRegistry.copy(); clone.matchingRuleUseRegistry = matchingRuleUseRegistry.copy(); clone.nameFormRegistry = nameFormRegistry.copy(); clone.normalizerRegistry = normalizerRegistry.copy(); clone.objectClassRegistry = objectClassRegistry.copy(); clone.syntaxCheckerRegistry = syntaxCheckerRegistry.copy(); clone.errorHandler = errorHandler; for ( AttributeType attributeType : clone.attributeTypeRegistry ) { clone.globalOidRegistry.put( attributeType ); } for ( DitContentRule ditContentRule : clone.ditContentRuleRegistry ) { clone.globalOidRegistry.put( ditContentRule ); } for ( DitStructureRule ditStructureRule : clone.ditStructureRuleRegistry ) { clone.globalOidRegistry.put( ditStructureRule ); } for ( MatchingRule matchingRule : clone.matchingRuleRegistry ) { clone.globalOidRegistry.put( matchingRule ); } for ( MatchingRuleUse matchingRuleUse : clone.matchingRuleUseRegistry ) { clone.globalOidRegistry.put( matchingRuleUse ); } for ( NameForm nameForm : clone.nameFormRegistry ) { clone.globalOidRegistry.put( nameForm ); } for ( ObjectClass objectClass : clone.objectClassRegistry ) { clone.globalOidRegistry.put( objectClass ); } for ( LdapSyntax syntax : clone.ldapSyntaxRegistry ) { clone.globalOidRegistry.put( syntax ); } clone.loadedSchemas = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { clone.loadedSchemas.put( entry.getKey(), loadedSchemas.get( entry.getKey() ) ); } clone.using = new HashMap<>(); clone.usedBy = new HashMap<>(); clone.buildReferences(); clone.checkRefInteg(); clone.schemaObjects = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { Set<SchemaObjectWrapper> objects = new HashSet<>(); for ( SchemaObjectWrapper schemaObjectWrapper : entry.getValue() ) { SchemaObject original = schemaObjectWrapper.get(); try { if ( !( original instanceof LoadableSchemaObject ) ) { SchemaObject copy = clone.globalOidRegistry.getSchemaObject( original.getOid() ); SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( copy ); objects.add( newWrapper ); } else { SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( original ); objects.add( newWrapper ); } } catch ( LdapException ne ) { } } clone.schemaObjects.put( entry.getKey(), objects ); } return clone; } }
Registries implements SchemaLoaderListener, Cloneable { @Override public Registries clone() throws CloneNotSupportedException { Registries clone = ( Registries ) super.clone(); clone.globalOidRegistry = globalOidRegistry.copy(); clone.attributeTypeRegistry = attributeTypeRegistry.copy(); clone.comparatorRegistry = comparatorRegistry.copy(); clone.ditContentRuleRegistry = ditContentRuleRegistry.copy(); clone.ditStructureRuleRegistry = ditStructureRuleRegistry.copy(); clone.ldapSyntaxRegistry = ldapSyntaxRegistry.copy(); clone.matchingRuleRegistry = matchingRuleRegistry.copy(); clone.matchingRuleUseRegistry = matchingRuleUseRegistry.copy(); clone.nameFormRegistry = nameFormRegistry.copy(); clone.normalizerRegistry = normalizerRegistry.copy(); clone.objectClassRegistry = objectClassRegistry.copy(); clone.syntaxCheckerRegistry = syntaxCheckerRegistry.copy(); clone.errorHandler = errorHandler; for ( AttributeType attributeType : clone.attributeTypeRegistry ) { clone.globalOidRegistry.put( attributeType ); } for ( DitContentRule ditContentRule : clone.ditContentRuleRegistry ) { clone.globalOidRegistry.put( ditContentRule ); } for ( DitStructureRule ditStructureRule : clone.ditStructureRuleRegistry ) { clone.globalOidRegistry.put( ditStructureRule ); } for ( MatchingRule matchingRule : clone.matchingRuleRegistry ) { clone.globalOidRegistry.put( matchingRule ); } for ( MatchingRuleUse matchingRuleUse : clone.matchingRuleUseRegistry ) { clone.globalOidRegistry.put( matchingRuleUse ); } for ( NameForm nameForm : clone.nameFormRegistry ) { clone.globalOidRegistry.put( nameForm ); } for ( ObjectClass objectClass : clone.objectClassRegistry ) { clone.globalOidRegistry.put( objectClass ); } for ( LdapSyntax syntax : clone.ldapSyntaxRegistry ) { clone.globalOidRegistry.put( syntax ); } clone.loadedSchemas = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { clone.loadedSchemas.put( entry.getKey(), loadedSchemas.get( entry.getKey() ) ); } clone.using = new HashMap<>(); clone.usedBy = new HashMap<>(); clone.buildReferences(); clone.checkRefInteg(); clone.schemaObjects = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { Set<SchemaObjectWrapper> objects = new HashSet<>(); for ( SchemaObjectWrapper schemaObjectWrapper : entry.getValue() ) { SchemaObject original = schemaObjectWrapper.get(); try { if ( !( original instanceof LoadableSchemaObject ) ) { SchemaObject copy = clone.globalOidRegistry.getSchemaObject( original.getOid() ); SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( copy ); objects.add( newWrapper ); } else { SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( original ); objects.add( newWrapper ); } } catch ( LdapException ne ) { } } clone.schemaObjects.put( entry.getKey(), objects ); } return clone; } Registries(); }
Registries implements SchemaLoaderListener, Cloneable { @Override public Registries clone() throws CloneNotSupportedException { Registries clone = ( Registries ) super.clone(); clone.globalOidRegistry = globalOidRegistry.copy(); clone.attributeTypeRegistry = attributeTypeRegistry.copy(); clone.comparatorRegistry = comparatorRegistry.copy(); clone.ditContentRuleRegistry = ditContentRuleRegistry.copy(); clone.ditStructureRuleRegistry = ditStructureRuleRegistry.copy(); clone.ldapSyntaxRegistry = ldapSyntaxRegistry.copy(); clone.matchingRuleRegistry = matchingRuleRegistry.copy(); clone.matchingRuleUseRegistry = matchingRuleUseRegistry.copy(); clone.nameFormRegistry = nameFormRegistry.copy(); clone.normalizerRegistry = normalizerRegistry.copy(); clone.objectClassRegistry = objectClassRegistry.copy(); clone.syntaxCheckerRegistry = syntaxCheckerRegistry.copy(); clone.errorHandler = errorHandler; for ( AttributeType attributeType : clone.attributeTypeRegistry ) { clone.globalOidRegistry.put( attributeType ); } for ( DitContentRule ditContentRule : clone.ditContentRuleRegistry ) { clone.globalOidRegistry.put( ditContentRule ); } for ( DitStructureRule ditStructureRule : clone.ditStructureRuleRegistry ) { clone.globalOidRegistry.put( ditStructureRule ); } for ( MatchingRule matchingRule : clone.matchingRuleRegistry ) { clone.globalOidRegistry.put( matchingRule ); } for ( MatchingRuleUse matchingRuleUse : clone.matchingRuleUseRegistry ) { clone.globalOidRegistry.put( matchingRuleUse ); } for ( NameForm nameForm : clone.nameFormRegistry ) { clone.globalOidRegistry.put( nameForm ); } for ( ObjectClass objectClass : clone.objectClassRegistry ) { clone.globalOidRegistry.put( objectClass ); } for ( LdapSyntax syntax : clone.ldapSyntaxRegistry ) { clone.globalOidRegistry.put( syntax ); } clone.loadedSchemas = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { clone.loadedSchemas.put( entry.getKey(), loadedSchemas.get( entry.getKey() ) ); } clone.using = new HashMap<>(); clone.usedBy = new HashMap<>(); clone.buildReferences(); clone.checkRefInteg(); clone.schemaObjects = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { Set<SchemaObjectWrapper> objects = new HashSet<>(); for ( SchemaObjectWrapper schemaObjectWrapper : entry.getValue() ) { SchemaObject original = schemaObjectWrapper.get(); try { if ( !( original instanceof LoadableSchemaObject ) ) { SchemaObject copy = clone.globalOidRegistry.getSchemaObject( original.getOid() ); SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( copy ); objects.add( newWrapper ); } else { SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( original ); objects.add( newWrapper ); } } catch ( LdapException ne ) { } } clone.schemaObjects.put( entry.getKey(), objects ); } return clone; } Registries(); AttributeTypeRegistry getAttributeTypeRegistry(); ComparatorRegistry getComparatorRegistry(); DitContentRuleRegistry getDitContentRuleRegistry(); DitStructureRuleRegistry getDitStructureRuleRegistry(); MatchingRuleRegistry getMatchingRuleRegistry(); MatchingRuleUseRegistry getMatchingRuleUseRegistry(); NameFormRegistry getNameFormRegistry(); NormalizerRegistry getNormalizerRegistry(); ObjectClassRegistry getObjectClassRegistry(); OidRegistry<SchemaObject> getGlobalOidRegistry(); SyntaxCheckerRegistry getSyntaxCheckerRegistry(); LdapSyntaxRegistry getLdapSyntaxRegistry(); String getOid( String name ); Schema getLoadedSchema( String schemaName ); boolean isSchemaLoaded( String schemaName ); void checkRefInteg(); void delCrossReferences( AttributeType attributeType ); void delCrossReferences( MatchingRule matchingRule ); void buildReference( SchemaObject schemaObject ); void removeReference( SchemaObject schemaObject ); void buildReferences(); void add( SchemaObject schemaObject, boolean check ); void delete( SchemaObject schemaObject ); @Override void schemaLoaded( Schema schema ); @Override void schemaUnloaded( Schema schema ); Map<String, Schema> getLoadedSchemas(); Map<String, Set<SchemaObjectWrapper>> getObjectBySchemaName(); boolean contains( SchemaObject schemaObject ); Set<SchemaObjectWrapper> addSchema( String schemaName ); void associateWithSchema( SchemaObject schemaObject ); void dissociateFromSchema( SchemaObject schemaObject ); boolean isReferenced( SchemaObject schemaObject ); Set<SchemaObjectWrapper> getUsedBy( SchemaObject schemaObject ); String dumpUsedBy(); String dumpUsing(); Set<SchemaObjectWrapper> getUsing( SchemaObject schemaObject ); void addReference( SchemaObject base, SchemaObject referenced ); void delReference( SchemaObject base, SchemaObject referenced ); boolean check(); @Override Registries clone(); boolean isRelaxed(); boolean isStrict(); void setRelaxed(); void setStrict(); SchemaErrorHandler getErrorHandler(); void setErrorHandler( SchemaErrorHandler errorHandler ); boolean isDisabledAccepted(); Set<SchemaObjectWrapper> getReferencing( SchemaObject schemaObject ); void setDisabledAccepted( boolean disabledAccepted ); void clear(); @Override String toString(); }
Registries implements SchemaLoaderListener, Cloneable { @Override public Registries clone() throws CloneNotSupportedException { Registries clone = ( Registries ) super.clone(); clone.globalOidRegistry = globalOidRegistry.copy(); clone.attributeTypeRegistry = attributeTypeRegistry.copy(); clone.comparatorRegistry = comparatorRegistry.copy(); clone.ditContentRuleRegistry = ditContentRuleRegistry.copy(); clone.ditStructureRuleRegistry = ditStructureRuleRegistry.copy(); clone.ldapSyntaxRegistry = ldapSyntaxRegistry.copy(); clone.matchingRuleRegistry = matchingRuleRegistry.copy(); clone.matchingRuleUseRegistry = matchingRuleUseRegistry.copy(); clone.nameFormRegistry = nameFormRegistry.copy(); clone.normalizerRegistry = normalizerRegistry.copy(); clone.objectClassRegistry = objectClassRegistry.copy(); clone.syntaxCheckerRegistry = syntaxCheckerRegistry.copy(); clone.errorHandler = errorHandler; for ( AttributeType attributeType : clone.attributeTypeRegistry ) { clone.globalOidRegistry.put( attributeType ); } for ( DitContentRule ditContentRule : clone.ditContentRuleRegistry ) { clone.globalOidRegistry.put( ditContentRule ); } for ( DitStructureRule ditStructureRule : clone.ditStructureRuleRegistry ) { clone.globalOidRegistry.put( ditStructureRule ); } for ( MatchingRule matchingRule : clone.matchingRuleRegistry ) { clone.globalOidRegistry.put( matchingRule ); } for ( MatchingRuleUse matchingRuleUse : clone.matchingRuleUseRegistry ) { clone.globalOidRegistry.put( matchingRuleUse ); } for ( NameForm nameForm : clone.nameFormRegistry ) { clone.globalOidRegistry.put( nameForm ); } for ( ObjectClass objectClass : clone.objectClassRegistry ) { clone.globalOidRegistry.put( objectClass ); } for ( LdapSyntax syntax : clone.ldapSyntaxRegistry ) { clone.globalOidRegistry.put( syntax ); } clone.loadedSchemas = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { clone.loadedSchemas.put( entry.getKey(), loadedSchemas.get( entry.getKey() ) ); } clone.using = new HashMap<>(); clone.usedBy = new HashMap<>(); clone.buildReferences(); clone.checkRefInteg(); clone.schemaObjects = new HashMap<>(); for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet() ) { Set<SchemaObjectWrapper> objects = new HashSet<>(); for ( SchemaObjectWrapper schemaObjectWrapper : entry.getValue() ) { SchemaObject original = schemaObjectWrapper.get(); try { if ( !( original instanceof LoadableSchemaObject ) ) { SchemaObject copy = clone.globalOidRegistry.getSchemaObject( original.getOid() ); SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( copy ); objects.add( newWrapper ); } else { SchemaObjectWrapper newWrapper = new SchemaObjectWrapper( original ); objects.add( newWrapper ); } } catch ( LdapException ne ) { } } clone.schemaObjects.put( entry.getKey(), objects ); } return clone; } Registries(); AttributeTypeRegistry getAttributeTypeRegistry(); ComparatorRegistry getComparatorRegistry(); DitContentRuleRegistry getDitContentRuleRegistry(); DitStructureRuleRegistry getDitStructureRuleRegistry(); MatchingRuleRegistry getMatchingRuleRegistry(); MatchingRuleUseRegistry getMatchingRuleUseRegistry(); NameFormRegistry getNameFormRegistry(); NormalizerRegistry getNormalizerRegistry(); ObjectClassRegistry getObjectClassRegistry(); OidRegistry<SchemaObject> getGlobalOidRegistry(); SyntaxCheckerRegistry getSyntaxCheckerRegistry(); LdapSyntaxRegistry getLdapSyntaxRegistry(); String getOid( String name ); Schema getLoadedSchema( String schemaName ); boolean isSchemaLoaded( String schemaName ); void checkRefInteg(); void delCrossReferences( AttributeType attributeType ); void delCrossReferences( MatchingRule matchingRule ); void buildReference( SchemaObject schemaObject ); void removeReference( SchemaObject schemaObject ); void buildReferences(); void add( SchemaObject schemaObject, boolean check ); void delete( SchemaObject schemaObject ); @Override void schemaLoaded( Schema schema ); @Override void schemaUnloaded( Schema schema ); Map<String, Schema> getLoadedSchemas(); Map<String, Set<SchemaObjectWrapper>> getObjectBySchemaName(); boolean contains( SchemaObject schemaObject ); Set<SchemaObjectWrapper> addSchema( String schemaName ); void associateWithSchema( SchemaObject schemaObject ); void dissociateFromSchema( SchemaObject schemaObject ); boolean isReferenced( SchemaObject schemaObject ); Set<SchemaObjectWrapper> getUsedBy( SchemaObject schemaObject ); String dumpUsedBy(); String dumpUsing(); Set<SchemaObjectWrapper> getUsing( SchemaObject schemaObject ); void addReference( SchemaObject base, SchemaObject referenced ); void delReference( SchemaObject base, SchemaObject referenced ); boolean check(); @Override Registries clone(); boolean isRelaxed(); boolean isStrict(); void setRelaxed(); void setStrict(); SchemaErrorHandler getErrorHandler(); void setErrorHandler( SchemaErrorHandler errorHandler ); boolean isDisabledAccepted(); Set<SchemaObjectWrapper> getReferencing( SchemaObject schemaObject ); void setDisabledAccepted( boolean disabledAccepted ); void clear(); @Override String toString(); static final boolean STRICT; static final boolean RELAXED; }
@Test public void testToString() throws Exception { String string = attributeType.toString(); assertNotNull( string ); assertTrue( string.startsWith( "attributetype (" ) ); assertTrue( string.contains( " NAME " ) ); assertTrue( string.contains( "\n\tDESC " ) ); assertTrue( string.contains( "\n\tSUP " ) ); assertTrue( string.contains( "\n\tUSAGE" ) ); }
@Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); }
AttributeType extends AbstractSchemaObject implements Cloneable { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } }
AttributeType extends AbstractSchemaObject implements Cloneable { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } AttributeType( String oid ); }
AttributeType extends AbstractSchemaObject implements Cloneable { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } AttributeType( String oid ); boolean isSingleValued(); void setSingleValued( boolean singleValued ); boolean isUserModifiable(); void setUserModifiable( boolean userModifiable ); boolean isCollective(); void setCollective( boolean collective ); boolean isRelaxed(); void setRelaxed( boolean isRelaxed ); UsageEnum getUsage(); void setUsage( UsageEnum usage ); long getSyntaxLength(); void setSyntaxLength( long length ); AttributeType getSuperior(); String getSuperiorOid(); void setSuperior( AttributeType superior ); void setSuperior( String newSuperiorOid ); void setSuperiorOid( String superiorOid ); String getSuperiorName(); LdapSyntax getSyntax(); void setSyntax( LdapSyntax syntax ); String getSyntaxName(); String getSyntaxOid(); void setSyntaxOid( String syntaxOid ); MatchingRule getEquality(); void setEquality( MatchingRule equality ); String getEqualityOid(); void setEqualityOid( String equalityOid ); String getEqualityName(); MatchingRule getOrdering(); void setOrdering( MatchingRule ordering ); String getOrderingName(); String getOrderingOid(); void setOrderingOid( String orderingOid ); MatchingRule getSubstring(); void setSubstring( MatchingRule substring ); String getSubstringName(); String getSubstringOid(); void setSubstringOid( String substrOid ); boolean isUser(); boolean isOperational(); boolean isAncestorOf( AttributeType descendant ); boolean isHR(); boolean isDescendantOf( AttributeType ancestor ); @Override String toString(); @Override AttributeType copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
AttributeType extends AbstractSchemaObject implements Cloneable { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } AttributeType( String oid ); boolean isSingleValued(); void setSingleValued( boolean singleValued ); boolean isUserModifiable(); void setUserModifiable( boolean userModifiable ); boolean isCollective(); void setCollective( boolean collective ); boolean isRelaxed(); void setRelaxed( boolean isRelaxed ); UsageEnum getUsage(); void setUsage( UsageEnum usage ); long getSyntaxLength(); void setSyntaxLength( long length ); AttributeType getSuperior(); String getSuperiorOid(); void setSuperior( AttributeType superior ); void setSuperior( String newSuperiorOid ); void setSuperiorOid( String superiorOid ); String getSuperiorName(); LdapSyntax getSyntax(); void setSyntax( LdapSyntax syntax ); String getSyntaxName(); String getSyntaxOid(); void setSyntaxOid( String syntaxOid ); MatchingRule getEquality(); void setEquality( MatchingRule equality ); String getEqualityOid(); void setEqualityOid( String equalityOid ); String getEqualityName(); MatchingRule getOrdering(); void setOrdering( MatchingRule ordering ); String getOrderingName(); String getOrderingOid(); void setOrderingOid( String orderingOid ); MatchingRule getSubstring(); void setSubstring( MatchingRule substring ); String getSubstringName(); String getSubstringOid(); void setSubstringOid( String substrOid ); boolean isUser(); boolean isOperational(); boolean isAncestorOf( AttributeType descendant ); boolean isHR(); boolean isDescendantOf( AttributeType ancestor ); @Override String toString(); @Override AttributeType copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testToString() throws Exception { String string = ditStructureRule.toString(); assertNotNull( string ); assertTrue( string.startsWith( "ditstructurerule (" ) ); assertTrue( string.contains( " NAME " ) ); assertTrue( string.contains( "\n\tDESC " ) ); assertTrue( string.contains( "\n\tFORM " ) ); assertTrue( string.contains( "\n\tSUP" ) ); }
@Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); }
DitStructureRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } }
DitStructureRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } DitStructureRule( int ruleId ); }
DitStructureRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } DitStructureRule( int ruleId ); String getForm(); void setForm( String form ); int getRuleId(); void setRuleId( int ruleId ); List<Integer> getSuperRules(); void setSuperRules( List<Integer> superRules ); void addSuperRule( Integer superRule ); @Override String getOid(); @Override String toString(); @Override DitStructureRule copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); }
DitStructureRule extends AbstractSchemaObject { @Override public String toString() { return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this ); } DitStructureRule( int ruleId ); String getForm(); void setForm( String form ); int getRuleId(); void setRuleId( int ruleId ); List<Integer> getSuperRules(); void setSuperRules( List<Integer> superRules ); void addSuperRule( Integer superRule ); @Override String getOid(); @Override String toString(); @Override DitStructureRule copy(); @Override int hashCode(); @Override boolean equals( Object o ); @Override void clear(); static final long serialVersionUID; }
@Test public void testNumericNormalizerNull() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( null, normalizer.normalize( ( String ) null ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testNumericNormalizerEmpty() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( "", normalizer.normalize( "" ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testNumericNormalizerOneSpace() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( "", normalizer.normalize( " " ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testNumericNormalizerTwoSpaces() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( "", normalizer.normalize( " " ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testNumericNormalizerNSpaces() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( "", normalizer.normalize( " " ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testInsignifiantSpacesStringOneChar() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( "1", normalizer.normalize( "1" ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testListToString() { List<String> list = new ArrayList<String>(); list.add( "elem1" ); list.add( "elem2" ); list.add( "elem3" ); assertEquals( "elem1, elem2, elem3", Strings.listToString( list ) ); }
public static String listToString( List<?> list ) { if ( ( list == null ) || list.isEmpty() ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Object elem : list ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( elem ); } return sb.toString(); }
Strings { public static String listToString( List<?> list ) { if ( ( list == null ) || list.isEmpty() ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Object elem : list ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( elem ); } return sb.toString(); } }
Strings { public static String listToString( List<?> list ) { if ( ( list == null ) || list.isEmpty() ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Object elem : list ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( elem ); } return sb.toString(); } private Strings(); }
Strings { public static String listToString( List<?> list ) { if ( ( list == null ) || list.isEmpty() ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Object elem : list ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( elem ); } return sb.toString(); } private Strings(); static String dumpBytes( byte[] buffer ); static String byteToString( byte b ); static String dumpByte( byte octet ); static char dumpHex( byte hex ); static String dumpHexPairs( byte[] buffer ); static String deepTrim( String str, boolean toLowerCase ); static String deepTrimToLower( String string ); static String deepTrim( String string ); static String trimConsecutiveToOne( String str, char ch ); static String centerTrunc( String str, int head, int tail ); static String toHexString( byte[] res ); static byte[] toByteArray( String hexString ); static String formatHtml( String source, boolean replaceNl, boolean replaceTag, boolean replaceQuote ); static boolean areEquals( String string, int index, String text ); static boolean isCharASCII( byte[] byteArray, int index, char car ); static boolean isCharASCII( char[] charArray, int index, char car ); static boolean isCharASCII( String string, int index, char car ); static String utf8ToString( byte[] bytes ); static String utf8ToString( byte[] bytes, int length ); static String utf8ToString( byte[] bytes, int start, int length ); static int areEquals( byte[] bytes, int index, String text ); static int areEquals( char[] chars, int index, String text ); static int areEquals( char[] chars, int index, String text, boolean caseSensitive ); static int areEquals( char[] chars, int index, char[] chars2 ); static int areEquals( char[] chars, int index, char[] chars2, boolean caseSensitive ); static int areEquals( byte[] bytes, int index, byte[] bytes2 ); static boolean isEmpty( String str ); static boolean isEmpty( byte[] bytes ); static String trim( String str ); static byte[] trim( byte[] bytes ); static String trimLeft( String str ); static int trimLeft( char[] chars, int pos ); static void trimLeft( String string, Position pos ); static void trimLeft( byte[] bytes, Position pos ); static int trimLeft( byte[] bytes, int pos ); static String trimRight( String str ); static String trimRight( String str, int escapedSpace ); static int trimRight( char[] chars, int pos ); static String trimRight( String string, Position pos ); static String trimRight( byte[] bytes, Position pos ); static int trimRight( byte[] bytes, int pos ); static char charAt( String string, int index ); static byte byteAt( byte[] bytes, int index ); static char charAt( char[] chars, int index ); static String asciiBytesToString( byte[] bytes ); static byte[] getBytesUtf8( String string ); static byte[] getBytesUtf8Ascii( String string ); static String getDefaultCharsetName(); static boolean equals( String str1, String str2 ); static String listToString( List<?> list ); static String setToString( Set<?> set ); static String listToString( List<?> list, String tabs ); static String mapToString( Map<?, ?> map ); static String mapToString( Map<?, ?> map, String tabs ); @Deprecated static String toLowerCase( String value ); static String toLowerCaseAscii( String value ); static String toLowerCase( byte[] value ); @Deprecated static String toUpperCase( String value ); static String toUpperCaseAscii( String value ); static String upperCase( String str ); static String lowerCase( String str ); static String lowerCaseAscii( String str ); static boolean isPrintableString( String str ); static boolean isNotEmpty( String str ); static boolean isIA5String( String str ); static boolean isValidUuid( String uuid ); static String uuidToString( byte[] bytes ); static byte[] uuidToBytes( String string ); static byte[] copy( byte[] value ); static String getString( final byte[] data, int offset, int length, String charset ); static String getString( final byte[] data, int offset, int length, Charset charset ); static String getString( final byte[] data, String charset ); static String getString( final byte[] data, Charset charset ); static String getUUID( long value ); static int parseInt( String value ); static int compare( byte[] b1, byte[] b2 ); }
Strings { public static String listToString( List<?> list ) { if ( ( list == null ) || list.isEmpty() ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Object elem : list ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( elem ); } return sb.toString(); } private Strings(); static String dumpBytes( byte[] buffer ); static String byteToString( byte b ); static String dumpByte( byte octet ); static char dumpHex( byte hex ); static String dumpHexPairs( byte[] buffer ); static String deepTrim( String str, boolean toLowerCase ); static String deepTrimToLower( String string ); static String deepTrim( String string ); static String trimConsecutiveToOne( String str, char ch ); static String centerTrunc( String str, int head, int tail ); static String toHexString( byte[] res ); static byte[] toByteArray( String hexString ); static String formatHtml( String source, boolean replaceNl, boolean replaceTag, boolean replaceQuote ); static boolean areEquals( String string, int index, String text ); static boolean isCharASCII( byte[] byteArray, int index, char car ); static boolean isCharASCII( char[] charArray, int index, char car ); static boolean isCharASCII( String string, int index, char car ); static String utf8ToString( byte[] bytes ); static String utf8ToString( byte[] bytes, int length ); static String utf8ToString( byte[] bytes, int start, int length ); static int areEquals( byte[] bytes, int index, String text ); static int areEquals( char[] chars, int index, String text ); static int areEquals( char[] chars, int index, String text, boolean caseSensitive ); static int areEquals( char[] chars, int index, char[] chars2 ); static int areEquals( char[] chars, int index, char[] chars2, boolean caseSensitive ); static int areEquals( byte[] bytes, int index, byte[] bytes2 ); static boolean isEmpty( String str ); static boolean isEmpty( byte[] bytes ); static String trim( String str ); static byte[] trim( byte[] bytes ); static String trimLeft( String str ); static int trimLeft( char[] chars, int pos ); static void trimLeft( String string, Position pos ); static void trimLeft( byte[] bytes, Position pos ); static int trimLeft( byte[] bytes, int pos ); static String trimRight( String str ); static String trimRight( String str, int escapedSpace ); static int trimRight( char[] chars, int pos ); static String trimRight( String string, Position pos ); static String trimRight( byte[] bytes, Position pos ); static int trimRight( byte[] bytes, int pos ); static char charAt( String string, int index ); static byte byteAt( byte[] bytes, int index ); static char charAt( char[] chars, int index ); static String asciiBytesToString( byte[] bytes ); static byte[] getBytesUtf8( String string ); static byte[] getBytesUtf8Ascii( String string ); static String getDefaultCharsetName(); static boolean equals( String str1, String str2 ); static String listToString( List<?> list ); static String setToString( Set<?> set ); static String listToString( List<?> list, String tabs ); static String mapToString( Map<?, ?> map ); static String mapToString( Map<?, ?> map, String tabs ); @Deprecated static String toLowerCase( String value ); static String toLowerCaseAscii( String value ); static String toLowerCase( byte[] value ); @Deprecated static String toUpperCase( String value ); static String toUpperCaseAscii( String value ); static String upperCase( String str ); static String lowerCase( String str ); static String lowerCaseAscii( String str ); static boolean isPrintableString( String str ); static boolean isNotEmpty( String str ); static boolean isIA5String( String str ); static boolean isValidUuid( String uuid ); static String uuidToString( byte[] bytes ); static byte[] uuidToBytes( String string ); static byte[] copy( byte[] value ); static String getString( final byte[] data, int offset, int length, String charset ); static String getString( final byte[] data, int offset, int length, Charset charset ); static String getString( final byte[] data, String charset ); static String getString( final byte[] data, Charset charset ); static String getUUID( long value ); static int parseInt( String value ); static int compare( byte[] b1, byte[] b2 ); static final byte[] HEX_CHAR; static final byte[] EMPTY_BYTES; static final String EMPTY_STRING; static final String[] EMPTY_STRING_ARRAY; }
@Test public void testInsignifiantSpacesStringTwoChars() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( "11", normalizer.normalize( "11" ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testInsignifiantSpacesStringNChars() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( "123456", normalizer.normalize( "123456" ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testInsignifiantNumericCharsSpaces() throws LdapException { Normalizer normalizer = new NumericNormalizer(); assertEquals( "1", normalizer.normalize( " 1" ) ); assertEquals( "1", normalizer.normalize( "1 " ) ); assertEquals( "1", normalizer.normalize( " 1 " ) ); assertEquals( "11", normalizer.normalize( "1 1" ) ); assertEquals( "11", normalizer.normalize( " 1 1" ) ); assertEquals( "11", normalizer.normalize( "1 1 " ) ); assertEquals( "11", normalizer.normalize( "1 1" ) ); assertEquals( "11", normalizer.normalize( " 1 1 " ) ); assertEquals( "123456789", normalizer.normalize( " 123 456 789 " ) ); }
public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
NumericNormalizer extends Normalizer implements PreparedNormalizer { public Value normalize( Value value ) throws LdapException { String normalized = normalize( value.getString() ); return new Value( normalized ); } NumericNormalizer(); Value normalize( Value value ); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testDeepTrimNormalizerNull() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); assertEquals( null, normalizer.normalize( ( String ) null ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testDeepTrimNormalizerEmpty() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); assertEquals( " ", normalizer.normalize( "" ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testDeepTrimNormalizerOneSpace() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); assertEquals( " ", normalizer.normalize( " " ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testDeepTrimNormalizerTwoSpaces() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); assertEquals( " ", normalizer.normalize( " " ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testDeepTrimNormalizerNSpaces() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); assertEquals( " ", normalizer.normalize( " " ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testInsignifiantSpacesStringOneChar() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); assertEquals( " a ", normalizer.normalize( "a" ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testInsignifiantSpacesStringTwoChars() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); assertEquals( " aa ", normalizer.normalize( "aa" ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testMapToString() { class Value { String name; int val; public Value( String name, int val ) { this.name = name; this.val = val; } public String toString() { return "[" + name + ", " + val + "]"; } } Map<String, Value> map = new HashMap<String, Value>(); map.put( "elem1", new Value( "name1", 1 ) ); map.put( "elem2", new Value( "name2", 2 ) ); map.put( "elem3", new Value( "name3", 3 ) ); String result = Strings.mapToString( map ); boolean res = "elem1 = '[name1, 1]', elem2 = '[name2, 2]', elem3 = '[name3, 3]'".equals( result ) || "elem1 = '[name1, 1]', elem3 = '[name3, 3]', elem2 = '[name2, 2]'".equals( result ) || "elem2 = '[name2, 2]', elem1 = '[name1, 1]', elem3 = '[name3, 3]'".equals( result ) || "elem2 = '[name2, 2]', elem3 = '[name3, 3]', elem1 = '[name1, 1]'".equals( result ) || "elem3 = '[name3, 3]', elem1 = '[name1, 1]', elem2 = '[name2, 2]'".equals( result ) || "elem3 = '[name3, 3]', elem2 = '[name2, 2]', elem1 = '[name1, 1]'".equals( result ); assertTrue( res ); }
public static String mapToString( Map<?, ?> map ) { if ( ( map == null ) || ( map.size() == 0 ) ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Map.Entry<?, ?> entry : map.entrySet() ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( entry.getKey() ); sb.append( " = '" ).append( entry.getValue() ).append( "'" ); } return sb.toString(); }
Strings { public static String mapToString( Map<?, ?> map ) { if ( ( map == null ) || ( map.size() == 0 ) ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Map.Entry<?, ?> entry : map.entrySet() ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( entry.getKey() ); sb.append( " = '" ).append( entry.getValue() ).append( "'" ); } return sb.toString(); } }
Strings { public static String mapToString( Map<?, ?> map ) { if ( ( map == null ) || ( map.size() == 0 ) ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Map.Entry<?, ?> entry : map.entrySet() ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( entry.getKey() ); sb.append( " = '" ).append( entry.getValue() ).append( "'" ); } return sb.toString(); } private Strings(); }
Strings { public static String mapToString( Map<?, ?> map ) { if ( ( map == null ) || ( map.size() == 0 ) ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Map.Entry<?, ?> entry : map.entrySet() ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( entry.getKey() ); sb.append( " = '" ).append( entry.getValue() ).append( "'" ); } return sb.toString(); } private Strings(); static String dumpBytes( byte[] buffer ); static String byteToString( byte b ); static String dumpByte( byte octet ); static char dumpHex( byte hex ); static String dumpHexPairs( byte[] buffer ); static String deepTrim( String str, boolean toLowerCase ); static String deepTrimToLower( String string ); static String deepTrim( String string ); static String trimConsecutiveToOne( String str, char ch ); static String centerTrunc( String str, int head, int tail ); static String toHexString( byte[] res ); static byte[] toByteArray( String hexString ); static String formatHtml( String source, boolean replaceNl, boolean replaceTag, boolean replaceQuote ); static boolean areEquals( String string, int index, String text ); static boolean isCharASCII( byte[] byteArray, int index, char car ); static boolean isCharASCII( char[] charArray, int index, char car ); static boolean isCharASCII( String string, int index, char car ); static String utf8ToString( byte[] bytes ); static String utf8ToString( byte[] bytes, int length ); static String utf8ToString( byte[] bytes, int start, int length ); static int areEquals( byte[] bytes, int index, String text ); static int areEquals( char[] chars, int index, String text ); static int areEquals( char[] chars, int index, String text, boolean caseSensitive ); static int areEquals( char[] chars, int index, char[] chars2 ); static int areEquals( char[] chars, int index, char[] chars2, boolean caseSensitive ); static int areEquals( byte[] bytes, int index, byte[] bytes2 ); static boolean isEmpty( String str ); static boolean isEmpty( byte[] bytes ); static String trim( String str ); static byte[] trim( byte[] bytes ); static String trimLeft( String str ); static int trimLeft( char[] chars, int pos ); static void trimLeft( String string, Position pos ); static void trimLeft( byte[] bytes, Position pos ); static int trimLeft( byte[] bytes, int pos ); static String trimRight( String str ); static String trimRight( String str, int escapedSpace ); static int trimRight( char[] chars, int pos ); static String trimRight( String string, Position pos ); static String trimRight( byte[] bytes, Position pos ); static int trimRight( byte[] bytes, int pos ); static char charAt( String string, int index ); static byte byteAt( byte[] bytes, int index ); static char charAt( char[] chars, int index ); static String asciiBytesToString( byte[] bytes ); static byte[] getBytesUtf8( String string ); static byte[] getBytesUtf8Ascii( String string ); static String getDefaultCharsetName(); static boolean equals( String str1, String str2 ); static String listToString( List<?> list ); static String setToString( Set<?> set ); static String listToString( List<?> list, String tabs ); static String mapToString( Map<?, ?> map ); static String mapToString( Map<?, ?> map, String tabs ); @Deprecated static String toLowerCase( String value ); static String toLowerCaseAscii( String value ); static String toLowerCase( byte[] value ); @Deprecated static String toUpperCase( String value ); static String toUpperCaseAscii( String value ); static String upperCase( String str ); static String lowerCase( String str ); static String lowerCaseAscii( String str ); static boolean isPrintableString( String str ); static boolean isNotEmpty( String str ); static boolean isIA5String( String str ); static boolean isValidUuid( String uuid ); static String uuidToString( byte[] bytes ); static byte[] uuidToBytes( String string ); static byte[] copy( byte[] value ); static String getString( final byte[] data, int offset, int length, String charset ); static String getString( final byte[] data, int offset, int length, Charset charset ); static String getString( final byte[] data, String charset ); static String getString( final byte[] data, Charset charset ); static String getUUID( long value ); static int parseInt( String value ); static int compare( byte[] b1, byte[] b2 ); }
Strings { public static String mapToString( Map<?, ?> map ) { if ( ( map == null ) || ( map.size() == 0 ) ) { return ""; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Map.Entry<?, ?> entry : map.entrySet() ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( entry.getKey() ); sb.append( " = '" ).append( entry.getValue() ).append( "'" ); } return sb.toString(); } private Strings(); static String dumpBytes( byte[] buffer ); static String byteToString( byte b ); static String dumpByte( byte octet ); static char dumpHex( byte hex ); static String dumpHexPairs( byte[] buffer ); static String deepTrim( String str, boolean toLowerCase ); static String deepTrimToLower( String string ); static String deepTrim( String string ); static String trimConsecutiveToOne( String str, char ch ); static String centerTrunc( String str, int head, int tail ); static String toHexString( byte[] res ); static byte[] toByteArray( String hexString ); static String formatHtml( String source, boolean replaceNl, boolean replaceTag, boolean replaceQuote ); static boolean areEquals( String string, int index, String text ); static boolean isCharASCII( byte[] byteArray, int index, char car ); static boolean isCharASCII( char[] charArray, int index, char car ); static boolean isCharASCII( String string, int index, char car ); static String utf8ToString( byte[] bytes ); static String utf8ToString( byte[] bytes, int length ); static String utf8ToString( byte[] bytes, int start, int length ); static int areEquals( byte[] bytes, int index, String text ); static int areEquals( char[] chars, int index, String text ); static int areEquals( char[] chars, int index, String text, boolean caseSensitive ); static int areEquals( char[] chars, int index, char[] chars2 ); static int areEquals( char[] chars, int index, char[] chars2, boolean caseSensitive ); static int areEquals( byte[] bytes, int index, byte[] bytes2 ); static boolean isEmpty( String str ); static boolean isEmpty( byte[] bytes ); static String trim( String str ); static byte[] trim( byte[] bytes ); static String trimLeft( String str ); static int trimLeft( char[] chars, int pos ); static void trimLeft( String string, Position pos ); static void trimLeft( byte[] bytes, Position pos ); static int trimLeft( byte[] bytes, int pos ); static String trimRight( String str ); static String trimRight( String str, int escapedSpace ); static int trimRight( char[] chars, int pos ); static String trimRight( String string, Position pos ); static String trimRight( byte[] bytes, Position pos ); static int trimRight( byte[] bytes, int pos ); static char charAt( String string, int index ); static byte byteAt( byte[] bytes, int index ); static char charAt( char[] chars, int index ); static String asciiBytesToString( byte[] bytes ); static byte[] getBytesUtf8( String string ); static byte[] getBytesUtf8Ascii( String string ); static String getDefaultCharsetName(); static boolean equals( String str1, String str2 ); static String listToString( List<?> list ); static String setToString( Set<?> set ); static String listToString( List<?> list, String tabs ); static String mapToString( Map<?, ?> map ); static String mapToString( Map<?, ?> map, String tabs ); @Deprecated static String toLowerCase( String value ); static String toLowerCaseAscii( String value ); static String toLowerCase( byte[] value ); @Deprecated static String toUpperCase( String value ); static String toUpperCaseAscii( String value ); static String upperCase( String str ); static String lowerCase( String str ); static String lowerCaseAscii( String str ); static boolean isPrintableString( String str ); static boolean isNotEmpty( String str ); static boolean isIA5String( String str ); static boolean isValidUuid( String uuid ); static String uuidToString( byte[] bytes ); static byte[] uuidToBytes( String string ); static byte[] copy( byte[] value ); static String getString( final byte[] data, int offset, int length, String charset ); static String getString( final byte[] data, int offset, int length, Charset charset ); static String getString( final byte[] data, String charset ); static String getString( final byte[] data, Charset charset ); static String getUUID( long value ); static int parseInt( String value ); static int compare( byte[] b1, byte[] b2 ); static final byte[] HEX_CHAR; static final byte[] EMPTY_BYTES; static final String EMPTY_STRING; static final String[] EMPTY_STRING_ARRAY; }
@Test public void testInsignifiantSpacesStringNChars() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); assertEquals( " aaaaa ", normalizer.normalize( "aaaaa" ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
@Test public void testInsignifiantSpacesStringOneCombining() throws LdapException { Normalizer normalizer = new DeepTrimNormalizer( "1.1.1" ); char[] chars = new char[] { ' ', 0x0310 }; char[] expected = new char[] { ' ', 0x0310, ' ' }; String expectedStr = new String( expected ); String charsStr = new String( chars ); assertEquals( expectedStr, normalizer.normalize( charsStr ) ); }
@Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }
DeepTrimNormalizer extends Normalizer implements PreparedNormalizer { @Override public String normalize( String value ) throws LdapException { return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE ); } DeepTrimNormalizer( String oid ); DeepTrimNormalizer(); @Override String normalize( String value ); @Override String normalize( String value, PrepareString.AssertionType assertionType ); }