Skip to content

Commit

Permalink
samples: update shared config (#2443)
Browse files Browse the repository at this point in the history
* update shared config

* Update to 1.0.13

* lint

* Fix linting

* lint

* fix imports

Co-authored-by: Les Vogel <lesv@users.noreply.github.com>
  • Loading branch information
2 people authored and Shabirmean committed Nov 17, 2022
1 parent 998be08 commit 71ef3d6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public static void main(String... args) throws Exception {

// The text to analyze
String text = "Hello, world!";
Document doc = Document.newBuilder()
.setContent(text).setType(Type.PLAIN_TEXT).build();
Document doc = Document.newBuilder().setContent(text).setType(Type.PLAIN_TEXT).build();

// Detects the sentiment of the text
Sentiment sentiment = language.analyzeSentiment(doc).getDocumentSentiment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@
import com.google.cloud.language.v1.LanguageServiceClient;
import com.google.cloud.language.v1.LanguageServiceSettings;
import com.google.cloud.language.v1.Sentiment;

import java.io.IOException;

class SetEndpoint {

// Change your endpoint
static void setEndpoint() throws IOException {
// [START language_set_endpoint]
LanguageServiceSettings settings = LanguageServiceSettings.newBuilder()
.setEndpoint("eu-language.googleapis.com:443")
.build();
LanguageServiceSettings settings =
LanguageServiceSettings.newBuilder().setEndpoint("eu-language.googleapis.com:443").build();

// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
Expand All @@ -40,8 +38,7 @@ static void setEndpoint() throws IOException {

// The text to analyze
String text = "Hello, world!";
Document doc = Document.newBuilder()
.setContent(text).setType(Document.Type.PLAIN_TEXT).build();
Document doc = Document.newBuilder().setContent(text).setType(Document.Type.PLAIN_TEXT).build();

// Detects the sentiment of the text
Sentiment sentiment = client.analyzeSentiment(doc).getDocumentSentiment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests for quickstart sample.
*/
/** Tests for quickstart sample. */
@RunWith(JUnit4.class)
@SuppressWarnings("checkstyle:abbreviationaswordinname")
public class QuickstartSampleIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -36,7 +35,6 @@ public class SetEndpointIT {
private ByteArrayOutputStream bout;
private PrintStream out;


@Before
public void setUp() {
bout = new ByteArrayOutputStream();
Expand All @@ -49,7 +47,6 @@ public void tearDown() {
System.setOut(null);
}


@Test
public void testSetEndpoint() throws IOException {
// Act
Expand Down

0 comments on commit 71ef3d6

Please sign in to comment.