List of usage examples for java.lang String CASE_INSENSITIVE_ORDER
Comparator CASE_INSENSITIVE_ORDER
To view the source code for java.lang String CASE_INSENSITIVE_ORDER.
Click Source Link
From source file:com.microsoft.tfs.core.clients.versioncontrol.internal.localworkspace.LocalDataAccessLayer.java
private static void ProcessProjectRenames(final Workspace workspace, final WebServiceLayer webServiceLayer, final List<KeyValuePair<String, String>> serverRenames, final int newProjectRevisionId) { log.info("Process project renames"); //$NON-NLS-1$ if (serverRenames.isEmpty()) { log.warn("Expected to receive at least one rename instruction, but none have bee received"); //$NON-NLS-1$ Check.isTrue(false, "Expected to receive at least one rename instruction"); //$NON-NLS-1$ // Acknowledgment outside of a transaction; no work to do webServiceLayer.promotePendingWorkspaceMappings(workspace.getName(), workspace.getOwnerName(), newProjectRevisionId);/*from w w w . j a va 2 s . co m*/ return; } final LocalWorkspaceTransaction transaction = new LocalWorkspaceTransaction(workspace); try { transaction.execute(new AllTablesTransaction() { @Override public void invoke(final LocalWorkspaceProperties wp, final WorkspaceVersionTable lv, final LocalPendingChangesTable pc) { final Set<String> currentProjectNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); currentProjectNames.addAll(getCurrentProjectNames(wp, lv, pc)); final Set<String> newProjectNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); newProjectNames.addAll(currentProjectNames); /* * 1. Form the set of new project names by transforming the * current project names */ { for (final KeyValuePair<String, String> rename : serverRenames) { // Remove the old project names newProjectNames.remove(rename.getKey()); } for (final KeyValuePair<String, String> rename : serverRenames) { // Add the new project name newProjectNames.add(rename.getValue()); } } /* * 2. If there are any incoming project renames where the * target name is currently occupied and is not being * cleared, then we need to mock an additional rename * operation that clears that name, or we will not be able * to succeed. */ final Map<String, String> allRenames = new TreeMap<String, String>( String.CASE_INSENSITIVE_ORDER); { final Set<String> renamesFrom = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); for (final KeyValuePair<String, String> rename : serverRenames) { renamesFrom.add(rename.getKey()); } final List<KeyValuePair<String, String>> injectedRenames = new ArrayList<KeyValuePair<String, String>>(); for (final KeyValuePair<String, String> rename : serverRenames) { final String renameTo = rename.getValue(); if (currentProjectNames.contains(renameTo) && !renamesFrom.contains(renameTo)) { // We need to insert a mock rename from // newProjectName to a vacant name whose name // has been randomly generated. // The randomly generated name needs to be // vacant and of equal or lesser length to // newProjectName. final String replacementName = createProjectName(renameTo.length(), newProjectNames); injectedRenames.add(new KeyValuePair<String, String>(renameTo, replacementName)); newProjectNames.add(replacementName); } } for (final KeyValuePair<String, String> rename : serverRenames) { allRenames.put(rename.getKey(), rename.getValue()); } for (final KeyValuePair<String, String> rename : injectedRenames) { allRenames.put(rename.getKey(), rename.getValue()); } } // Working folders { final List<WorkingFolder> newWorkingFolders = new ArrayList<WorkingFolder>(); for (final WorkingFolder wf : wp.getWorkingFolders()) { newWorkingFolders.add(new WorkingFolder(mapServerItem(wf.getServerItem(), allRenames), wf.getLocalItem(), wf.getType(), wf.getDepth())); } wp.setWorkingFolders( newWorkingFolders.toArray(new WorkingFolder[newWorkingFolders.size()])); workspace.getWebServiceObject().setFolders((_WorkingFolder[]) WrapperUtils .unwrap(_WorkingFolder.class, wp.getWorkingFolders())); } // Local version entries lv.renameTeamProjects(new ServerItemMapper() { @Override public String map(final String itemPath) { return mapServerItem(itemPath, allRenames); } }); // Pending changes pc.renameTeamProjects(new ServerItemMapper() { @Override public String map(final String itemPath) { return mapServerItem(itemPath, allRenames); } }); // Save the new project revision ID. We will acknowledge the // completion of these renames on the next reconcile. wp.setNewProjectRevisionId(newProjectRevisionId); } }); } finally { try { transaction.close(); } catch (final IOException e) { throw new VersionControlException(e); } } }
From source file:sg.ncl.MainController.java
/** * Allows admins to://from w w w . j a v a 2 s . com * view reservations * reserve nodes * release nodes */ @GetMapping("/admin/nodesReservation") public String adminNodesReservation( @ModelAttribute("reservationStatusForm") ReservationStatusForm reservationStatusForm, Model model, HttpSession session) { if (!validateIfAdmin(session)) { return NO_PERMISSION_PAGE; } List<Team2> allTeams = new ArrayList<>(getTeamMap().values()); allTeams.sort(Comparator.comparing(Team2::getName, String.CASE_INSENSITIVE_ORDER)); model.addAttribute(ALL_TEAMS, allTeams); model.addAttribute(RESERVATION_STATUS_FORM, reservationStatusForm); return "node_reservation"; }
From source file:sg.ncl.MainController.java
@PostMapping("/admin/nodesReservation") public String adminNodesReservation( @ModelAttribute("reservationStatusForm") ReservationStatusForm reservationStatusForm, BindingResult bindingResult, RedirectAttributes redirectAttributes, Model model) { List<Team2> allTeams = new ArrayList<>(getTeamMap().values()); allTeams.sort(Comparator.comparing(Team2::getName, String.CASE_INSENSITIVE_ORDER)); model.addAttribute(ALL_TEAMS, allTeams); // sanitization if (bindingResult.hasErrors()) { model.addAttribute(ALL_TEAMS, allTeams); model.addAttribute(RESERVATION_STATUS_FORM, reservationStatusForm); model.addAttribute(STATUS, NODES_RESERVATION_FAIL); model.addAttribute(MESSAGE, "form errors"); return "node_reservation"; }/*from www. jav a 2 s.c om*/ switch (reservationStatusForm.getAction()) { case "release": releaseNodes(reservationStatusForm, redirectAttributes); break; case "reserve": reserveNodes(reservationStatusForm, redirectAttributes); break; case "check": checkReservation(reservationStatusForm, redirectAttributes); break; default: // error redirectAttributes.addFlashAttribute(STATUS, NODES_RESERVATION_FAIL); redirectAttributes.addFlashAttribute(MESSAGE, ERR_SERVER_OVERLOAD); break; } redirectAttributes.addFlashAttribute(RESERVATION_STATUS_FORM, reservationStatusForm); redirectAttributes.addFlashAttribute(ALL_TEAMS, allTeams); return "redirect:/admin/nodesReservation"; }
From source file:com.microsoft.tfs.core.clients.versioncontrol.VersionControlClient.java
public FileType queryCachedFileType(final String extension) { synchronized (cachedFileTypesLock) { if (cachedFileTypes == null) { cachedFileTypes = new TreeMap<String, FileType>(String.CASE_INSENSITIVE_ORDER); final FileType[] serverFileTypes = getFileTypes(); for (final FileType serverFileType : serverFileTypes) { for (final String fileTypeExtension : serverFileType.getExtensions()) { cachedFileTypes.put(fileTypeExtension, serverFileType); }/* w w w . j a v a 2 s . c o m*/ } } return cachedFileTypes.get(extension); } }
From source file:com.zimbra.cs.account.ldap.LdapProvisioning.java
private void removeDistributionListMembers(DistributionList dl, String[] members) throws ServiceException { Set<String> curMembers = dl.getMultiAttrSet(Provisioning.A_zimbraMailForwardingAddress); // bug 46219, need a case insentitive Set Set<String> existing = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); existing.addAll(curMembers);// w w w.j av a 2 s . c om Set<String> mods = new HashSet<String>(); HashSet<String> failed = new HashSet<String>(); for (int i = 0; i < members.length; i++) { String memberName = members[i].toLowerCase(); memberName = IDNUtil.toAsciiEmail(memberName); if (memberName.length() == 0) { throw ServiceException.INVALID_REQUEST("invalid member email address: " + memberName, null); } // We do not do any further validation of the remove address for // syntax - removes should be liberal so any bad entries added by // some other means can be removed // // members[] can contain: // - the primary address of an account or another DL // - an alias of an account or another DL // - junk (allAddrs will be returned as null) AddrsOfEntry addrsOfEntry = getAllAddressesOfEntry(memberName); List<String> allAddrs = addrsOfEntry.getAll(); if (mods.contains(memberName)) { // already been added in mods (is the primary or alias of previous entries in members[]) } else if (existing.contains(memberName)) { if (!allAddrs.isEmpty()) { mods.addAll(allAddrs); } else { mods.add(memberName); // just get rid of it regardless what it is } } else { boolean inList = false; if (allAddrs.size() > 0) { // go through all addresses of the entry see if any is on the DL for (String addr : allAddrs) { if (!inList) { break; } if (existing.contains(addr)) { mods.addAll(allAddrs); inList = true; } } } if (!inList) { failed.add(memberName); } } // clear the DL cache on accounts/dl String primary = addrsOfEntry.getPrimary(); if (primary != null) { if (addrsOfEntry.isAccount()) { Account acct = getFromCache(AccountBy.name, primary); if (acct != null) clearUpwardMembershipCache(acct); } else { removeGroupFromCache(Key.DistributionListBy.name, primary); } } } if (!failed.isEmpty()) { StringBuilder sb = new StringBuilder(); Iterator<String> iter = failed.iterator(); while (true) { sb.append(iter.next()); if (!iter.hasNext()) break; sb.append(","); } throw AccountServiceException.NO_SUCH_MEMBER(dl.getName(), sb.toString()); } if (mods.isEmpty()) { throw ServiceException.INVALID_REQUEST("empty remove set", null); } PermissionCache.invalidateCache(); cleanGroupMembersCache(dl); Map<String, String[]> modmap = new HashMap<String, String[]>(); modmap.put("-" + Provisioning.A_zimbraMailForwardingAddress, mods.toArray(new String[0])); modifyAttrs(dl, modmap); }
From source file:org.apache.directory.fortress.core.impl.UserTestData.java
/** * @param szInput/* w w w . ja v a 2s.c om*/ * @return */ public static Set<String> getAssignedRoles(String[] szInput) { Set<String> elements = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); getElements(elements, szInput, ASSGND_ROLES_COL); return elements; }
From source file:org.apache.directory.fortress.core.impl.UserTestData.java
/** * @param szInput/*w w w .jav a 2 s. co m*/ * @return */ public static Collection<String> getAuthorizedRoles(String[] szInput) { Set<String> elements = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); getElements(elements, szInput, AUTHZ_ROLES_COL); return elements; }
From source file:com.virtusa.isq.vtaf.runtime.SeleniumTestBase.java
private void sort(ArrayList<String> l, String objectName, String type, String pattern, String order, boolean stopOnFailure, final Object[] customError) { for (int i = 0; i < l.size(); i++) { // System.out.println(l.get(i)); if (l.get(i).equals("")) { l.set(i, " "); }//w w w .ja v a 2s. co m } System.out.println("Unsorted ArrayList in Java : " + l); System.out.println("Order :" + order); System.out.println("Pattern :" + pattern); System.out.println("Type :" + type); List<String> listOrg = new ArrayList<String>(); for (int i = 0; i < l.size(); i++) { listOrg.add(l.get(i).toString()); } ////////////////////////////////////////////////////////////////////////// if (type.equals("string")) { if ("ascending".equals(order) && "alphabetically".equals(pattern)) { //System.out.println("list"+l); //Collections.sort(l, ALPHA_ORDER); Collections.sort(l, String.CASE_INSENSITIVE_ORDER); //System.out.println("Ordered list"+l); if (l.equals(listOrg)) { // System.out.println("In ascending Order alphabetically" ); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { // System.out.println("Not in ascending Order alphabetically" ); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if ("descending".equals(order) && "alphabetically".equals(pattern)) { // Collections.sort(l, ALPHA_ORDER); Collections.sort(l, String.CASE_INSENSITIVE_ORDER); //System.out.println("Ordered list"+l); List<String> listDes = new ArrayList<String>(); for (int i = l.size() - 1; i >= 0; i--) { // System.out.println(l.get(i).toString()); //String s = (String) l.get( i ) ; listDes.add(l.get(i).toString()); } //System.out.println("Ordered list"+listDes); if (listDes.equals(listOrg)) { //System.out.println("In descending Order alphabetically" ); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { //System.out.println("Not in descending Order alphabetically" ); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if ("ascending".equals(order) && "1Aa".equals(pattern)) { Collections.sort(l, DiffSort.diffNaturalOrder1Aa); //Collections.sort(l); //System.out.println("Ordered list"+l); if (l.equals(listOrg)) { //System.out.println("In Ascending Order 1Aa" ); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { //System.out.println("Not in Ascending Order 1Aa" ); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if ("descending".equals(order) && "1Aa".equals(pattern)) { Collections.sort(l, DiffSort.diffNaturalOrder1Aa); List<String> listDes = new ArrayList<String>(); for (int i = l.size() - 1; i >= 0; i--) { // System.out.println(l.get(i).toString()); //String s = (String) l.get( i ) ; listDes.add(l.get(i).toString()); } //System.out.println("Ordered list"+listDes); if (listDes.equals(listOrg)) { //System.out.println("In Descending Order 1Aa" ); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { //System.out.println("Not in Descending Order 1Aa" ); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if ("ascending".equals(order) && "Aa1".equals(pattern)) { Collections.sort(l, DiffSort.diffNaturalOrderAa1); //System.out.println("Ordered list"+l); if (l.equals(listOrg)) { //System.out.println("In Ascending Order Aa1" ); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { //System.out.println("Not in Ascending Order Aa1" ); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if ("descending".equals(order) && "Aa1".equals(pattern)) { Collections.sort(l, DiffSort.diffNaturalOrderAa1); List<String> listDes = new ArrayList<String>(); for (int i = l.size() - 1; i >= 0; i--) { // System.out.println(l.get(i).toString()); //String s = (String) l.get( i ) ; listDes.add(l.get(i).toString()); } //System.out.println("Ordered list"+listDes); if (listDes.equals(listOrg)) { //System.out.println("In Descending Order Aa1" ); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { // System.out.println("Not in Descending Order Aa1" ); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if ("ascending".equals(order) && "aA1".equals(pattern)) { Collections.sort(l, DiffSort.diffNaturalOrderaA1); //System.out.println("Ordered list"+l); if (l.equals(listOrg)) { // System.out.println("In Ascending Order aA1" ); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { // System.out.println("Not in Ascending Order aA1" ); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if ("descending".equals(order) && "aA1".equals(pattern)) { Collections.sort(l, DiffSort.diffNaturalOrderaA1); List<String> listDes = new ArrayList<String>(); for (int i = l.size() - 1; i >= 0; i--) { // System.out.println(l.get(i).toString()); //String s = (String) l.get( i ) ; listDes.add(l.get(i).toString()); } //System.out.println("Ordered list"+listDes); if (listDes.equals(listOrg)) { // System.out.println("In Descending Order aA1" ); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { //System.out.println("Not in Descending Order aA1" ); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else { if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } ///////////////////////////////////////////////////////////////////////////////////////// } else if (type.equals("numeric")) { List<Double> DoublelistOrg = new ArrayList<Double>(); List<Double> DoublelistTemp = new ArrayList<Double>(); try { for (int i = 0; i < l.size(); i++) { // System.out.println(l.get(i)); Rs String temp = l.get(i).replace(",", ""); temp = temp.replace("", ""); temp = temp.replace("Rs", ""); temp = temp.replace("$", ""); temp = temp.replace("", ""); // System.out.println(temp); double value = Double.parseDouble(temp); DoublelistOrg.add(value); DoublelistTemp.add(value); } } catch (Exception e) { // e.printStackTrace(); reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + type + ") not match"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + type + ") not match"); } // System.out.println(DoublelistOrg); if (order.equals("ascending")) { Collections.sort(DoublelistTemp); if (DoublelistTemp.equals(DoublelistOrg)) { // System.out.println("ascending"); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { //System.out.println("Not ascending"); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if (order.equals("descending")) { Collections.sort(DoublelistTemp); Collections.reverse(DoublelistTemp); if (DoublelistTemp.equals(DoublelistOrg)) { // System.out.println("descending"); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { // System.out.println("Not descending"); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + order + ") not match"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + order + ") not match"); } } else if (type.equals("date")) { List<Date> datelistOrg = new ArrayList<Date>(); List<Date> datelistTemp = new ArrayList<Date>(); try { for (int i = 0; i < l.size(); i++) { // System.out.println(l.get(i)); Rs SimpleDateFormat formatter = new SimpleDateFormat(pattern); String tempDate = l.get(i); // System.out.println(l.get(i)); Date date = formatter.parse(tempDate); // System.out.println(date); //System.out.println(formatter.format(date)); datelistOrg.add(date); datelistTemp.add(date); } } catch (Exception e) { // e.printStackTrace(); reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + type + ") not match"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + type + ") not match"); } //System.out.println( datelistOrg); if (order.equals("ascending")) { Collections.sort(datelistTemp); if (datelistTemp.equals(datelistOrg)) { // System.out.println("ascending"); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { //System.out.println("Not ascending"); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else if (order.equals("descending")) { Collections.sort(datelistTemp); Collections.reverse(datelistTemp); if (datelistTemp.equals(datelistOrg)) { // System.out.println("descending"); reportresult(true, "CHECK SORTING :", "PASSED", "Check sorting command : Element " + objectName + " sorted"); } else { // System.out.println("Not descending"); if (customError != null && !(customError[0].equals("null") || customError[0].equals(""))) { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, " Custom Error :" + generateCustomError(customError) + " System generated Error : CHECK SORTING command : Element (" + objectName + ") not sorted"); } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + objectName + ") not sorted"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + objectName + ") not sorted"); } } } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Element (" + order + ") not match"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Element (" + order + ") not match"); } } else { reportresult(true, "CHECK SORTING :" + objectName + "", "FAILED", "CHECK SORTING command : Type (" + type + ") not match"); checkTrue(false, stopOnFailure, "CHECK SORTING command : Type (" + type + ") not match"); } }