VirtualBox

Changeset 16188 in vbox for trunk/src/VBox/Main/testcase


Ignore:
Timestamp:
Jan 22, 2009 7:58:31 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
41944
Message:

Merge OVF branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/tstAPI.cpp

    r15581 r16188  
    12551255    } while (false);
    12561256#endif /* VBOX_WITH_RESOURCE_USAGE_API */
     1257#if 1
     1258    // check of OVF appliance handling
     1259    ///////////////////////////////////////////////////////////////////////////
     1260    do
     1261    {
     1262        Bstr ovf = L"/home/poetzsch/projects/out.ovf";
     1263        //Bstr ovf = L"/home/poetzsch/projects/someOVF.ovf";
     1264//        Bstr ovf = L"/Users/poetzsch/projects/someOVF.ovf";
     1265//        Bstr ovf = L"/Users/poetzsch/projects/out.ovf";
     1266//        Bstr name = argc > 1 ? argv [1] : "dsl";
     1267        printf ("Try to open %ls ...\n", ovf.raw());
     1268
     1269        ComPtr <IAppliance> appliance;
     1270        CHECK_ERROR_BREAK (virtualBox,
     1271                           OpenAppliance (ovf, appliance.asOutParam()));
     1272        Bstr path;
     1273        CHECK_ERROR_BREAK (appliance, COMGETTER (Path)(path.asOutParam()));
     1274        printf ("Successfully opened %ls.\n", path.raw());
     1275        printf ("Appliance:\n");
     1276        // Fetch all disks
     1277        com::SafeArray<BSTR> retDisks;
     1278        ULONG diskCount = 0;
     1279        CHECK_ERROR_BREAK (appliance,
     1280                           GetDisks (ComSafeArrayAsOutParam  (retDisks), (&diskCount)));
     1281        if (retDisks.size() > 0)
     1282        {
     1283            printf ("Disks:");
     1284            for (unsigned i = 0; i < retDisks.size(); i++)
     1285                printf (" %ls", Bstr (retDisks [i]).raw());
     1286            printf ("\n");
     1287        }
     1288        /* Fetch all virtual system descriptions */
     1289        com::SafeIfaceArray<IVirtualSystemDescription> retVSD;
     1290        CHECK_ERROR_BREAK (appliance,
     1291                           COMGETTER (VirtualSystemDescriptions) (ComSafeArrayAsOutParam (retVSD)));
     1292        if (retVSD.size() > 0)
     1293        {
     1294            for (unsigned i = 0; i < retVSD.size(); ++i)
     1295            {
     1296                com::SafeArray<VirtualSystemDescriptionType_T> retTypes;
     1297                com::SafeArray<ULONG> retRefs;
     1298                com::SafeArray<BSTR> retOrigValues;
     1299                com::SafeArray<BSTR> retAutoValues;
     1300                com::SafeArray<BSTR> retConfiguration;
     1301                CHECK_ERROR_BREAK (retVSD [i],
     1302                                   GetDescription (ComSafeArrayAsOutParam (retTypes),
     1303                                                   ComSafeArrayAsOutParam (retRefs),
     1304                                                   ComSafeArrayAsOutParam (retOrigValues),
     1305                                                   ComSafeArrayAsOutParam (retAutoValues),
     1306                                                   ComSafeArrayAsOutParam (retConfiguration)));
     1307
     1308                printf ("VirtualSystemDescription:\n");
     1309                for (unsigned a = 0; a < retTypes.size(); ++a)
     1310                {
     1311                    printf (" %d %u %ls %ls %ls\n",
     1312                            retTypes [a],
     1313                            retRefs [a],
     1314                            Bstr (retOrigValues [a]).raw(),
     1315                            Bstr (retAutoValues [a]).raw(),
     1316                            Bstr (retConfiguration [a]).raw());
     1317                }
     1318            }
     1319            printf ("\n");
     1320        }
     1321    }
     1322    while (FALSE);
     1323    printf ("\n");
     1324#endif
    12571325
    12581326    printf ("Press enter to release Session and VirtualBox instances...");
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette