Skip to content

Commit

Permalink
Migrate Azure Storage Blob Changefeed to Test Proxy (#36678)
Browse files Browse the repository at this point in the history
Migrate Azure Storage Blob Changefeed to Test Proxy
  • Loading branch information
alzimmermsft authored Sep 8, 2023
1 parent 8fced9d commit 20281a6
Show file tree
Hide file tree
Showing 58 changed files with 2,326 additions and 11,555 deletions.
6 changes: 6 additions & 0 deletions sdk/storage/azure-storage-blob-changefeed/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/storage/azure-storage-blob-changefeed",
"Tag": "java/storage/azure-storage-blob-changefeed_da67b160a5"
}
69 changes: 19 additions & 50 deletions sdk/storage/azure-storage-blob-changefeed/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,18 @@
<!-- Configures the Java 9+ run to perform the required module exports, opens, and reads that are necessary for testing but shouldn't be part of the module-info. -->
<javaModulesSurefireArgLine>
--add-exports com.azure.core/com.azure.core.implementation.http=ALL-UNNAMED
--add-exports com.azure.core/com.azure.core.implementation.serializer.jackson=ALL-UNNAMED
--add-opens com.azure.storage.common/com.azure.storage.common.implementation=ALL-UNNAMED
--add-opens com.azure.storage.internal.avro/com.azure.storage.internal.avro.implementation=ALL-UNNAMED
--add-opens com.azure.storage.blob/com.azure.storage.blob=ALL-UNNAMED
--add-opens com.azure.storage.blob/com.azure.storage.blob.specialized=ALL-UNNAMED
--add-opens com.azure.storage.blob.changefeed/com.azure.storage.blob.changefeed=ALL-UNNAMED
--add-opens com.azure.storage.blob.changefeed/com.azure.storage.blob.changefeed.implementation.models=ALL-UNNAMED
--add-opens com.azure.storage.blob.changefeed/com.azure.storage.blob.changefeed.implementation.util=ALL-UNNAMED
--add-reads com.azure.core=ALL-UNNAMED
--add-reads com.azure.core.test=ALL-UNNAMED
--add-reads com.azure.core.amqp=ALL-UNNAMED
--add-reads com.azure.storage.common=ALL-UNNAMED
--add-reads com.azure.storage.blob=ALL-UNNAMED
--add-reads com.azure.storage.internal.avro=ALL-UNNAMED

--add-reads com.azure.storage.blob.changefeed=com.azure.http.netty
--add-reads com.azure.storage.blob.changefeed=com.azure.core.http.okhttp
</javaModulesSurefireArgLine>
<parallelizeLiveTests>true</parallelizeLiveTests>
</properties>

<dependencies>
Expand Down Expand Up @@ -115,18 +112,6 @@
<version>3.4.31</version> <!-- {x-version-update;io.projectreactor:reactor-test;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>adal4j</artifactId>
<version>1.6.5</version> <!-- {x-version-update;com.microsoft.azure:adal4j;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.2.7</version> <!-- {x-version-update;cglib:cglib-nodep;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -146,9 +131,21 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.4-M1-groovy-4.0</version> <!-- {x-version-update;org.spockframework:spock-core;external_dependency} -->
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-params;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -177,34 +174,6 @@
</rules>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>2.1.0</version> <!-- {x-version-update;org.codehaus.gmavenplus:gmavenplus-plugin;external_dependency} -->
<executions>
<execution>
<goals>
<goal>addTestSources</goal>
<goal>generateTestStubs</goal>
<goal>compileTests</goal>
<goal>removeTestStubs</goal>
</goals>
<phase>test-compile</phase>
</execution>
</executions>
<configuration>
<skipTests>${skipTestCompile}</skipTests>
<testSources>
<testSource>
<directory>${project.basedir}/src/test</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</testSource>
</testSources>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class BlobChangefeedAsyncClient {


private final ChangefeedFactory changefeedFactory;
final ChangefeedFactory changefeedFactory;

/**
* Package-private constructor for use by {@link BlobChangefeedClientBuilder}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@ServiceClient(builder = BlobChangefeedClientBuilder.class)
public class BlobChangefeedClient {

private final BlobChangefeedAsyncClient client;
final BlobChangefeedAsyncClient client;

/**
* Package-private constructor for use by {@link BlobChangefeedClientBuilder}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class Changefeed {

private static final ClientLogger LOGGER = new ClientLogger(Changefeed.class);

private static final String SEGMENT_PREFIX = "idx/segments/";
private static final String METADATA_SEGMENT_PATH = "meta/segments.json";
static final String SEGMENT_PREFIX = "idx/segments/";
static final String METADATA_SEGMENT_PATH = "meta/segments.json";

private final BlobContainerAsyncClient client; /* Changefeed container */
private final OffsetDateTime startTime; /* User provided start time. */
Expand Down Expand Up @@ -113,7 +113,7 @@ private Mono<Boolean> validateChangefeed() {
* Log files in any segment that is dated after the date of the LastConsumable property in the
* $blobchangefeed/meta/segments.json file, should not be consumed by your application.
*/
private Mono<OffsetDateTime> populateLastConsumable() {
Mono<OffsetDateTime> populateLastConsumable() {
/* We can keep the entire metadata file in memory since it is expected to only be a few hundred bytes. */
return DownloadUtils.downloadToByteArray(this.client, METADATA_SEGMENT_PATH)
.flatMap(DownloadUtils::parseJson)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ChangefeedFactory {
private static final ClientLogger LOGGER = new ClientLogger(ChangefeedFactory.class);

private final SegmentFactory segmentFactory;
private final BlobContainerAsyncClient client;
final BlobContainerAsyncClient client;

/**
* Creates a SegmentFactory with the designated factories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
class ChunkFactory {

private static final ClientLogger LOGGER = new ClientLogger(ChunkFactory.class);
private static final long DEFAULT_HEADER_SIZE = 4 * Constants.KB;
static final long DEFAULT_HEADER_SIZE = 4 * Constants.KB;
/* TODO (gapra): This should probably be configurable by a user. */
private static final long DEFAULT_BODY_SIZE = Constants.MB;
static final long DEFAULT_BODY_SIZE = Constants.MB;

private final AvroReaderFactory avroReaderFactory;
private final BlobChunkedDownloaderFactory blobChunkedDownloaderFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static OffsetDateTime convertPathToTime(String path) {
* @param year The year.
* @param start The start time.
* @param end The end time.
* @return Whether or not the year lies within the start and end times.
* @return Whether the year lies within the start and end times.
*/
public static boolean validYear(String year, OffsetDateTime start, OffsetDateTime end) {
if (year == null || start == null || end == null) {
Expand All @@ -62,7 +62,7 @@ public static boolean validYear(String year, OffsetDateTime start, OffsetDateTim
* @param segment The segment.
* @param start The start time.
* @param end The end time.
* @return Whether or not the segment lies within the start and end times.
* @return Whether the segment lies within the start and end times.
*/
public static boolean validSegment(String segment, OffsetDateTime start, OffsetDateTime end) {
if (segment == null || start == null || end == null) {
Expand Down Expand Up @@ -108,7 +108,7 @@ public static OffsetDateTime roundDownToNearestHour(OffsetDateTime time) {
/**
* Rounds a time down to the nearest year.
*/
private static OffsetDateTime roundDownToNearestYear(OffsetDateTime time) {
public static OffsetDateTime roundDownToNearestYear(OffsetDateTime time) {
if (time == null) {
return null;
}
Expand Down

This file was deleted.

Loading

0 comments on commit 20281a6

Please sign in to comment.