diff --git a/configuration/datawarehouse.d/jobefficiency.json b/configuration/datawarehouse.d/jobefficiency.json index 6d83850e..79f7cdfe 100644 --- a/configuration/datawarehouse.d/jobefficiency.json +++ b/configuration/datawarehouse.d/jobefficiency.json @@ -3,6 +3,7 @@ "JobEfficiency": { "schema": "N/A", "table": "N/A", + "show_in_catalog": false, "datasource": "SUPREMM", "group_bys": [ { diff --git a/tests/integration_tests/lib/Controllers/MetricExplorerControllerTest.php b/tests/integration_tests/lib/Controllers/MetricExplorerControllerTest.php new file mode 100644 index 00000000..f1cd38e2 --- /dev/null +++ b/tests/integration_tests/lib/Controllers/MetricExplorerControllerTest.php @@ -0,0 +1,26 @@ +authenticate('cd'); + + $response = $helper->post('/controllers/metric_explorer.php', null, array('operation' => 'get_dw_descripter')); + + $this->assertEquals('application/json', $response[1]['content_type']); + $this->assertEquals(200, $response[1]['http_code']); + + $dwdata = $response[0]; + + $this->assertArrayHasKey('SUPREMM', $dwdata['data']['0']['realms']); + $this->assertArrayNotHasKey('JobEfficiency', $dwdata['data']['0']['realms']); + } +} diff --git a/tests/integration_tests/lib/Controllers/UserInterfaceControllerTest.php b/tests/integration_tests/lib/Controllers/UserInterfaceControllerTest.php new file mode 100644 index 00000000..4ea3cb3f --- /dev/null +++ b/tests/integration_tests/lib/Controllers/UserInterfaceControllerTest.php @@ -0,0 +1,46 @@ +authenticate('cd'); + + $params = array( + 'operation' => 'get_menus', + 'node' => 'category_', + 'public_user' => false, + 'query_group' => 'tg_usage' + ); + + $response = $helper->post('/controllers/user_interface.php', null, $params); + + $this->assertEquals('application/json', $response[1]['content_type']); + $this->assertEquals(200, $response[1]['http_code']); + + $data = $response[0]; + + $realms = array(); + foreach ($data as $menuitem) { + if (isset($menuitem['realm'])) { + if (!isset($realms[$menuitem['realm']])) { + $realms[$menuitem['realm']] = 0; + } + $realms[$menuitem['realm']] += 1; + } + } + + $this->assertArrayHasKey('SUPREMM', $realms); + $this->assertArrayNotHasKey('JobEfficiency', $realms); + + // The count represents the number of group bys in the realm + $this->assertTrue($realms['SUPREMM'] > 29); + } +} diff --git a/tests/integration_tests/lib/REST/Warehouse/DataTest.php b/tests/integration_tests/lib/REST/Warehouse/DataTest.php new file mode 100644 index 00000000..79430f8a --- /dev/null +++ b/tests/integration_tests/lib/REST/Warehouse/DataTest.php @@ -0,0 +1,62 @@ +authenticate('cd'); + } + + public static function tearDownAfterClass() + { + self::$xdmodhelper->logout(); + } + + public function testRealms() { + + $response = self::$xdmodhelper->get(self::ENDPOINT . 'realms', array()); + + $this->assertEquals(200, $response[1]['http_code']); + + $data = $response[0]; + $this->assertTrue($data['success']); + + $this->assertContains('SUPREMM', $data['results']); + $this->assertContains('JobEfficiency', $data['results']); + } + + public function testAggregateData() { + + $params = array( + 'start' => 0, + 'limit' => 10, + 'config' => json_encode(array( + 'realm' => 'JobEfficiency', + 'group_by' => 'person', + 'statistics' => array('core_time_bad', 'bad_core_ratio'), + 'aggregation_unit' => 'day', + 'start_date' => '2016-12-01', + 'end_date' => '2017-01-01', + 'order_by' => array('field' => 'core_time_bad', 'dirn' => 'desc') + )) + ); + $response = self::$xdmodhelper->get(self::ENDPOINT . 'aggregatedata', $params); + + $this->assertEquals(200, $response[1]['http_code']); + + $data = $response[0]; + $this->assertArrayHasKey('success', $data); + $this->assertArrayHasKey('results', $data); + $this->assertArrayHasKey('total', $data); + + $this->assertTrue($data['success']); + $this->assertEquals(min($data['total'], $params['limit']), count($data['results'])); + } +}