hawq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shivzone <...@git.apache.org>
Subject [GitHub] incubator-hawq pull request: Hawq 257
Date Tue, 22 Dec 2015 00:31:01 GMT
Github user shivzone commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/206#discussion_r48209738
  
    --- Diff: src/backend/access/external/test/pxfuriparser_test.c ---
    @@ -76,6 +77,87 @@ test__parseGPHDUri__ValidURI(void **state)
     }
     
     /*
    + * Test parsing of valid uri with with nameservice instead of host and port
    + * as given in LOCATION in a PXF external table.
    + */
    +void
    +test__parseGPHDUri__ValidURI_HA(void **state)
    +{
    +	char* uri = "pxf://hanameservice/some/path/and/table.tbl?FRAGMENTER=SomeFragmenter&ACCESSOR=SomeAccessor&RESOLVER=SomeResolver&ANALYZER=SomeAnalyzer";
    +	List* options = NIL;
    +	ListCell* cell = NULL;
    +	OptionData* option = NULL;
    +
    +	/* mock GPHD_HA_load_nodes */
    +	NNHAConf* ha_conf = (NNHAConf *)palloc0(sizeof(NNHAConf));
    +	ha_conf->nameservice = "hanameservice";
    +	ha_conf->numn = 2;
    +	ha_conf->nodes = ((char**)palloc0(sizeof(char*) * 2));
    +	ha_conf->nodes[0] = "node1";
    +	ha_conf->restports = ((char**)palloc0(sizeof(char*) * 2));
    +	ha_conf->restports[0] = "1001";
    +	expect_string(GPHD_HA_load_nodes, nameservice, "hanameservice");
    +	will_return(GPHD_HA_load_nodes, ha_conf);
    +
    +	/* mode GPHD_HA_release_nodes */
    +	expect_value(GPHD_HA_release_nodes, conf, ha_conf);
    +	will_be_called(GPHD_HA_release_nodes);
    +
    +	GPHDUri* parsed = parseGPHDUri(uri);
    +
    +	assert_true(parsed != NULL);
    +	assert_string_equal(parsed->uri, uri);
    +
    +	assert_string_equal(parsed->protocol, "pxf");
    +	assert_string_equal(parsed->host, "node1"); /* value should be taken from ha_nodes
*/
    +	assert_string_equal(parsed->port, "1001"); /* it should be taken from ha_nodes */
    +	assert_false(parsed->ha_nodes == NULL);
    +	assert_string_equal(parsed->data, "some/path/and/table.tbl");
    +
    +	freeGPHDUri(parsed);
    +
    +	/* free NNHAConf */
    +	if (ha_conf)
    +	{
    +		pfree(ha_conf->nodes);
    +		pfree(ha_conf->restports);
    +		pfree(ha_conf);
    +	}
    +}
    +
    +/*
    + * Test parsing of valid uri as given in LOCATION in a PXF external table,
    + * with pxf_isilon set to true.
    + */
    +void
    +test__parseGPHDUri__ValidURI_Isilon(void **state)
    +{
    +	char* uri = "pxf://servername:5000/some/path/and/table.tbl?FRAGMENTER=SomeFragmenter&ACCESSOR=SomeAccessor&RESOLVER=SomeResolver&ANALYZER=SomeAnalyzer";
    +	List* options = NIL;
    +	ListCell* cell = NULL;
    +	OptionData* option = NULL;
    +
    +	/* set pxf_isilon to true */
    +	pxf_isilon = true;
    +
    +	GPHDUri* parsed = parseGPHDUri(uri);
    +
    +	assert_true(parsed != NULL);
    +	assert_string_equal(parsed->uri, uri);
    +
    +	assert_string_equal(parsed->protocol, "pxf");
    +	assert_string_equal(parsed->host, "servername");
    +	assert_int_equal(atoi(parsed->port), pxf_service_port); /* it should be pxf_service_port
*/
    +	assert_true(parsed->ha_nodes == NULL);
    +	assert_string_equal(parsed->data, "some/path/and/table.tbl");
    +
    +	freeGPHDUri(parsed);
    +
    +	/* set pxf_isilon back to false */
    +	pxf_isilon = false;
    --- End diff --
    
    is this required ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message