/*
 * Copyright 2005-2010 The Kuali Foundation
 * 
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kra.service.impl;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kuali.kra.infrastructure.KraServiceLocator;
import org.kuali.kra.service.ArgValueLookupService;
import org.kuali.kra.test.infrastructure.KcUnitTestBase;

//@PerTestUnitTestData(
//        @UnitTestData(
//            sqlFiles = {
//                 @UnitTestFile(filename = "classpath:sql/dml/load_ARG_VALUE_LOOKUP.sql", delimiter = ";")
//                }
//        )
//)

public class ArgValueLookupServiceImplTest extends KcUnitTestBase{

    private ArgValueLookupService argValueLookupService = null;
    
    private static String expectedArgumentNames = ",AcademicAppointmentPeriod;AcademicAppointmentPeriod,AppointmentTypes;AppointmentTypes,FieldOfTraining;FieldOfTraining,GraduateLevelDegree;GraduateLevelDegree,KirschsteinLevel;KirschsteinLevel,KirschsteinType;KirschsteinType,PI_Question;PI_Question,PeriodTypes;PeriodTypes,ProjectRoles;ProjectRoles,Sponsor_routing;Sponsor_routing,human_subjects;human_subjects,interest_revenue;interest_revenue,revenue;revenue,yes_no_flag;yes_no_flag";
    
    @Before
    public void setUp() throws Exception {
        super.setUp();
        argValueLookupService = KraServiceLocator.getService(ArgValueLookupService.class);
    }
    @After
    public void tearDown() throws Exception {
        argValueLookupService = null;
        super.tearDown();
    }
    
    /**
     * 
     * This method tests getArgumentNames
     * @throws Exception
     */
    @Test
    public void testGetArgumentNames() throws Exception {
        String argumentNames = argValueLookupService.getArgumentNames();
        int exists = argumentNames.indexOf(expectedArgumentNames);
        assertFalse(exists==-1);
//        assertEquals(expectedArgumentNames, argumentNames);
    }
}

@@ -671,16 +671,42 @@
 mpl;%0D%0A%0D%0A
+import java.util.List;%0D%0A%0D%0A
 import o
@@ -718,24 +718,24 @@
 nit.After;%0D%0A
-
 import org.j
@@ -1485,47 +1485,303 @@
 ing,
-GraduateLevelDegree;GraduateLevelDegree
+FieldOfTraining-Broad;FieldOfTraining-Broad,FieldOfTraining-SubCategory;FieldOfTraining-SubCategory,GraduateLevelDegree;GraduateLevelDegree,GraduateLevelDegree1-2;GraduateLevelDegree1-2,Kirschstein-NRSAAwardTYPE;Kirschstein-NRSAAwardTYPE,Kirschstein-NRSASupportLevel;Kirschstein-NRSASupportLevel
 ,Kir
@@ -2538,32 +2538,65 @@
 ws Exception %7B%0D%0A
+        boolean success = true;%0D%0A
         String a
@@ -2665,43 +2665,111 @@
     
-int exists = argumentNames.indexOf(
+String%5B%5D argumentNamesArray = argumentNames.split(%22,%22);%0D%0A        String%5B%5D expectedArgumentNamesArray = 
 expe
@@ -2777,32 +2777,42 @@
 tedArgumentNames
+.split(%22,%22
 );%0D%0A        asse
@@ -2811,44 +2811,96 @@
     
-assertFalse(exists==-1
+List%3CString%3E argumentNamesList = java.util.Arrays.asList(argumentNamesArray
 );
+ 
 %0D%0A
-//
         
 asse
@@ -2899,21 +2899,28 @@
     
-assertEquals(
+for (int i = 0; i %3C 
 expe
@@ -2940,22 +2940,203 @@
 ames
-, argumentName
+Array.length; i++) %7B%0D%0A            if(success && !argumentNamesList.contains(expectedArgumentNamesArray%5Bi%5D))%7B%0D%0A                success = false;%0D%0A            %7D%0D%0A        %7D%0D%0A        assertTrue(succes
 s);%0D

check only the values in the arg_value_lookup values, not the order