Example #1
0
 def testPropertyLoader(self):
     properties = Properties()
     propertyLoader = PropertyLoader(properties)
     fileReader = self.getFileReader("test.conf")
     propertyLoader.load(fileReader)
     self.assertEqual(properties.size(), 4, "invalid size")
     property = properties.getProperty("ORACLE_USERS")
     self.assertEqual(len(eval(property.getValue())), 2, "invalid size")
Example #2
0
    def testNoOraAppPass(self):

        NOORA_DIR = os.path.abspath('.').split('test')[0] + "src"

        sys.path.append(NOORA_DIR)
        CURRENT_DIR = os.path.abspath('.')

        properties = Properties()
        propertyLoader = PropertyLoader(properties)
        properties.setProperty("noora.dir", NOORA_DIR)
        properties.setProperty("current.dir", CURRENT_DIR)
        properties.setProperty(
            "plugin.dir",
            NOORA_DIR + os.sep + 'org' + os.sep + 'noora' + os.sep + 'plugin')
        app = NoOraApp()
        file = app.getConfigFile(properties)
        fileReader = FileReader(file)
        propertyLoader.load(fileReader)

        classLoader = ClassLoader()
        options = Options()
        pluginManager = PluginManager(classLoader, options)
        pluginsProperty = properties.getProperty('PLUGINS')
        pluginManager.load(pluginsProperty)
        options = pluginManager.getOptions()

        arguments = [
            'drop', 'create', 'update', '-h=localhost', '-d=orcl', '-e=dev',
            '-v=1.0.1'
        ]

        parser = Parser()
        commands = parser.parse(options, arguments)

        for command in commands.getOptions().getOptions():
            plugin = pluginManager.findByType(command.getType())

            options = plugin.getOptions(properties)
            commandLine = parser.parse(options, arguments)
            parser.checkRequiredOptions()
            parser.checkRequiredArguments()

            plugin.execute(commandLine, properties)
Example #3
0
    def testXmlFileReader(self):
        file = File("project.xml")
        fileReader = XmlFileReader(file)
        stream = fileReader.read()

        properties = Properties()
        root = stream.getroot()
        for element in self.getElement(root):
            property = properties.getProperty(element[0])
            if property != None:

                value = property.getValue()
                property.setValue(value + ',' + str(element[1]))
            else:
                properties.setProperty(element[0], str(element[1]))
            print element
        #for index in range(root.__len__()):
        #  print root.__getitem__(index)

        #for element in stream.iter():
        #  if element.__len__()!=0:
        #    for index in range(element.__len__()):
        #      print element.__getitem__(index)

        print "------------------"
        #for element in stream.iter():

        #  if element.text != None:
        #    if element.text.strip()!="":
        #      #print element.tag,"-->","'"+element.text+"'"
        #      properties.setProperty(element.tag, element.text)
        #    else:
        #      pass
        #print element.tag
        fileReader.close()
        print "properties.size:", properties.size()
        for property in properties.list():
            print property.getKey(), "-->", property.getValue()
Example #4
0
    properties.setProperty(
        "alter.dir",
        properties.getPropertyValue("current.dir") + os.sep + "alter")
    properties.setProperty(
        "create.dir",
        properties.getPropertyValue("current.dir") + os.sep + "create")

    app = NoOraApp()
    file = app.getConfigFile(properties)
    fileReader = FileReader(file)
    propertyLoader.load(fileReader)

    classLoader = ClassLoader()
    options = Options()
    pluginManager = PluginManager(classLoader, options)
    pluginsProperty = properties.getProperty('PLUGINS')
    pluginManager.load(pluginsProperty)
    options = pluginManager.getOptions()

    #arguments = ['drop','create','update','-h=localhost','-d=orcl','-e=dev','-v=1.0.1']
    arguments = sys.argv[1:]

    parser = Parser()
    commands = parser.parse(options, arguments)

    for command in commands.getOptions().getOptions():

        plugin = pluginManager.findByType(command.getType())

        options = plugin.getOptions(properties)
        commandLine = parser.parse(options, arguments)