Beispiel #1
0
void Shell_GetLogDataEx(int len, uint8 value, Bool isRead)
{
	int i = 0;
	uint8 byte[SECTOR_SIZE];

	memset(byte, value, SECTOR_SIZE);

	QueueEx_PushIn(byte, len);

	if(isRead)
	{
		len = QUEUE_getElementCount((Queue*)g_pQueueEx);
		i = QueueEx_Read((QueueEx*)g_pQueueEx, g_pBulkBuf, len);

		ASRT(i == len);
		
		Printf("Len=%d: \n",i);
		DUMP_BYTE(g_pBulkBuf, i);
	}
}
// ===========================================================================
// Main
// Options:
//  Test or show - TBD
// ===========================================================================
int main()
{
    //verbose = getenv("PEGASUS_TEST_VERBOSE");
    verbose = "test";
    cout << "+++++ Testing AssociationTest Provider" << endl;

    // Build array of classes
    Array<CIMName> Classes;
    Classes.append("TST_ClassA");
    Classes.append("TST_ClassB");
    Classes.append("TST_ClassC");
    Classes.append("TST_ClassD");
    Classes.append("TSTDY_ClassA");
    Classes.append("TSTDY_ClassB");
    Classes.append("TSTDY_ClassC");
    Classes.append("TSTDY_ClassD");

    Array<CIMName> AssocClasses;
    AssocClasses.append("TST_AssocI1");
    AssocClasses.append("TST_AssocI2");
    AssocClasses.append("TST_AssocI3");
    AssocClasses.append("TST_AssocI4");
    AssocClasses.append("TST_AssocI5");
    AssocClasses.append("TST_AssocI6");

    AssocClasses.append("TST_AssocNI1");
    AssocClasses.append("TST_AssocNI2");
    AssocClasses.append("TST_AssocNI3");
    AssocClasses.append("TST_AssocNI4");
    AssocClasses.append("TST_AssocNI5");
    AssocClasses.append("TST_AssocNI6");

    // Connect
    try
    {
        c.connect (HOST, PORTNUMBER, String::EMPTY, String::EMPTY);
    }
    catch (Exception& e)
    {
        errorExit(e);
    }

    int rc;
    // Start by confirming the existence of the classes, etc.
    if ((rc = testClassList(Classes)) != 0) return rc;
    if ((rc = testClassList(AssocClasses)) != 0) return rc;
    // Now start the association tests.
    // Reference Names Test

    // Class A Refrence Names Test

    ASRT(testReferenceNames(CIMObjectPath("TST_ClassA"), CIMName(), "", 2));
    ASRT(testReferenceNames(CIMObjectPath("TST_ClassA"), CIMName(), "to", 2));
    ASRT(testReferenceNames(CIMObjectPath("TST_ClassA"), CIMName(), "from", 2));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI1"), "", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI1"), "to", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI1"), "from", 1));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI3"), "", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI3"), "to", 0));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI3"), "from", 1));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI5"), "", 0));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI5"), "to", 0));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA"), CIMName("TST_AssocI5"), "from", 0));

    // Class B Refrence Names Test
    ASRT(testReferenceNames(CIMObjectPath("TST_ClassB"), CIMName(), "", 4));
    ASRT(testReferenceNames(CIMObjectPath("TST_ClassB"), CIMName(), "to", 2));
    ASRT(testReferenceNames(CIMObjectPath("TST_ClassB"), CIMName(), "from", 4));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI2"), "", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI2"), "to", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI2"), "from", 1));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI2"), "", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI2"), "to", 0));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI2"), "from", 1));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI5"), "", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI5"), "to", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassB"), CIMName("TST_AssocI5"), "from", 1));

    // TODO TestReferences for class c and class d

    // testRefernceName Instances from static store
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""), CIMName(), "", 2));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""), CIMName(), "to", 2));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""), CIMName(), "from", 2));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI1"), "", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI1"), "to", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI1"), "from", 1));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI3"), "", 1));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI3"), "to", 0));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI3"), "from", 1));

    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI5"), "", 0));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI5"), "to", 0));
    ASRT(testReferenceNames(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName("TST_AssocI5"), "from", 0));

    // Lets make the previous a common test between ref and ref names.

    // References
    // Limited test since we learned most in the previous test of reference
    // names
    CIMPropertyList NullPL;

    CIMPropertyList emptyPL;

    CIMPropertyList fullPL;
    Array<CIMName> fullPLinput;
    fullPLinput.append("name");
    fullPL.set(fullPLinput);


    CIMPropertyList errorPL;
    Array<CIMName> errorPLinput;
    errorPLinput.append("junk");
    errorPL.set(errorPLinput);

    ASRT(testReferences(CIMObjectPath("TST_ClassA"), CIMName(), "", emptyPL,2));

    ASRT(testReferences(
        CIMObjectPath("TST_ClassA.name=\"InstanceA1\""),
        CIMName(), "", fullPL,2));

    // Testing associators and and associator names functions.

    ASRT(testAssocNames(
        CIMObjectPath("TST_ClassA"), CIMName(), CIMName(), "", "", 3));

    cout << "+++++ passed all tests" << endl;
    return 0;
}