Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
billwert committed Nov 17, 2023
1 parent 2727f34 commit 78df4c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.azure.core.models.CloudEvent;
import com.azure.core.models.CloudEventDataFormat;
import com.azure.core.util.BinaryData;
import com.azure.core.util.Configuration;
import com.azure.messaging.eventgrid.models.AcknowledgeOptions;
import com.azure.messaging.eventgrid.models.AcknowledgeResult;
import com.azure.messaging.eventgrid.models.ReceiveResult;
Expand All @@ -33,8 +32,8 @@ class EventGridClientTest extends EventGridTestBase {



public static final String TOPIC_NAME = Configuration.getGlobalConfiguration().get(EVENTGRID_TOPIC_NAME);
public static final String EVENT_SUBSCRIPTION_NAME = Configuration.getGlobalConfiguration().get(EVENTGRID_EVENT_SUBSCRIPTION_NAME);
public static final String TOPIC_NAME = "testtopic1";
public static final String EVENT_SUBSCRIPTION_NAME = "testsubscription1";

private EventGridClientBuilder asyncBuilder;
private EventGridClientBuilder syncBuilder;
Expand Down Expand Up @@ -66,7 +65,7 @@ EventGridClientBuilder buildClientBuilder() {
return new EventGridClientBuilder()
.httpClient(HttpClient.createDefault())
.httpLogOptions(new HttpLogOptions())
.endpoint(Configuration.getGlobalConfiguration().get(EVENTGRID_ENDPOINT))
.endpoint(getTopicEndpoint(EVENTGRID_ENDPOINT))
.serviceVersion(EventGridMessagingServiceVersion.V2023_10_01_PREVIEW)
.credential(getKey(EVENTGRID_KEY));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class EventGridTestBase extends TestProxyTestBase {
static final String EVENTGRID_KEY = "EVENTGRID_KEY";

static final String DUMMY_ENDPOINT = "https://www.dummyEndpoint.com/api/events";
static final String DUMMY_TOPIC_ENDPOINT = "https://www.dummyEndpoint.com";

static final String DUMMY_KEY = "dummyKey";

Expand Down Expand Up @@ -147,6 +148,15 @@ String getEndpoint(String liveEnvName) {
return endpoint;
}

String getTopicEndpoint(String liveEnvName) {
if (interceptorManager.isPlaybackMode()) {
return DUMMY_TOPIC_ENDPOINT;
}
String endpoint = Configuration.getGlobalConfiguration().get(liveEnvName);
assertNotNull(endpoint, "System environment variable " + liveEnvName + " is null");
return endpoint;
}

AzureKeyCredential getKey(String liveEnvName) {
if (interceptorManager.isPlaybackMode()) {
return new AzureKeyCredential(DUMMY_KEY);
Expand Down

0 comments on commit 78df4c8

Please sign in to comment.