예제 #1
0
    def test_create_datasource_format_int_value_when_string(self):
        def cli_command_response(jboss_config,
                                 cli_command,
                                 fail_on_error=False):
            if (cli_command ==
                    '/subsystem=datasources/data-source="appDS":read-resource-description'
                ):
                return {
                    "outcome": "success",
                    "result": {
                        "attributes": {
                            "min-pool-size": {
                                "type": "INT"
                            }
                        }
                    },
                }

        self.org_run_operation.side_effect = cli_command_response
        datasource_properties = OrderedDict()
        datasource_properties["min-pool-size"] = "15"

        jboss7.create_datasource(self.jboss_config, "appDS",
                                 datasource_properties)

        self.org_run_operation.assert_called_with(
            self.jboss_config,
            '/subsystem=datasources/data-source="appDS":add(min-pool-size=15)',
            fail_on_error=False,
        )
예제 #2
0
    def test_create_datasource_all_properties_included(self):
        def cli_command_response(jboss_config, cli_command, fail_on_error=False):
            if cli_command == '/subsystem=datasources/data-source="appDS":read-resource-description':
                return {'outcome': 'success',
                        'result': {
                            'attributes': {
                                'driver-name': {'type': 'STRING'},
                                'connection-url': {'type': 'STRING'},
                                'jndi-name': {'type': 'STRING'},
                                'user-name': {'type': 'STRING'},
                                'password': {'type': 'STRING'}
                            }
                        }
                }

        self.org_run_operation.side_effect = cli_command_response

        datasource_properties = OrderedDict()
        datasource_properties['driver-name'] = 'mysql'
        datasource_properties['connection-url'] = 'jdbc:mysql://localhost:3306/app'
        datasource_properties['jndi-name'] = 'java:jboss/datasources/appDS'
        datasource_properties['user-name'] = 'app'
        datasource_properties['password'] = '******'

        jboss7.create_datasource(self.jboss_config, 'appDS', datasource_properties)

        self.org_run_operation.assert_called_with(self.jboss_config, '/subsystem=datasources/data-source="appDS":add(driver-name="mysql",connection-url="jdbc:mysql://localhost:3306/app",jndi-name="java:jboss/datasources/appDS",user-name="app",password="******")', fail_on_error=False)
예제 #3
0
    def test_create_datasource_all_properties_included(self):
        def cli_command_response(jboss_config, cli_command, fail_on_error=False):
            if (
                cli_command
                == '/subsystem=datasources/data-source="appDS":read-resource-description'
            ):
                return {
                    "outcome": "success",
                    "result": {
                        "attributes": {
                            "driver-name": {"type": "STRING"},
                            "connection-url": {"type": "STRING"},
                            "jndi-name": {"type": "STRING"},
                            "user-name": {"type": "STRING"},
                            "password": {"type": "STRING"},
                        }
                    },
                }

        self.org_run_operation.side_effect = cli_command_response

        datasource_properties = OrderedDict()
        datasource_properties["driver-name"] = "mysql"
        datasource_properties["connection-url"] = "jdbc:mysql://localhost:3306/app"
        datasource_properties["jndi-name"] = "java:jboss/datasources/appDS"
        datasource_properties["user-name"] = "app"
        datasource_properties["password"] = "******"

        jboss7.create_datasource(self.jboss_config, "appDS", datasource_properties)

        self.org_run_operation.assert_called_with(
            self.jboss_config,
            '/subsystem=datasources/data-source="appDS":add(driver-name="mysql",connection-url="jdbc:mysql://localhost:3306/app",jndi-name="java:jboss/datasources/appDS",user-name="app",password="******")',
            fail_on_error=False,
        )
예제 #4
0
    def test_create_datasource_format_boolean_value_when_boolean(self):
        def cli_command_response(jboss_config,
                                 cli_command,
                                 fail_on_error=False):
            if (cli_command ==
                    '/subsystem=datasources/data-source="appDS":read-resource-description'
                ):
                return {
                    "outcome": "success",
                    "result": {
                        "attributes": {
                            "use-ccm": {
                                "type": "BOOLEAN"
                            }
                        }
                    },
                }

        self.org_run_operation.side_effect = cli_command_response
        datasource_properties = OrderedDict()
        datasource_properties["use-ccm"] = True

        jboss7.create_datasource(self.jboss_config, "appDS",
                                 datasource_properties)

        self.org_run_operation.assert_called_with(
            self.jboss_config,
            '/subsystem=datasources/data-source="appDS":add(use-ccm=true)',
            fail_on_error=False,
        )
