Remove not used metadata-test-utils module

This commit is contained in:
Kerem Sahin 2019-10-02 11:54:15 -07:00
parent 5bf797b216
commit 3d47d2bc2f
2 changed files with 0 additions and 115 deletions

View File

@ -1,8 +0,0 @@
apply plugin: 'java'
dependencies {
compile project(':li-utils')
compile project(':metadata-models')
compile externalDependency.commonsIo
compile externalDependency.guava
}

View File

@ -1,107 +0,0 @@
package com.linkedin.metadata.utils;
import com.linkedin.common.AuditStamp;
import com.linkedin.common.FabricType;
import com.linkedin.common.Owner;
import com.linkedin.common.OwnerArray;
import com.linkedin.common.Ownership;
import com.linkedin.common.OwnershipSource;
import com.linkedin.common.OwnershipSourceType;
import com.linkedin.common.OwnershipSuggestion;
import com.linkedin.common.OwnershipType;
import com.linkedin.common.urn.CorpuserUrn;
import com.linkedin.common.urn.DataPlatformUrn;
import com.linkedin.common.urn.DatasetGroupUrn;
import com.linkedin.common.urn.DatasetUrn;
import com.linkedin.common.urn.Urn;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Collections;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.apache.commons.io.IOUtils;
public class TestUtils {
private TestUtils() {
// Util class
}
@Nonnull
public static CorpuserUrn makeCorpUserUrn(@Nonnull String name) {
return new CorpuserUrn(name);
}
@Nonnull
public static DatasetUrn makeDatasetUrn(@Nonnull String name) {
return new DatasetUrn(new DataPlatformUrn("mysql"), name, FabricType.DEV);
}
@Nonnull
public static DatasetGroupUrn makeDatasetGroupUrn(@Nonnull String name) {
return new DatasetGroupUrn("foo", name);
}
@Nonnull
public static Owner makeOwner(@Nonnull String ldap) {
return makeOwner(ldap, OwnershipType.DEVELOPER);
}
@Nonnull
public static Owner makeOwner(@Nonnull String ldap, @Nonnull OwnershipType type) {
return new Owner().setOwner(new CorpuserUrn(ldap)).setType(type);
}
@Nonnull
public static Owner makeOwner(@Nonnull Urn ownerUrn, @Nonnull OwnershipType type,
@Nullable OwnershipSourceType sourceType, @Nullable String sourceUrl) {
Owner owner = new Owner().setOwner(ownerUrn).setType(type);
if (sourceType != null) {
OwnershipSource source = new OwnershipSource().setType(sourceType);
if (sourceUrl != null) {
source.setUrl(sourceUrl);
}
owner.setSource(source);
}
return owner;
}
@Nonnull
public static Ownership makeOwnership(@Nonnull String ldap) {
return new Ownership().setOwners(new OwnerArray(Collections.singleton(makeOwner(ldap))));
}
@Nonnull
public static OwnershipSuggestion makeOwnershipSuggestion(@Nonnull String ldap) {
return new OwnershipSuggestion().setOwners(new OwnerArray(Collections.singleton(makeOwner(ldap))));
}
@Nonnull
public static AuditStamp makeAuditStamp(@Nonnull Urn actorUrn, @Nullable Urn impersonatorUrn, long time) {
AuditStamp auditStamp = new AuditStamp();
auditStamp.setTime(time);
auditStamp.setActor(actorUrn);
if (impersonatorUrn != null) {
auditStamp.setImpersonator(impersonatorUrn);
}
return auditStamp;
}
@Nonnull
public static AuditStamp makeAuditStamp(@Nonnull String actorLdap, long time) {
return makeAuditStamp(new CorpuserUrn(actorLdap), null, time);
}
@Nonnull
public static AuditStamp makeAuditStamp(@Nonnull String actorLdap) {
return makeAuditStamp(actorLdap, 0L);
}
@Nonnull
public static String loadJsonFromResource(@Nonnull String resourceName) throws IOException {
return IOUtils.toString(ClassLoader.getSystemResourceAsStream(resourceName), Charset.defaultCharset());
}
}