Skip to content

Commit

Permalink
Merge branch 'datahub-project:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored Sep 5, 2023
2 parents 5a532fd + 9f223c0 commit 12e7e56
Show file tree
Hide file tree
Showing 181 changed files with 6,918 additions and 5,028 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/spark-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
python-version: "3.7"
- name: Install dependencies
run: ./metadata-ingestion/scripts/install_deps.sh
- name: Remove images
run: docker image prune -a -f || true
- name: Smoke test
run: |
./gradlew :metadata-integration:java:spark-lineage:integrationTest \
Expand Down
22 changes: 12 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
ext.junitJupiterVersion = '5.6.1'
// Releases: https://github.com/linkedin/rest.li/blob/master/CHANGELOG.md
ext.pegasusVersion = '29.22.16'
ext.pegasusVersion = '29.45.0'
ext.mavenVersion = '3.6.3'
ext.springVersion = '5.3.29'
ext.springBootVersion = '2.7.14'
Expand All @@ -18,6 +18,7 @@ buildscript {
ext.hadoop3Version = '3.3.5'
ext.kafkaVersion = '2.3.0'
ext.hazelcastVersion = '5.3.1'
ext.ebeanVersion = '12.16.1'

ext.docker_registry = 'linkedin'

Expand All @@ -29,16 +30,16 @@ buildscript {
classpath 'io.acryl.gradle.plugin:gradle-avro-plugin:0.8.1'
classpath 'org.springframework.boot:spring-boot-gradle-plugin:' + springBootVersion
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
classpath "com.palantir.gradle.gitversion:gradle-git-version:0.12.3"
classpath "org.gradle.playframework:gradle-playframework:0.12"
classpath "gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.18.1"
classpath "com.palantir.gradle.gitversion:gradle-git-version:3.0.0"
classpath "org.gradle.playframework:gradle-playframework:0.14"
classpath "gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.19.1"
}
}

