Skip to content

Commit

Permalink
fix: use local messages for resources
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fenster committed Apr 14, 2020
1 parent dbfcc4b commit 01ae6ad
Show file tree
Hide file tree
Showing 18 changed files with 110 additions and 2,541 deletions.
39 changes: 0 additions & 39 deletions baselines/logging/src/v2/logging_service_v2_client.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ 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 @@ -1554,42 +1551,6 @@ 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: 0 additions & 39 deletions baselines/logging/src/v2/metrics_service_v2_client.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ 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 @@ -1188,42 +1185,6 @@ 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: 0 additions & 38 deletions baselines/logging/test/gapic_logging_service_v2_v2.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -1237,44 +1237,6 @@ 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: 0 additions & 38 deletions baselines/logging/test/gapic_metrics_service_v2_v2.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -1105,44 +1105,6 @@ 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

0 comments on commit 01ae6ad

Please sign in to comment.