@Test
  public void testGetAoIdAndAoTypeByFO() throws Exception {

    before();

    // This below given expected output is taken by executing
    // CourseOfferingServiceImpl.getActivityOfferingsByFormatOffering separately.
    String formatOfferingId = "Lui-6";
    String str[] = {
      "Lui-2-->kuali.lui.type.activity.offering.lecture",
      "Lui-5-->kuali.lui.type.activity.offering.lab",
      "Lui-8-->kuali.lui.type.activity.offering.lecture"
    };
    List<String> expectedList = Arrays.asList(str);

    List<KeyValue> aoKVList =
        courseOfferingServiceFacade.getAoIdAndAoTypeByFO(formatOfferingId, contextInfo);
    List<String> resultList = new ArrayList<String>();

    assertNotNull(aoKVList);
    for (KeyValue aoIdType : aoKVList) {
      resultList.add(aoIdType.getKey() + "-->" + aoIdType.getValue());
    }

    assertEquals(expectedList.size(), aoKVList.size());
    assertEquals(expectedList.containsAll(resultList), true);
  }
示例#2
0
 /**
  * Helper method that takes a List of {@link KeyValue} and presents it as a Map
  *
  * @param collection collection of {@link KeyValue}
  * @return a Map<String, String> representing the keys and values in the KeyValue collection
  */
 public static <T extends KeyValue> Map<String, String> getKeyValueCollectionAsMap(
     List<T> collection) {
   Map<String, String> map = new HashMap<String, String>(collection.size());
   for (KeyValue kv : collection) {
     map.put(kv.getKey(), kv.getValue());
   }
   return map;
 }
 public static String getValue(String batchVal) {
   String value = "";
   locationKeyValues = retrieveProfileDetailsForBatchDelete();
   for (KeyValue keyValue : locationKeyValues) {
     if (batchVal.equalsIgnoreCase(keyValue.getKey())) {
       value = keyValue.getValue();
     }
   }
   return value;
 }
示例#4
0
  @Override
  public boolean processRunAuditBusinessRules(Document document) {
    boolean valid = true;
    AwardDocument awardDocument = (AwardDocument) document;
    auditErrors = new ArrayList<AuditError>();
    setSponsorTermTypes();
    List<AwardSponsorTerm> awardSponsorTerms = awardDocument.getAward().getAwardSponsorTerms();

    for (KeyValue sponsorTermType : sponsorTermTypes) {
      boolean sponsorTermTypeExists =
          isSponsorTermTypeInAwardSponsorTerms(
              sponsorTermType.getKey().toString(), awardSponsorTerms);
      if (!sponsorTermTypeExists) {
        valid &= false;
        addErrorToAuditErrors(sponsorTermType.getValue());
      }
    }
    reportAndCreateAuditCluster();
    return valid;
  }
  public static List<String> retrieveBatchProfileNamesForBatchDelete(String locationVal) {
    List<KeyValue> locationKeyValues = retrieveProfileDetailsForBatchDelete();
    List<String> locationValues = new ArrayList<String>();
    for (KeyValue keyValue : locationKeyValues) {
      locationValues.add(keyValue.getKey());
    }
    Pattern pattern = Pattern.compile("[?$(){}\\[\\]\\^\\\\]");
    Matcher matcher = pattern.matcher(locationVal);
    if (matcher.matches()) {
      return new ArrayList<String>();
    }

    if (!locationVal.equalsIgnoreCase("*")) {
      locationValues =
          Lists.newArrayList(
              Collections2.filter(
                  locationValues,
                  Predicates.contains(Pattern.compile(locationVal, Pattern.CASE_INSENSITIVE))));
    }
    Collections.sort(locationValues);
    return locationValues;
  }