< prev index next >

test/jdk/javax/naming/ldap/LdapName/NameTests.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 40,87 **** public static void main(String args[]) throws Exception { String[] rdnStr = new String[] {"one=voilet"}; ! ArrayList rdnList = new ArrayList(); for (int i = 0; i < rdnStr.length; i++) { rdnList.add(i, new Rdn(rdnStr[i])); } LdapName dn = new LdapName(rdnList); ! Collection rdns = dn.getRdns(); System.out.println("size is :" + dn.size()); System.out.println("isEmpty :" + dn.isEmpty()); System.out.println("************Printing as Rdns*********"); ! Iterator iter = rdns.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); } System.out.println(); System.out.println("************Printing the Enumeration*********"); ! Enumeration dnEnum = dn.getAll(); while (dnEnum.hasMoreElements()) { System.out.println(dnEnum.nextElement()); } // addAll tests System.out.println(); LdapName nameSuffix = new LdapName("two=Indigo"); System.out.println("addAll():" + dn.addAll(nameSuffix)); ! ArrayList list = new ArrayList(); list.add(new Rdn("five=Yellow")); System.out.println("Rdn- addAll():" + dn.addAll(list)); nameSuffix = new LdapName("three=Blue"); System.out.println(); System.out.println("addAll at pos = 2"); System.out.println("addAll():" + dn.addAll(2, nameSuffix)); ! list = new ArrayList(); list.add(new Rdn("four=Green")); System.out.println(); System.out.println("addAll at pos = 3"); System.out.println("Rdn- addAll():" + dn.addAll(3, list)); --- 40,87 ---- public static void main(String args[]) throws Exception { String[] rdnStr = new String[] {"one=voilet"}; ! ArrayList<Rdn> rdnList = new ArrayList<>(); for (int i = 0; i < rdnStr.length; i++) { rdnList.add(i, new Rdn(rdnStr[i])); } LdapName dn = new LdapName(rdnList); ! Collection<Rdn> rdns = dn.getRdns(); System.out.println("size is :" + dn.size()); System.out.println("isEmpty :" + dn.isEmpty()); System.out.println("************Printing as Rdns*********"); ! Iterator<Rdn> iter = rdns.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); } System.out.println(); System.out.println("************Printing the Enumeration*********"); ! Enumeration<String> dnEnum = dn.getAll(); while (dnEnum.hasMoreElements()) { System.out.println(dnEnum.nextElement()); } // addAll tests System.out.println(); LdapName nameSuffix = new LdapName("two=Indigo"); System.out.println("addAll():" + dn.addAll(nameSuffix)); ! ArrayList<Rdn> list = new ArrayList<>(); list.add(new Rdn("five=Yellow")); System.out.println("Rdn- addAll():" + dn.addAll(list)); nameSuffix = new LdapName("three=Blue"); System.out.println(); System.out.println("addAll at pos = 2"); System.out.println("addAll():" + dn.addAll(2, nameSuffix)); ! list = new ArrayList<>(); list.add(new Rdn("four=Green")); System.out.println(); System.out.println("addAll at pos = 3"); System.out.println("Rdn- addAll():" + dn.addAll(3, list));
*** 144,159 **** System.out.println("compositeName- startsWith(" + rdnStr[0] + "): " + dn.startsWith( new CompositeName(rdnStr[0]))); ! java.util.List prefixList = (dn.getRdns()).subList(0, size /2); System.out.println("Rdn - startsWith(" + prefixList + "):" + dn.startsWith(prefixList)); System.out.println("Rdn - startsWith() - empty RDN list:" + ! dn.startsWith(new ArrayList())); System.out.println(); System.out.println("endsWith(" + rdnStr[0] + "):" + dn.endsWith(new LdapName(rdnStr[0]))); --- 144,159 ---- System.out.println("compositeName- startsWith(" + rdnStr[0] + "): " + dn.startsWith( new CompositeName(rdnStr[0]))); ! List<Rdn> prefixList = (dn.getRdns()).subList(0, size /2); System.out.println("Rdn - startsWith(" + prefixList + "):" + dn.startsWith(prefixList)); System.out.println("Rdn - startsWith() - empty RDN list:" + ! dn.startsWith(new ArrayList<>())); System.out.println(); System.out.println("endsWith(" + rdnStr[0] + "):" + dn.endsWith(new LdapName(rdnStr[0])));
*** 165,175 **** System.out.println("Rdn - endsWith(" + prefixList + "):" + dn.endsWith(prefixList)); System.out.println("Rdn - endsWith() empty RDN list:" + ! dn.endsWith(new ArrayList())); // test clone System.out.println(); System.out.println("cloned name:" + dn.clone()); --- 165,175 ---- System.out.println("Rdn - endsWith(" + prefixList + "):" + dn.endsWith(prefixList)); System.out.println("Rdn - endsWith() empty RDN list:" + ! dn.endsWith(new ArrayList<>())); // test clone System.out.println(); System.out.println("cloned name:" + dn.clone());
< prev index next >