예제 #5
0
    def test_create_datasource_format_int_value_when_string(self):
        def cli_command_response(jboss_config,
                                 cli_command,
                                 fail_on_error=False):
            if cli_command == '/subsystem=datasources/data-source="appDS":read-resource-description':
                return {
                    'outcome': 'success',
                    'result': {
                        'attributes': {
                            'min-pool-size': {
                                'type': 'INT'
                            }
                        }
                    }
                }

        __salt__['jboss7_cli.run_operation'].side_effect = cli_command_response
        datasource_properties = OrderedDict()
        datasource_properties['min-pool-size'] = '15'

        jboss7.create_datasource(self.jboss_config, 'appDS',
                                 datasource_properties)

        __salt__['jboss7_cli.run_operation'].assert_called_with(
            self.jboss_config,
            '/subsystem=datasources/data-source="appDS":add(min-pool-size=15)',
            fail_on_error=False)
예제 #6
0
    def test_create_datasource_format_boolean_value_when_boolean(self):
        def cli_command_response(jboss_config,
                                 cli_command,
                                 fail_on_error=False):
            if cli_command == '/subsystem=datasources/data-source="appDS":read-resource-description':
                return {
                    'outcome': 'success',
                    'result': {
                        'attributes': {
                            'use-ccm': {
                                'type': 'BOOLEAN'
                            }
                        }
                    }
                }

        __salt__['jboss7_cli.run_operation'].side_effect = cli_command_response
        datasource_properties = OrderedDict()
        datasource_properties['use-ccm'] = True

        jboss7.create_datasource(self.jboss_config, 'appDS',
                                 datasource_properties)

        __salt__['jboss7_cli.run_operation'].assert_called_with(
            self.jboss_config,
            '/subsystem=datasources/data-source="appDS":add(use-ccm=true)',
            fail_on_error=False)
예제 #7
0
파일: jboss7_test.py 프로젝트: DaveQB/salt
    def test_create_datasource_all_properties_included(self):
        def cli_command_response(jboss_config, cli_command, fail_on_error=False):
            if cli_command == '/subsystem=datasources/data-source="appDS":read-resource-description':
                return {'outcome': 'success',
                        'result': {
                            'attributes': {
                                'driver-name': {'type': 'STRING'},
                                'connection-url': {'type': 'STRING'},
                                'jndi-name': {'type': 'STRING'},
                                'user-name': {'type': 'STRING'},
                                'password': {'type': 'STRING'}
                            }
                        }
                }

        __salt__['jboss7_cli.run_operation'].side_effect = cli_command_response

        datasource_properties = OrderedDict()
        datasource_properties['driver-name'] = 'mysql'
        datasource_properties['connection-url'] = 'jdbc:mysql://localhost:3306/app'
        datasource_properties['jndi-name'] = 'java:jboss/datasources/appDS'
        datasource_properties['user-name'] = 'app'
        datasource_properties['password'] = '******'

        jboss7.create_datasource(self.jboss_config, 'appDS', datasource_properties)

        __salt__['jboss7_cli.run_operation'].assert_called_with(self.jboss_config, '/subsystem=datasources/data-source="appDS":add(driver-name="mysql",connection-url="jdbc:mysql://localhost:3306/app",jndi-name="java:jboss/datasources/appDS",user-name="app",password="******")', fail_on_error=False)
예제 #8
0
파일: jboss7_test.py 프로젝트: DaveQB/salt
    def test_create_datasource_format_int_value_when_string(self):
        def cli_command_response(jboss_config, cli_command, fail_on_error=False):
            if cli_command == '/subsystem=datasources/data-source="appDS":read-resource-description':
                return {'outcome': 'success',
                        'result': {
                            'attributes': {
                                'min-pool-size': {'type': 'INT'}
                            }
                        }
                }

        __salt__['jboss7_cli.run_operation'].side_effect = cli_command_response
        datasource_properties = OrderedDict()
        datasource_properties['min-pool-size'] = '15'

        jboss7.create_datasource(self.jboss_config, 'appDS', datasource_properties)

        __salt__['jboss7_cli.run_operation'].assert_called_with(self.jboss_config, '/subsystem=datasources/data-source="appDS":add(min-pool-size=15)', fail_on_error=False)
예제 #9
0
파일: jboss7_test.py 프로젝트: DaveQB/salt
    def test_create_datasource_format_boolean_value_when_boolean(self):
        def cli_command_response(jboss_config, cli_command, fail_on_error=False):
            if cli_command == '/subsystem=datasources/data-source="appDS":read-resource-description':
                return {'outcome': 'success',
                        'result': {
                            'attributes': {
                                'use-ccm': {'type': 'BOOLEAN'}
                            }
                        }
                }

        __salt__['jboss7_cli.run_operation'].side_effect = cli_command_response
        datasource_properties = OrderedDict()
        datasource_properties['use-ccm'] = True

        jboss7.create_datasource(self.jboss_config, 'appDS', datasource_properties)

        __salt__['jboss7_cli.run_operation'].assert_called_with(self.jboss_config, '/subsystem=datasources/data-source="appDS":add(use-ccm=true)', fail_on_error=False)