def setUp(self):
        Tester.setup_distributed(self)

        # Get username and password
        username = self.username
        password = self.password

        self.sc = rest.StreamsConnection(username=username, password=password)
示例#2
0
 def instance(self):
     if self._sc is None:
         self._sc = sxr.StreamsConnection(os.environ['STREAMS_USERNAME'],
                                          os.environ['STREAMS_PASSWORD'],
                                          resource_url=self._url)
         if self._verify is not None:
             self._sc.session.verify = self._verify
         self._ins = self._sc.get_instances()[0]
     return self._ins
示例#3
0
 def test_DifferentPassword(self):
     sc = rest.StreamsConnection('user1', 'pass1')
     self.test_config[ConfigParams.STREAMS_CONNECTION] = sc
     with self.assertRaises(RuntimeError):
         submit(self.test_ctxtype,
                self.topo,
                self.test_config,
                username='******',
                password='******')
    def setUp(self):
        Tester.setup_distributed(self)

        # Get username and password
        username = os.getenv("STREAMS_USERNAME", "streamsadmin")
        password = os.getenv("STREAMS_PASSWORD", "passw0rd")

        self.sc = rest.StreamsConnection(username=username, password=password)

        # Disable SSL verification
        self.sc.session.verify = False
        self.test_config[ConfigParams.STREAMS_CONNECTION] = self.sc
    def setUp(self):
        Tester.setup_distributed(self)

        # Get username and password
        username = self.username
        password = self.password

        self.sc = rest.StreamsConnection(username=username, password=password)

        # Disable SSL verification
        self.sc.session.verify = False
        self.test_config[ConfigParams.STREAMS_CONNECTION] = self.sc
 def test_username_and_password(self):
     self.logger.debug("Beginning test: test_username_and_password.")
     # Ensure, at minimum, that the StreamsContext can connect and retrieve valid data from the SWS resources path
     ctxt = rest.StreamsConnection(self.sws_username, self.sws_password,
                                   self.sws_rest_api_url)
     resources = ctxt.get_resources()
     self.logger.debug("Number of retrieved resources is: " +
                       str(len(resources)))
     self.assertGreater(
         len(resources),
         0,
         msg="Returned zero resources from the \"resources\" endpoint.")
    def test_get_job(self):
        topo = Topology("job_in_result_test")
        topo.source(["foo"])

        sc = rest.StreamsConnection(username=self.username, password=self.password)
        sc.session.verify = False
        config = {ConfigParams.STREAMS_CONNECTION : sc}

        tester = Tester(topo)
        self.tester = tester

        tester.local_check = self._correct_job_ids
        tester.test(self.test_ctxtype, config)
示例#8
0
 def initialize_rest(self):
     if not self.is_rest_initialized:
         if self.streams_connection_config['username'] is None or \
            self.streams_connection_config['password'] is None or \
            self.streams_connection_config['rest_api_url'] is None:
             raise ValueError(
                 "WARNING: A username, a password, and a rest url must be present in order to access view data"
             )
         from streamsx import rest
         rc = rest.StreamsConnection(
             self.streams_connection_config['username'],
             self.streams_connection_config['password'],
             self.streams_connection_config['rest_api_url'])
         self.is_rest_initialized = True
         self.set_streams_connection(rc)
    def test_view_from_connection(self):
        """ Test a view of strings
        """
        if self.test_ctxtype != context.ContextTypes.DISTRIBUTED:
            self.skipTest('Distributed only')
        sc = rest.StreamsConnection()
        sc.session.verify = False
        self.test_config[context.ConfigParams.STREAMS_CONNECTION] = sc

        topo = Topology()
        s = topo.source(rands)
        throttle = op.Map('spl.utility::Throttle', s, params={'rate': 25.0})
        s = throttle.stream
        s = s.map(lambda t: "ABC" + str(t))
        s = s.as_string()
        self._ov = s.view()
        self._expected_type = str

        tester = Tester(topo)
        tester.local_check = self._object_view
        tester.tuple_count(s, 1000, exact=False)
        tester.test(self.test_ctxtype, self.test_config)
示例#10
0
 def streams_connection(self):
     if self._streams_connection is None:
         self._streams_connection = rest.StreamsConnection(
             self.username, self.password)
     return self._streams_connection
示例#11
0
 def test_StreamsConnection(self):
     sc = rest.StreamsConnection('user1', 'pass1')
     self.test_config[ConfigParams.STREAMS_CONNECTION] = sc
     with self.assertRaises(ValueError):
         submit(self.test_ctxtype, self.topo, self.test_config)
示例#12
0
 def setUp(self):
     Tester.setup_streaming_analytics(self, force_remote_build=True)
     self.sc = rest.StreamsConnection(config=self.test_config)
示例#13
0
 def test_submit(self):
     sc = rest.StreamsConnection()
     sc.session.verify = False
     self.test_config[ConfigParams.STREAMS_CONNECTION] = sc
     sr = submit(self.test_ctxtype, self.topo, self.test_config)
     sr.job.cancel()