Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: process messages from all files #418

Merged
merged 3 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions baselines/logging/src/v2/logging_service_v2_client.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ export class LoggingServiceV2Client {
folderSinkPathTemplate: new this._gaxModule.PathTemplate(
'folders/{folder}/sinks/{sink}'
),
locationPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/locations/{location}'
),
logMetricPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/metrics/{metric}'
),
Expand Down Expand Up @@ -1551,6 +1554,42 @@ export class LoggingServiceV2Client {
return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink;
}

/**
* Return a fully-qualified location resource name string.
*
* @param {string} project
* @param {string} location
* @returns {string} Resource name string.
*/
locationPath(project:string,location:string) {
return this.pathTemplates.locationPathTemplate.render({
project: project,
location: location,
});
}

/**
* Parse the project from Location resource.
*
* @param {string} locationName
* A fully-qualified path representing Location resource.
* @returns {string} A string representing the project.
*/
matchProjectFromLocationName(locationName: string) {
return this.pathTemplates.locationPathTemplate.match(locationName).project;
}

/**
* Parse the location from Location resource.
*
* @param {string} locationName
* A fully-qualified path representing Location resource.
* @returns {string} A string representing the location.
*/
matchLocationFromLocationName(locationName: string) {
return this.pathTemplates.locationPathTemplate.match(locationName).location;
}

/**
* Return a fully-qualified logMetric resource name string.
*
Expand Down
39 changes: 39 additions & 0 deletions baselines/logging/src/v2/metrics_service_v2_client.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ export class MetricsServiceV2Client {
folderSinkPathTemplate: new this._gaxModule.PathTemplate(
'folders/{folder}/sinks/{sink}'
),
locationPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/locations/{location}'
),
logMetricPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/metrics/{metric}'
),
Expand Down Expand Up @@ -1185,6 +1188,42 @@ export class MetricsServiceV2Client {
return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink;
}

/**
* Return a fully-qualified location resource name string.
*
* @param {string} project
* @param {string} location
* @returns {string} Resource name string.
*/
locationPath(project:string,location:string) {
return this.pathTemplates.locationPathTemplate.render({
project: project,
location: location,
});
}

/**
* Parse the project from Location resource.
*
* @param {string} locationName
* A fully-qualified path representing Location resource.
* @returns {string} A string representing the project.
*/
matchProjectFromLocationName(locationName: string) {
return this.pathTemplates.locationPathTemplate.match(locationName).project;
}

/**
* Parse the location from Location resource.
*
* @param {string} locationName
* A fully-qualified path representing Location resource.
* @returns {string} A string representing the location.
*/
matchLocationFromLocationName(locationName: string) {
return this.pathTemplates.locationPathTemplate.match(locationName).location;
}

/**
* Return a fully-qualified logMetric resource name string.
*
Expand Down
38 changes: 38 additions & 0 deletions baselines/logging/test/gapic_logging_service_v2_v2.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,44 @@ describe('v2.LoggingServiceV2Client', () => {
});
});

describe('location', () => {
const fakePath = "/rendered/path/location";
const expectedParameters = {
project: "projectValue",
location: "locationValue",
};
const client = new loggingservicev2Module.v2.LoggingServiceV2Client({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
client.pathTemplates.locationPathTemplate.render =
sinon.stub().returns(fakePath);
client.pathTemplates.locationPathTemplate.match =
sinon.stub().returns(expectedParameters);

it('locationPath', () => {
const result = client.locationPath("projectValue", "locationValue");
assert.strictEqual(result, fakePath);
assert((client.pathTemplates.locationPathTemplate.render as SinonStub)
.getCall(-1).calledWith(expectedParameters));
});

it('matchProjectFromLocationName', () => {
const result = client.matchProjectFromLocationName(fakePath);
assert.strictEqual(result, "projectValue");
assert((client.pathTemplates.locationPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath));
});

it('matchLocationFromLocationName', () => {
const result = client.matchLocationFromLocationName(fakePath);
assert.strictEqual(result, "locationValue");
assert((client.pathTemplates.locationPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath));
});
});

describe('logMetric', () => {
const fakePath = "/rendered/path/logMetric";
const expectedParameters = {
Expand Down
38 changes: 38 additions & 0 deletions baselines/logging/test/gapic_metrics_service_v2_v2.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,44 @@ describe('v2.MetricsServiceV2Client', () => {
});
});

describe('location', () => {
const fakePath = "/rendered/path/location";
const expectedParameters = {
project: "projectValue",
location: "locationValue",
};
const client = new metricsservicev2Module.v2.MetricsServiceV2Client({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
client.pathTemplates.locationPathTemplate.render =
sinon.stub().returns(fakePath);
client.pathTemplates.locationPathTemplate.match =
sinon.stub().returns(expectedParameters);

it('locationPath', () => {
const result = client.locationPath("projectValue", "locationValue");
assert.strictEqual(result, fakePath);
assert((client.pathTemplates.locationPathTemplate.render as SinonStub)
.getCall(-1).calledWith(expectedParameters));
});

it('matchProjectFromLocationName', () => {
const result = client.matchProjectFromLocationName(fakePath);
assert.strictEqual(result, "projectValue");
assert((client.pathTemplates.locationPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath));
});

it('matchLocationFromLocationName', () => {
const result = client.matchLocationFromLocationName(fakePath);
assert.strictEqual(result, "locationValue");
assert((client.pathTemplates.locationPathTemplate.match as SinonStub)
.getCall(-1).calledWith(fakePath));
});
});

describe('logMetric', () => {
const fakePath = "/rendered/path/logMetric";
const expectedParameters = {
Expand Down
Loading