-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
talent-solution: added missing custom attributes (#2327)
* second part 2 of Cloud Talent solution * renamed lengthy class names * added missing custom attributes into createJob * removed the extra space * Update jobs/v4/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java Co-Authored-By: Noah Negrey <[email protected]> * fixed getjob test Co-authored-by: Noah Negrey <[email protected]>
- Loading branch information
1 parent
8186869
commit 9c7a4a7
Showing
4 changed files
with
97 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
jobs/v4/src/test/java/JobSearchCreateJobWithCustomAttrTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
import com.example.jobs.JobSearchCreateJobCustomAttributes; | ||
import com.example.jobs.JobSearchDeleteJob; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.io.PrintStream; | ||
import java.util.UUID; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class JobSearchCreateJobWithCustomAttrTest { | ||
private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); | ||
private static final String TENANT_ID = "50c14f00-dc38-4812-989b-d9b59c7fdf07"; | ||
private static final String COMPANY_ID = "bdad284d-9aca-4cb9-af09-ce65afcc5d6a"; | ||
private static final String POST_UNIQUE_ID = | ||
String.format( | ||
"TEST_POST_ID_%s", | ||
UUID.randomUUID().toString().substring(0, 20)); // Posting ID. Unique per job. | ||
|
||
private String jobId; | ||
private ByteArrayOutputStream bout; | ||
private PrintStream out; | ||
|
||
@Before | ||
public void setUp() { | ||
bout = new ByteArrayOutputStream(); | ||
out = new PrintStream(bout); | ||
System.setOut(out); | ||
} | ||
|
||
@Test | ||
public void testCreateJob() throws IOException { | ||
// create a job with custom attributes. | ||
JobSearchCreateJobCustomAttributes.createJob( | ||
PROJECT_ID, TENANT_ID, COMPANY_ID, POST_UNIQUE_ID); | ||
String got = bout.toString(); | ||
|
||
assertThat(got).contains("Created job:"); | ||
jobId = JobSearchGetJobTest.extractLastId(got.split("\n")[0].trim()); | ||
|
||
bout = new ByteArrayOutputStream(); | ||
out = new PrintStream(bout); | ||
System.setOut(out); | ||
} | ||
|
||
@After | ||
public void tearDown() throws IOException { | ||
// delete that job. | ||
JobSearchDeleteJob.deleteJob(PROJECT_ID, TENANT_ID, jobId); | ||
String got = bout.toString(); | ||
assertThat(got).contains("Deleted job"); | ||
System.setOut(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters