def createInstancesFromFile(fileName = None):
        """Create the Instance objects from the file and expose them in a list"""

        if fileName == None:
            fileName = DataReader.INSTANCES_FILE
        for instRow in DataReader.__getRows(fileName):
            instance = Instance(int(instRow[0]), int(instRow[1]), int(instRow[2]))
            host = DataReader.findHostByID(instance.hostID)
            if host is not None:
                instance.setHost(host)
                host.addInstance(instance)
            else:
                logging.error('CREATE INSTANCE: Orphan instance - Skipping instance')
                continue
            logging.debug('DATA READER: Adding instance ' + str(instance.hostID))
            DataReader.instances.append(instance)
class TestInstance(unittest.TestCase):

    def setUp(self):
        self.i1 = Instance(1, 2, 3)
        self.i2 = Instance(1, 2, 5)
        self.i3 = Instance(4, 2, 5)
        self.i1 = Instance(1, 1, 1)
        self.host = Host(1, 2, 3)

    def testCreateInstance(self):
        newInstance = Instance(1, 2, 3)
        self.assertIsInstance(newInstance, Instance)

    def testEquals(self):
        self.assertNotEqual(self.i1, self.i3)
        self.assertEqual(self.i1, self.i2)

    def testSetHost(self):
        self.i1.setHost(self.host)
        self.assertIsNotNone(self.i1.host)