Example #1
0
int main(int argc, char** argv)
{
    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;
    ProgName = argv[0];

    if (argc != 2)
    {
        cout << "Usage: " << ProgName << " XML | BIN | XMLMIX | BINMIX" << endl;
        return 1;
    }

    const char* tmpDir = getenv ("PEGASUS_TMP");
    if (tmpDir == NULL)
    {
        repositoryRoot = ".";
    }
    else
    {
        repositoryRoot = tmpDir;
    }
    repositoryRoot.append("/repository");

    FileSystem::removeDirectoryHier(repositoryRoot);

    try
    {
      Uint32 mode;
      Uint32 modeother;
      int mixed_mode;

      if (!strcmp(argv[1],"XML") )
    {
      mode = CIMRepository::MODE_XML;
      modeother = CIMRepository::MODE_BIN;
      mixed_mode = 0;
      if (verbose) cout << ProgName<< ": Single test using XML mode repository"
                        << endl;
    }
      else if (!strcmp(argv[1],"BIN") )
    {
      mode = CIMRepository::MODE_BIN;
      modeother = CIMRepository::MODE_XML;
      mixed_mode = 0;
      if (verbose) cout << ProgName<< ": Single test using BIN mode repository"
                        << endl;
    }
      else if (!strcmp(argv[1],"XMLMIX") )
    {
      mode = CIMRepository::MODE_XML;
      modeother = CIMRepository::MODE_BIN;
      mixed_mode = 1;
      if (verbose) cout << ProgName
                        << ": Mixed test using XML mode repository first"
                        << endl;
    }
      else if (!strcmp(argv[1],"BINMIX") )
    {
      mode = CIMRepository::MODE_BIN;
      modeother = CIMRepository::MODE_XML;
      mixed_mode = 1;
      if (verbose) cout << ProgName
                        << ": Mixed test using BIN mode repository first"
                        << endl;
    }
      else
    {
      cout << ProgName<< ": invalid argument: " << argv[1] << endl;
      return 1;
    }

      TestOpenRepo(mode);
      TestInitRepo();
      TestCreateClass();
      TestEnumerateClass();
      TestCreateInstance1();
      if (mixed_mode)
    {
      TestCloseRepo();
      TestOpenRepo(modeother);
    }

      TestCreateInstance2();

      if (mixed_mode)
    {
      TestCloseRepo();
      TestOpenRepo(mode);
    }

      TestCreateInstance3();

      if (mixed_mode)
    {
      TestCloseRepo();
      TestOpenRepo(modeother);
    }
      TestCreateInstance4();

      if (mixed_mode)
    {
      TestCloseRepo();
      TestOpenRepo(mode);
    }

      TestCreateInstance5();
      TestEnumerateInstance(5);
      TestEnumerateInstances(5);
      TestEnumerateInstancesForClass(5);
      TestQualifiers();

      TestCloseRepo();
    }
    catch (const Exception& e)
    {
    cout << argv[0] << " " << argv[1] << " " << e.getMessage() << endl;
    exit(1);
    }

    FileSystem::removeDirectoryHier(repositoryRoot);

    cout << ProgName << " " << argv[1] << " +++++ passed all tests" << endl;

    return 0;
}
Example #2
0
int main(int argc, char** argv)
{
    verbose = getenv("PEGASUS_TEST_VERBOSE");
    ProgName = argv[0];

    const char* tmpDir = getenv ("PEGASUS_TMP");
    if (tmpDir == NULL)
    {
        repositoryRoot = ".";
    }
    else
    {
        repositoryRoot = tmpDir;
    }
    repositoryRoot.append("/repository");

    try 
    {
      CIMRepository_Mode mode;
      CIMRepository_Mode modeother;
      int mixed_mode;

      if (!strcmp(argv[1],"XML") )
	{
	  mode.flag = CIMRepository_Mode::NONE;
	  modeother.flag = CIMRepository_Mode::BIN;
	  mixed_mode = 0;
	  if (verbose) cout << ProgName<< ": Single test using XML mode repository" << endl;
	}
      else if (!strcmp(argv[1],"BIN") )
	{
	  mode.flag = CIMRepository_Mode::BIN;
	  modeother.flag = CIMRepository_Mode::NONE;
	  mixed_mode = 0;
	  if (verbose) cout << ProgName<< ": Single test using BIN mode repository" << endl;
	}
      else if (!strcmp(argv[1],"XMLMIX") )
	{
	  mode.flag = CIMRepository_Mode::NONE;
	  modeother.flag = CIMRepository_Mode::BIN;
	  mixed_mode = 1;
	  if (verbose) cout << ProgName<< ": Mixed test using XML mode repository first" << endl;
	}
      else if (!strcmp(argv[1],"BINMIX") )
	{
	  mode.flag = CIMRepository_Mode::BIN;
	  modeother.flag = CIMRepository_Mode::NONE;
	  mixed_mode = 1;
	  if (verbose) cout << ProgName<< ": Mixed test using BIN mode repository first" << endl;
	}
      else
	{
	  cout << ProgName<< ": invalid argument: " << argv[1] << endl;
	  return 0;
	}

      TestOpenRepo(mode);
      TestInitRepo();
      TestCreateClass();
      TestEnumerateClass();
      TestCreateInstance1();
      if (mixed_mode) 
	{
	  TestCloseRepo();
	  TestOpenRepo(modeother);
	}

      TestCreateInstance2();

      if (mixed_mode) 
	{
	  TestCloseRepo();
	  TestOpenRepo(mode);
	}

      TestCreateInstance3();

      if (mixed_mode) 
	{
	  TestCloseRepo();
	  TestOpenRepo(modeother);
	}
      TestCreateInstance4();

      if (mixed_mode) 
	{
	  TestCloseRepo();
	  TestOpenRepo(mode);
	}

      TestCreateInstance5();
      TestEnumerateInstance(5);
      TestEnumerateInstances(5);      
      TestEnumerateInstancesForClass(5);      
      TestQualifiers();

    }
    catch (const Exception& e)
    {
	cout << argv[0] << " " << argv[1] << " " << e.getMessage() << endl;
	exit(1);
    }

    cout << ProgName << " " << argv[1] << " +++++ passed all tests" << endl;

    return 0;
}