Skip to content

Commit a1aa39c

Browse files
Merge pull request #882 from watson-developer-cloud/codegen/personality-insights
[Personality Insights] Add newest generated code and update tests
2 parents 8bf9255 + 8409545 commit a1aa39c

File tree

8 files changed

+37
-255
lines changed

8 files changed

+37
-255
lines changed

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/PersonalityInsights.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ public PersonalityInsights(String versionDate) {
7777
setEndPoint(URL);
7878
}
7979

80-
Validator.isTrue((versionDate != null) && !versionDate.isEmpty(),
81-
"'version cannot be null.");
80+
Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null.");
8281

8382
this.versionDate = versionDate;
8483
}
@@ -157,8 +156,9 @@ public ServiceCall<String> getProfileAsCSV(ProfileOptions profileOptions, boolea
157156
}
158157

159158
builder.header(HttpHeaders.ACCEPT, HttpMediaType.TEXT_CSV);
160-
builder.query("headers", includeHeaders);
159+
builder.query("csv_headers", includeHeaders);
161160

162161
return createServiceCall(builder.build(), ResponseConverterUtils.getString());
163162
}
163+
164164
}

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Behavior.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -70,40 +70,4 @@ public String getCategory() {
7070
public Double getPercentage() {
7171
return percentage;
7272
}
73-
74-
/**
75-
* Sets the traitId.
76-
*
77-
* @param traitId the new traitId
78-
*/
79-
public void setTraitId(final String traitId) {
80-
this.traitId = traitId;
81-
}
82-
83-
/**
84-
* Sets the name.
85-
*
86-
* @param name the new name
87-
*/
88-
public void setName(final String name) {
89-
this.name = name;
90-
}
91-
92-
/**
93-
* Sets the category.
94-
*
95-
* @param category the new category
96-
*/
97-
public void setCategory(final String category) {
98-
this.category = category;
99-
}
100-
101-
/**
102-
* Sets the percentage.
103-
*
104-
* @param percentage the new percentage
105-
*/
106-
public void setPercentage(final Double percentage) {
107-
this.percentage = percentage;
108-
}
10973
}

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferences.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,31 +60,4 @@ public String getName() {
6060
public Double getScore() {
6161
return score;
6262
}
63-
64-
/**
65-
* Sets the consumptionPreferenceId.
66-
*
67-
* @param consumptionPreferenceId the new consumptionPreferenceId
68-
*/
69-
public void setConsumptionPreferenceId(final String consumptionPreferenceId) {
70-
this.consumptionPreferenceId = consumptionPreferenceId;
71-
}
72-
73-
/**
74-
* Sets the name.
75-
*
76-
* @param name the new name
77-
*/
78-
public void setName(final String name) {
79-
this.name = name;
80-
}
81-
82-
/**
83-
* Sets the score.
84-
*
85-
* @param score the new score
86-
*/
87-
public void setScore(final Double score) {
88-
this.score = score;
89-
}
9063
}

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/ConsumptionPreferencesCategory.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,4 @@ public String getName() {
6161
public List<ConsumptionPreferences> getConsumptionPreferences() {
6262
return consumptionPreferences;
6363
}
64-
65-
/**
66-
* Sets the consumptionPreferenceCategoryId.
67-
*
68-
* @param consumptionPreferenceCategoryId the new consumptionPreferenceCategoryId
69-
*/
70-
public void setConsumptionPreferenceCategoryId(final String consumptionPreferenceCategoryId) {
71-
this.consumptionPreferenceCategoryId = consumptionPreferenceCategoryId;
72-
}
73-
74-
/**
75-
* Sets the name.
76-
*
77-
* @param name the new name
78-
*/
79-
public void setName(final String name) {
80-
this.name = name;
81-
}
82-
83-
/**
84-
* Sets the consumptionPreferences.
85-
*
86-
* @param consumptionPreferences the new consumptionPreferences
87-
*/
88-
public void setConsumptionPreferences(final List<ConsumptionPreferences> consumptionPreferences) {
89-
this.consumptionPreferences = consumptionPreferences;
90-
}
9164
}

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Profile.java

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -156,85 +156,4 @@ public List<ConsumptionPreferencesCategory> getConsumptionPreferences() {
156156
public List<Warning> getWarnings() {
157157
return warnings;
158158
}
159-
160-
/**
161-
* Sets the processedLanguage.
162-
*
163-
* @param processedLanguage the new processedLanguage
164-
*/
165-
public void setProcessedLanguage(final String processedLanguage) {
166-
this.processedLanguage = processedLanguage;
167-
}
168-
169-
/**
170-
* Sets the wordCount.
171-
*
172-
* @param wordCount the new wordCount
173-
*/
174-
public void setWordCount(final long wordCount) {
175-
this.wordCount = wordCount;
176-
}
177-
178-
/**
179-
* Sets the wordCountMessage.
180-
*
181-
* @param wordCountMessage the new wordCountMessage
182-
*/
183-
public void setWordCountMessage(final String wordCountMessage) {
184-
this.wordCountMessage = wordCountMessage;
185-
}
186-
187-
/**
188-
* Sets the personality.
189-
*
190-
* @param personality the new personality
191-
*/
192-
public void setPersonality(final List<Trait> personality) {
193-
this.personality = personality;
194-
}
195-
196-
/**
197-
* Sets the values.
198-
*
199-
* @param values the new values
200-
*/
201-
public void setValues(final List<Trait> values) {
202-
this.values = values;
203-
}
204-
205-
/**
206-
* Sets the needs.
207-
*
208-
* @param needs the new needs
209-
*/
210-
public void setNeeds(final List<Trait> needs) {
211-
this.needs = needs;
212-
}
213-
214-
/**
215-
* Sets the behavior.
216-
*
217-
* @param behavior the new behavior
218-
*/
219-
public void setBehavior(final List<Behavior> behavior) {
220-
this.behavior = behavior;
221-
}
222-
223-
/**
224-
* Sets the consumptionPreferences.
225-
*
226-
* @param consumptionPreferences the new consumptionPreferences
227-
*/
228-
public void setConsumptionPreferences(final List<ConsumptionPreferencesCategory> consumptionPreferences) {
229-
this.consumptionPreferences = consumptionPreferences;
230-
}
231-
232-
/**
233-
* Sets the warnings.
234-
*
235-
* @param warnings the new warnings
236-
*/
237-
public void setWarnings(final List<Warning> warnings) {
238-
this.warnings = warnings;
239-
}
240159
}

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Trait.java

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -135,67 +135,4 @@ public Boolean isSignificant() {
135135
public List<Trait> getChildren() {
136136
return children;
137137
}
138-
139-
/**
140-
* Sets the traitId.
141-
*
142-
* @param traitId the new traitId
143-
*/
144-
public void setTraitId(final String traitId) {
145-
this.traitId = traitId;
146-
}
147-
148-
/**
149-
* Sets the name.
150-
*
151-
* @param name the new name
152-
*/
153-
public void setName(final String name) {
154-
this.name = name;
155-
}
156-
157-
/**
158-
* Sets the category.
159-
*
160-
* @param category the new category
161-
*/
162-
public void setCategory(final String category) {
163-
this.category = category;
164-
}
165-
166-
/**
167-
* Sets the percentile.
168-
*
169-
* @param percentile the new percentile
170-
*/
171-
public void setPercentile(final Double percentile) {
172-
this.percentile = percentile;
173-
}
174-
175-
/**
176-
* Sets the rawScore.
177-
*
178-
* @param rawScore the new rawScore
179-
*/
180-
public void setRawScore(final Double rawScore) {
181-
this.rawScore = rawScore;
182-
}
183-
184-
/**
185-
* Sets the significant.
186-
*
187-
* @param significant the new significant
188-
*/
189-
public void setSignificant(final Boolean significant) {
190-
this.significant = significant;
191-
}
192-
193-
/**
194-
* Sets the children.
195-
*
196-
* @param children the new children
197-
*/
198-
public void setChildren(final List<Trait> children) {
199-
this.children = children;
200-
}
201138
}

