Ejemplo n.º 1
0
  void testXdr()
  {
    ontologydto::TypeDTO* typeDTO = new ontologydto::TypeDTO(*_typeElement);
    ontology::Type type(*typeDTO);

    ontologydto::TypeDTO* otherTypeDTO = new ontologydto::TypeDTO(*_typeElement);
    ontology::Type otherType(*otherTypeDTO);

    Instance instance(type);

    std::string name("Instance name.");
    std::string otherName("other Instance name.");
    instance.setName(name);

    iostream::XdrOutputStream ostream("testfile");
    instance.encode(ostream);
    ostream.close();

    std::map <int, void*> addressMappings;
    addressMappings[(int) &type] = static_cast <void*> (&type);
    addressMappings[(int) &otherType] = static_cast <void*> (&otherType);

    iostream::XdrInputStream istream("testfile");
    Instance decodedInst(istream, addressMappings);
    istream.close();

    remove("testfile");

    assertTrue(decodedInst.getName() == name);
    assertFalse(decodedInst.getName() == otherName);
    assertTrue(&(decodedInst.getType()) == &type);
    assertFalse(&(decodedInst.getType()) == &otherType);
  }
Ejemplo n.º 2
0
bool DSN::equalName(const DSN& other) const
{
	std::string myName(m_name), otherName(other.getName());
	stringToLowercase(myName);
	stringToLowercase(otherName);
	return myName.compare(otherName) == 0;
}