plugins {
id 'com.gorylenko.gradle-git-properties' version '2.4.0-rc2'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id "com.palantir.docker" version "0.35.0"
id 'com.palantir.docker' version '0.35.0'
// https://blog.ltgt.net/javax-jakarta-mess-and-gradle-solution/
// TODO id "org.gradlex.java-ecosystem-capabilities" version "1.0"
}
Expand Down Expand Up @@ -86,16 +87,17 @@ project.ext.externalDependency = [
'dgraph4j' : 'io.dgraph:dgraph4j:21.03.1',
'dropwizardMetricsCore': 'io.dropwizard.metrics:metrics-core:4.2.3',
'dropwizardMetricsJmx': 'io.dropwizard.metrics:metrics-jmx:4.2.3',
'ebean': 'io.ebean:ebean:11.33.3',
'ebeanAgent': 'io.ebean:ebean-agent:11.27.1',
'ebean': 'io.ebean:ebean:' + ebeanVersion,
'ebeanAgent': 'io.ebean:ebean-agent:' + ebeanVersion,
'ebeanDdl': 'io.ebean:ebean-ddl-generator:' + ebeanVersion,
'elasticSearchRest': 'org.elasticsearch.client:elasticsearch-rest-high-level-client:' + elasticsearchVersion,
'elasticSearchTransport': 'org.elasticsearch.client:transport:' + elasticsearchVersion,
'findbugsAnnotations': 'com.google.code.findbugs:annotations:3.0.1',
'graphqlJava': 'com.graphql-java:graphql-java:19.5',
'graphqlJavaScalars': 'com.graphql-java:graphql-java-extended-scalars:19.1',
'gson': 'com.google.code.gson:gson:2.8.9',
'guice': 'com.google.inject:guice:4.2.3',
'guava': 'com.google.guava:guava:27.0.1-jre',
'guava': 'com.google.guava:guava:32.1.2-jre',
'h2': 'com.h2database:h2:2.1.214',
'hadoopCommon':'org.apache.hadoop:hadoop-common:2.7.2',
'hadoopMapreduceClient':'org.apache.hadoop:hadoop-mapreduce-client-core:2.7.2',
Expand Down Expand Up @@ -239,7 +241,7 @@ configure(subprojects.findAll {! it.name.startsWith('spark-lineage')}) {

subprojects {

apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.gorylenko.gradle-git-properties'

gitProperties {
Expand All @@ -253,7 +255,7 @@ subprojects {

plugins.withType(JavaPlugin) {
dependencies {
testCompile externalDependency.testng
testImplementation externalDependency.testng
constraints {
implementation('io.netty:netty-all:4.1.86.Final')
implementation('org.apache.commons:commons-compress:1.21')
Expand Down
10 changes: 5 additions & 5 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ buildscript {
}

dependencies {
compile('io.acryl:json-schema-avro:0.1.5') {
implementation('io.acryl:json-schema-avro:0.1.5') {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
exclude group: 'com.google.guava', module: 'guava'
}
compile 'com.google.guava:guava:27.0.1-jre'
compile 'com.fasterxml.jackson.core:jackson-databind:2.13.5'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.5'
compile 'commons-io:commons-io:2.11.0'
implementation 'com.google.guava:guava:32.1.2-jre'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.5'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.5'
implementation 'commons-io:commons-io:2.11.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
import java.util.List;
import java.util.stream.Collectors;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.*;

import static com.github.fge.processing.ProcessingUtil.*;
import static org.apache.commons.io.FilenameUtils.*;
Expand All @@ -46,6 +43,7 @@ public void setInputDirectory(String inputDirectory) {
}

@InputDirectory
@PathSensitive(PathSensitivity.NAME_ONLY)
public String getInputDirectory() {
return inputDirectory;
}
Expand Down
8 changes: 4 additions & 4 deletions datahub-frontend/app/controllers/CentralLogoutController.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
@Slf4j
public class CentralLogoutController extends LogoutController {
private static final String DEFAULT_BASE_URL_PATH = "/login";
private static final String AUTH_URL_CONFIG_PATH = "/login";
private static final String DEFAULT_BASE_URL_PATH = "/";
private static Boolean _isOidcEnabled = false;

@Inject
Expand All @@ -36,8 +37,7 @@ public CentralLogoutController(Config config) {
public Result executeLogout(Http.Request request) {
if (_isOidcEnabled) {
try {
return Results.redirect(DEFAULT_BASE_URL_PATH)
.removingFromSession(request);
return logout(request).toCompletableFuture().get().withNewSession();
} catch (Exception e) {
log.error("Caught exception while attempting to perform SSO logout! It's likely that SSO integration is mis-configured.", e);
return redirect(
Expand All @@ -47,7 +47,7 @@ public Result executeLogout(Http.Request request) {
.withNewSession();
}
}
return Results.redirect(DEFAULT_BASE_URL_PATH)
return Results.redirect(AUTH_URL_CONFIG_PATH)
.withNewSession();
}
}
4 changes: 2 additions & 2 deletions datahub-frontend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "io.github.kobylynskyi.graphql.codegen" version "4.1.1"
id 'com.palantir.docker'
id 'scala'
id 'com.palantir.docker'
}

apply from: "../gradle/versioning/versioning.gradle"
Expand Down Expand Up @@ -96,7 +96,7 @@ task unversionZip(type: Copy, dependsOn: [':datahub-web-react:build', dist]) {
into "${buildDir}/docker/"
rename "datahub-frontend-${version}.zip", "datahub-frontend.zip"
}
tasks.getByName("docker").dependsOn(unversionZip)
tasks.getByPath(":datahub-frontend:docker").dependsOn(unversionZip)

task cleanLocalDockerImages {
doLast {
Expand Down
14 changes: 7 additions & 7 deletions datahub-frontend/play.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: "org.gradle.playframework"
project.ext.httpPort = 9001
project.ext.playBinaryBaseName = "datahub-frontend"

tasks.withType(PlayRun) {
runPlay {
httpPort = project.ext.httpPort
}

Expand Down Expand Up @@ -33,8 +33,8 @@ dependencies {
}
}

compile project(":metadata-service:restli-client")
compile project(":metadata-service:auth-config")
implementation project(":metadata-service:restli-client")
implementation project(":metadata-service:auth-config")

implementation externalDependency.jettyJaas
implementation externalDependency.graphqlJava
Expand Down Expand Up @@ -70,15 +70,15 @@ dependencies {
testImplementation 'no.nav.security:mock-oauth2-server:0.3.1'
testImplementation 'org.junit-pioneer:junit-pioneer:1.9.1'
testImplementation externalDependency.junitJupiterApi
testRuntime externalDependency.junitJupiterEngine
testRuntimeOnly externalDependency.junitJupiterEngine

implementation externalDependency.slf4jApi
compileOnly externalDependency.lombok
runtime externalDependency.guice
runtime (externalDependency.playDocs) {
runtimeOnly externalDependency.guice
runtimeOnly (externalDependency.playDocs) {
exclude group: 'com.typesafe.akka', module: 'akka-http-core_2.12'
}
runtime externalDependency.playGuice
runtimeOnly externalDependency.playGuice
implementation externalDependency.log4j2Api

implementation externalDependency.logbackClassic
Expand Down
23 changes: 12 additions & 11 deletions datahub-graphql-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@ plugins {
apply plugin: 'java'

dependencies {
compile project(':metadata-service:restli-client')
compile project(':metadata-service:auth-impl')
compile project(':metadata-service:auth-config')
compile project(':metadata-service:configuration')
compile project(':metadata-service:services')
compile project(':metadata-io')
compile project(':metadata-utils')
implementation project(':metadata-service:restli-client')
implementation project(':metadata-service:auth-impl')
implementation project(':metadata-service:auth-config')
implementation project(':metadata-service:configuration')
implementation project(':metadata-service:services')
implementation project(':metadata-io')
implementation project(':metadata-utils')

implementation externalDependency.graphqlJava
implementation externalDependency.graphqlJavaScalars
compile externalDependency.antlr4Runtime
compile externalDependency.antlr4
compile externalDependency.guava
implementation externalDependency.antlr4Runtime
implementation externalDependency.antlr4
implementation externalDependency.guava
implementation externalDependency.opentelemetryAnnotations

implementation externalDependency.slf4jApi
compileOnly externalDependency.lombok
annotationProcessor externalDependency.lombok

testCompile externalDependency.mockito
testImplementation externalDependency.mockito
}

graphqlCodegen {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,24 @@
import com.linkedin.common.AuditStamp;
import com.linkedin.common.urn.UrnUtils;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.entity.ebean.transactions.AspectsBatchImpl;
import com.linkedin.metadata.models.registry.ConfigEntityRegistry;
import com.linkedin.metadata.models.registry.EntityRegistry;
import com.linkedin.mxe.MetadataChangeProposal;
import org.mockito.Mockito;

import java.util.List;


public class TestUtils {

public static EntityService getMockEntityService() {
EntityRegistry registry = new ConfigEntityRegistry(TestUtils.class.getResourceAsStream("/test-entity-registry.yaml"));
EntityService mockEntityService = Mockito.mock(EntityService.class);
Mockito.when(mockEntityService.getEntityRegistry()).thenReturn(registry);
return mockEntityService;
}

public static QueryContext getMockAllowContext() {
return getMockAllowContext("urn:li:corpuser:test");
}
Expand Down Expand Up @@ -88,25 +100,47 @@ public static QueryContext getMockDenyContext(String actorUrn, AuthorizationRequ
}

public static void verifyIngestProposal(EntityService mockService, int numberOfInvocations, MetadataChangeProposal proposal) {
verifyIngestProposal(mockService, numberOfInvocations, List.of(proposal));
}

public static void verifyIngestProposal(EntityService mockService, int numberOfInvocations, List<MetadataChangeProposal> proposals) {
AspectsBatchImpl batch = AspectsBatchImpl.builder()
.mcps(proposals, mockService.getEntityRegistry())
.build();
Mockito.verify(mockService, Mockito.times(numberOfInvocations)).ingestProposal(
Mockito.eq(batch),
Mockito.any(AuditStamp.class),
Mockito.eq(false)
);
}

public static void verifySingleIngestProposal(EntityService mockService, int numberOfInvocations, MetadataChangeProposal proposal) {
Mockito.verify(mockService, Mockito.times(numberOfInvocations)).ingestProposal(
Mockito.eq(proposal),
Mockito.any(AuditStamp.class),
Mockito.eq(false)
Mockito.eq(proposal),
Mockito.any(AuditStamp.class),
Mockito.eq(false)
);
}

public static void verifyIngestProposal(EntityService mockService, int numberOfInvocations) {
Mockito.verify(mockService, Mockito.times(numberOfInvocations)).ingestProposal(
Mockito.any(MetadataChangeProposal.class),
Mockito.any(AspectsBatchImpl.class),
Mockito.any(AuditStamp.class),
Mockito.eq(false)
);
}

public static void verifySingleIngestProposal(EntityService mockService, int numberOfInvocations) {
Mockito.verify(mockService, Mockito.times(numberOfInvocations)).ingestProposal(
Mockito.any(MetadataChangeProposal.class),
Mockito.any(AuditStamp.class),
Mockito.eq(false)
);
}

public static void verifyNoIngestProposal(EntityService mockService) {
Mockito.verify(mockService, Mockito.times(0)).ingestProposal(
Mockito.any(),
Mockito.any(AuditStamp.class), Mockito.anyBoolean());
Mockito.any(AspectsBatchImpl.class), Mockito.any(AuditStamp.class), Mockito.anyBoolean());
}

private TestUtils() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class DeleteAssertionResolverTest {
public void testGetSuccess() throws Exception {
EntityClient mockClient = Mockito.mock(EntityClient.class);

EntityService mockService = Mockito.mock(EntityService.class);
EntityService mockService = getMockEntityService();
Mockito.when(mockService.exists(Urn.createFromString(TEST_ASSERTION_URN))).thenReturn(true);
Mockito.when(mockService.getAspect(
Urn.createFromString(TEST_ASSERTION_URN),
Expand Down Expand Up @@ -78,7 +78,7 @@ public void testGetSuccess() throws Exception {
public void testGetSuccessNoAssertionInfoFound() throws Exception {
EntityClient mockClient = Mockito.mock(EntityClient.class);

EntityService mockService = Mockito.mock(EntityService.class);
EntityService mockService = getMockEntityService();
Mockito.when(mockService.exists(Urn.createFromString(TEST_ASSERTION_URN))).thenReturn(true);
Mockito.when(mockService.getAspect(
Urn.createFromString(TEST_ASSERTION_URN),
Expand Down Expand Up @@ -117,7 +117,7 @@ public void testGetSuccessAssertionAlreadyRemoved() throws Exception {
// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);

EntityService mockService = Mockito.mock(EntityService.class);
EntityService mockService = getMockEntityService();
Mockito.when(mockService.exists(Urn.createFromString(TEST_ASSERTION_URN))).thenReturn(false);

DeleteAssertionResolver resolver = new DeleteAssertionResolver(mockClient, mockService);
Expand Down Expand Up @@ -151,7 +151,7 @@ public void testGetSuccessAssertionAlreadyRemoved() throws Exception {
public void testGetUnauthorized() throws Exception {
// Create resolver
EntityClient mockClient = Mockito.mock(EntityClient.class);
EntityService mockService = Mockito.mock(EntityService.class);
EntityService mockService = getMockEntityService();
Mockito.when(mockService.exists(Urn.createFromString(TEST_ASSERTION_URN))).thenReturn(true);
Mockito.when(mockService.getAspect(
Urn.createFromString(TEST_ASSERTION_URN),
Expand Down Expand Up @@ -189,7 +189,7 @@ public void testGetEntityClientException() throws Exception {
Mockito.any(),
Mockito.any(Authentication.class));

EntityService mockService = Mockito.mock(EntityService.class);
EntityService mockService = getMockEntityService();
Mockito.when(mockService.exists(Urn.createFromString(TEST_ASSERTION_URN))).thenReturn(true);

DeleteAssertionResolver resolver = new DeleteAssertionResolver(mockClient, mockService);
Expand Down
Loading

0 comments on commit 12e7e56

Please sign in to comment.