Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ configurations {
// Test things
dependencies {
intTestImplementation "junit:junit:4.13.2"
intTestImplementation "org.assertj:assertj-core:3.26.3"
}

tasks.register('integrationTest', Test) {
Expand Down
33 changes: 33 additions & 0 deletions src/intTest/java/TestClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import com.authzed.api.v1.ExperimentalServiceGrpc;
import com.authzed.api.v1.PermissionsServiceGrpc;
import com.authzed.api.v1.SchemaServiceGrpc;
import com.authzed.grpcutil.BearerToken;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;

import java.util.Random;

public class TestClient {
private static final String tokenPrefix = "tc_test_token";

public SchemaServiceGrpc.SchemaServiceBlockingStub schemaService;
public PermissionsServiceGrpc.PermissionsServiceBlockingStub permissionsService;
public PermissionsServiceGrpc.PermissionsServiceStub asyncPermissionsService;
public ExperimentalServiceGrpc.ExperimentalServiceBlockingStub experimentalService;
public TestClient() {
ManagedChannel channel = ManagedChannelBuilder.forTarget("localhost:50051").usePlaintext().build();
String token = generateToken();
schemaService = SchemaServiceGrpc.newBlockingStub(channel)
.withCallCredentials(new BearerToken(token));
permissionsService = PermissionsServiceGrpc.newBlockingStub(channel)
.withCallCredentials(new BearerToken(token));
asyncPermissionsService = PermissionsServiceGrpc.newStub(channel)
.withCallCredentials(new BearerToken(token));
experimentalService = ExperimentalServiceGrpc.newBlockingStub(channel)
.withCallCredentials(new BearerToken(token));
}
public String generateToken() {
Random random = new Random();
return tokenPrefix + random.nextInt(1000);
}
}
Loading
Loading