8000 small changes test and added sleep time between search func (#2547) · doinotlikeit/java-docs-samples@6a24be1 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6a24be1

Browse files
authored
small changes test and added sleep time between search func (GoogleCloudPlatform#2547)
* small changes test and added sleep time between search func * fixed the lint
1 parent 757f023 commit 6a24be1

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

jobs/v3/src/main/java/com/google/samples/FeaturedJobsSearchSample.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,24 @@
3131
/**
3232
* The sample in this file introduce featured job, including:
3333
*
34-
* - Construct a featured job
34+
* <p>- Construct a featured job
3535
*
36-
* - Search featured job
36+
* <p>- Search featured job
3737
*/
3838
public final class FeaturedJobsSearchSample {
3939

4040
private static final String DEFAULT_PROJECT_ID =
4141
"projects/" + System.getenv("GOOGLE_CLOUD_PROJECT");
4242

43-
private static CloudTalentSolution talentSolutionClient = JobServiceQuickstart
44-
.getTalentSolutionClient();
43+
private static CloudTalentSolution talentSolutionClient =
44+
JobServiceQuickstart.getTalentSolutionClient();
4545

4646
// [START featured_job]
4747

48-
/**
49-
* Creates a job as featured.
50-
*/
48+
/** Creates a job as featured. */
5149
public static Job generateFeaturedJob(String companyName) throws IOException {
5250
// requisition id should be a unique Id in your system.
53-
String requisitionId =
54-
"featuredJob:" + String.valueOf(new Random().nextLong());
51+
String requisitionId = "featuredJob:" + String.valueOf(new Random().nextLong());
5552
ApplicationInfo applicationInfo =
5653
new ApplicationInfo().setUris(Arrays.asList("http://careers.google.com"));
5754

@@ -61,8 +58,7 @@ public static Job generateFeaturedJob(String companyName) throws IOException {
6158
.setTitle("Software Engineer")
6259
.setCompanyName(companyName)
6360
.setApplicationInfo(applicationInfo)
64-
.setDescription(
65-
"Design, develop, test, deploy, maintain and improve software.")
61+
.setDescription("Design, develop, test, deploy, maintain and improve software.")
6662
// Featured job is the job with positive promotion value
6763
.setPromotionValue(2);
6864
System.out.println("Job generated: " + job);
@@ -72,9 +68,7 @@ public static Job generateFeaturedJob(String companyName) throws IOException {
7268

7369
// [START search_featured_job]
7470

75-
/**
76-
* Searches featured jobs.
77-
*/
71+
/** Searches featured jobs. */
7872
public static void searchFeaturedJobs(String companyName) throws IOException {
7973
// Make sure to set the requestMetadata the same as the associated search request
8074
RequestMetadata requestMetadata =
@@ -113,12 +107,13 @@ public static void main(String... args) throws Exception {
113107
String companyName = BasicCompanySample.createCompany(companyToBeCreated).getName();
114108

115109
Job jobToBeCreated = generateFeaturedJob(companyName);
116-
String jobName = BasicJobSample.createJob(jobToBeCreated).getName();
110+
final String jobName = BasicJobSample.createJob(jobToBeCreated).getName();
117111

118112
// Wait several seconds for post processing
119-
Thread.sleep(10000);
113+
Thread.sleep(5000);
120114
searchFeaturedJobs(companyName);
121115

116+
Thread.sleep(5000);
122117
BasicJobSample.deleteJob(jobName);
123118
BasicCompanySample.deleteCompany(companyName);
124119
}

jobs/v3/src/test/java/SampleTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ public void customAttributeSampleTest() throws Exception {
122122
assertThat(bout.toString())
123123
.containsMatch(
124124
".*Job created:.*jobWithACustomAttribute.*\n"
125-
+ ".*matchingJobs.*jobWithACustomAttribute.*\n"
126-
+ ".*matchingJobs.*jobWithACustomAttribute.*\n"
127125
+ ".*matchingJobs.*jobWithACustomAttribute.*\n");
128126
bout.reset();
129127
}

0 commit comments

Comments
 (0)
0