Skip to content

Commit

Permalink
[vpj][all] Create a new module for offline components to reduce leakage
Browse files Browse the repository at this point in the history
  • Loading branch information
nisargthakkar committed Sep 28, 2024
1 parent 939d655 commit a809f90
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 13 deletions.
2 changes: 2 additions & 0 deletions clients/venice-push-job/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ dependencies {
exclude module: ':internal:alpini'
}

implementation project(':internal:venice-hadoop-common')

implementation (libraries.avro) {
exclude group: 'org.mortbay.jetty' // jetty 6 conflicts with spark-java used in controller api
}
Expand Down
6 changes: 0 additions & 6 deletions internal/venice-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ dependencies {
exclude group: 'com.linkedin.container', module: 'container-eventbus-factory' // Keeping' it clean.
}

implementation (libraries.hadoopCommon) {
// Exclude transitive dependency
exclude group: 'org.apache.avro'
exclude group: 'javax.servlet'
}

implementation project(':clients:venice-thin-client')

implementation libraries.avroUtilCompatHelper
Expand Down
16 changes: 16 additions & 0 deletions internal/venice-hadoop-common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
dependencies {
implementation project(':internal:venice-common')
implementation libraries.log4j2api
implementation (libraries.hadoopCommon) {
// Exclude transitive dependency
exclude group: 'org.apache.avro'
exclude group: 'javax.servlet'
}

testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
}

ext {
jacocoCoverageThreshold = 0.33
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.linkedin.venice.hadoop.schema;

import static com.linkedin.venice.utils.TestWriteUtils.getTempDataDirectory;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import com.linkedin.davinci.schema.SchemaUtils;
Expand All @@ -16,6 +14,7 @@
import java.util.Map;
import org.apache.avro.Schema;
import org.apache.hadoop.fs.Path;
import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -45,7 +44,7 @@ public void setUp() throws IOException {
Path rmdInputDir = new Path(getTempDataDirectory().getAbsolutePath());
Path valueInputDir = new Path(getTempDataDirectory().getAbsolutePath());
Path keyInputDir = new Path(getTempDataDirectory().getAbsolutePath());
client = mock(ControllerClient.class);
client = Mockito.mock(ControllerClient.class);
MultiSchemaResponse.Schema[] rmdSchemas = generateRmdSchemas(numOfSchemas);
MultiSchemaResponse rmdSchemaResponse = new MultiSchemaResponse();
rmdSchemaResponse.setSchemas(rmdSchemas);
Expand All @@ -58,9 +57,9 @@ public void setUp() throws IOException {
keySchemaResponse.setSchemaStr(KEY_SCHEMA_STR);
keySchemaResponse.setId(1);

doReturn(rmdSchemaResponse).when(client).getAllReplicationMetadataSchemas(TEST_STORE);
doReturn(valueSchemaResponse).when(client).getAllValueSchema(TEST_STORE);
doReturn(keySchemaResponse).when(client).getKeySchema(TEST_STORE);
Mockito.doReturn(rmdSchemaResponse).when(client).getAllReplicationMetadataSchemas(TEST_STORE);
Mockito.doReturn(valueSchemaResponse).when(client).getAllValueSchema(TEST_STORE);
Mockito.doReturn(keySchemaResponse).when(client).getKeySchema(TEST_STORE);

source = new HDFSSchemaSource(valueInputDir, rmdInputDir, keyInputDir, TEST_STORE);
source.saveSchemasOnDisk(client);
Expand Down Expand Up @@ -94,7 +93,7 @@ public void testLoadKeySchemaThenFetch() throws IOException {

@Test(expectedExceptions = IllegalStateException.class)
public void testSaveKeySchemaThrowsExceptionWithInvalidResponse() throws IOException {
SchemaResponse mockResponse = mock(SchemaResponse.class);
SchemaResponse mockResponse = Mockito.mock(SchemaResponse.class);
when(mockResponse.isError()).thenReturn(true);
source.saveKeySchemaToDisk(mockResponse);

Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ include 'services:venice-standalone'
include 'internal:venice-avro-compatibility-test'
include 'internal:venice-client-common'
include 'internal:venice-common'
include 'internal:venice-hadoop-common'
include 'internal:venice-jdk-compatibility-test'
include 'internal:venice-test-common'

Expand Down

0 comments on commit a809f90

Please sign in to comment.