javacommons/utils/tsrc/src/testoslayer.cpp
changeset 67 63b81d807542
parent 21 2a9601315dfc
child 83 26b2b12093af
equal deleted inserted replaced
64:0ea12c182930 67:63b81d807542
    35     TEST_TEARDOWN()
    35     TEST_TEARDOWN()
    36     {
    36     {
    37     }
    37     }
    38 };
    38 };
    39 
    39 
       
    40 void removeTestJar(list <wstring>& list, const wstring& jar)
       
    41 {
       
    42 
       
    43     std::list<wstring>::iterator iter = find(list.begin(), list.end(), jar);
       
    44     if (iter != list.end())
       
    45     {
       
    46         list.erase(iter);
       
    47     }
       
    48 }
       
    49 
       
    50 void removeTestJars(list <wstring>& list)
       
    51 {
       
    52     removeTestJar(list, L"Z:\\resource\\java\\jvm\\lib\\jrt\\javacommonutilstest.jar");
       
    53     removeTestJar(list, L"Z:\\resource\\java\\jvm\\lib\\jrt\\j2meunitomj.jar");
       
    54 }
       
    55 
    40 /**
    56 /**
    41  * Test JavaOsLayer::bootClassPath().
    57  * Test JavaOsLayer::bootClassPath().
    42  *
    58  *
    43  * 1. Test midp cp.
    59  * 1. Test midp cp.
    44  * 2. Test installer cp.
    60  * 2. Test installer cp.
    52     list <wstring> odcs;
    68     list <wstring> odcs;
    53     list <wstring> bc;
    69     list <wstring> bc;
    54     const wstring delim = L";";
    70     const wstring delim = L";";
    55     JavaOsLayer::bootClassPath(odcs, bc, BOOT_CLASSPATH_MIDP);
    71     JavaOsLayer::bootClassPath(odcs, bc, BOOT_CLASSPATH_MIDP);
    56     CHECK(odcs.size() > 35);
    72     CHECK(odcs.size() > 35);
       
    73     removeTestJars(bc);
    57     CHECK(bc.size() == 1);
    74     CHECK(bc.size() == 1);
    58     odcs.clear();
    75     odcs.clear();
    59     bc.clear();
    76     bc.clear();
    60 
    77 
    61     // 2. Test installer cp.
    78     // 2. Test installer cp.
    62     JavaOsLayer::bootClassPath(odcs, bc, BOOT_CLASSPATH_INSTALLER);
    79     JavaOsLayer::bootClassPath(odcs, bc, BOOT_CLASSPATH_INSTALLER);
    63     CHECK(odcs.size() > 24);
    80     CHECK(odcs.size() > 24);
       
    81     removeTestJars(bc);
    64     CHECK(bc.size() == 1);
    82     CHECK(bc.size() == 1);
    65     odcs.clear();
    83     odcs.clear();
    66     bc.clear();
    84     bc.clear();
    67 
    85 
    68     // 3. Test tckrunner cp.
    86     // 3. Test tckrunner cp.
    69     JavaOsLayer::bootClassPath(odcs, bc, BOOT_CLASSPATH_TCKRUNNER);
    87     JavaOsLayer::bootClassPath(odcs, bc, BOOT_CLASSPATH_TCKRUNNER);
    70     CHECK(bc.size() > 10);
    88     CHECK(odcs.size() > 10);
       
    89     removeTestJars(bc);
    71     CHECK(bc.size() == 1);
    90     CHECK(bc.size() == 1);
    72     odcs.clear();
    91     odcs.clear();
    73     bc.clear();
    92     bc.clear();
    74 
    93 
    75     // 4. Test negative type.
    94     // 4. Test negative type.
    76     JavaOsLayer::bootClassPath(odcs, bc, -1);
    95     JavaOsLayer::bootClassPath(odcs, bc, -1);
    77     CHECK(odcs.size() > 35);
    96     CHECK(odcs.size() > 35);
       
    97     removeTestJars(bc);
    78     CHECK(bc.size() == 1);
    98     CHECK(bc.size() == 1);
    79     odcs.clear();
    99     odcs.clear();
    80     bc.clear();
   100     bc.clear();
    81 
   101 
    82     // 5. Test positive greater boyndary.
   102     // 5. Test positive greater boyndary.
    83     JavaOsLayer::bootClassPath(odcs, bc, 50);
   103     JavaOsLayer::bootClassPath(odcs, bc, 50);
    84     CHECK(odcs.size() > 4);
   104     CHECK(odcs.size() > 4);
       
   105     removeTestJars(bc);
    85     CHECK(bc.size() == 1);
   106     CHECK(bc.size() == 1);
    86     odcs.clear();
   107     odcs.clear();
    87     bc.clear();
   108     bc.clear();
    88 }
   109 }