personality-insights/src/main/java/com/ibm/watson/developer_cloud/personality_insights/v3/model/Warning.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,4 @@ public String getWarningId() {
6767
public String getMessage() {
6868
return message;
6969
}
70-
71-
/**
72-
* Sets the warningId.
73-
*
74-
* @param warningId the new warningId
75-
*/
76-
public void setWarningId(final String warningId) {
77-
this.warningId = warningId;
78-
}
79-
80-
/**
81-
* Sets the message.
82-
*
83-
* @param message the new message
84-
*/
85-
public void setMessage(final String message) {
86-
this.message = message;
87-
}
8870
}

personality-insights/src/test/java/com/ibm/watson/developer_cloud/personality_insights/v3/PersonalityInsightsIT.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,40 @@ public void getProfileWithText() throws Exception {
112112
Assert.assertNotNull(profile.getPersonality());
113113
}
114114

115+
/**
116+
* Gets the profile with text as a CSV string without headers.
117+
*
118+
* @throws Exception the exception
119+
*/
120+
@Test
121+
public void getProfileWithTextAsCSVNoHeaders() throws Exception {
122+
File file = new File(RESOURCE + "en.txt");
123+
String englishText = getStringFromInputStream(new FileInputStream(file));
124+
125+
ProfileOptions options = new ProfileOptions.Builder().text(englishText).build();
126+
String profileString = service.getProfileAsCSV(options, false).execute();
127+
128+
Assert.assertNotNull(profileString);
129+
Assert.assertTrue(profileString.split("\n").length == 1);
130+
}
131+
132+
/**
133+
* Gets the profile with text as a CSV string with headers.
134+
*
135+
* @throws Exception the exception
136+
*/
137+
@Test
138+
public void getProfileWithTextAsCSVWithHeaders() throws Exception {
139+
File file = new File(RESOURCE + "en.txt");
140+
String englishText = getStringFromInputStream(new FileInputStream(file));
141+
142+
ProfileOptions options = new ProfileOptions.Builder().text(englishText).build();
143+
String profileString = service.getProfileAsCSV(options, true).execute();
144+
145+
Assert.assertNotNull(profileString);
146+
Assert.assertTrue(profileString.split("\n").length == 2);
147+
}
148+
115149
/**
116150
* Assert profile.
117151
*

0 commit comments

Comments
 (0)