Skip to content

Commit

Permalink
fix(protobuf) Set undeprecated ownership type & fix case sentitive ur…
Browse files Browse the repository at this point in the history
…n corpGroup
  • Loading branch information
leifker committed Jul 18, 2022
1 parent f5dd6fc commit b45b02a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion metadata-integration/java/datahub-protobuf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ The following is a consolidated example for the possible field level term option

##### OWNER

One or more owners can be specified and can be any combination of `corpUser` and `corpGroup` entities. The default entity type is `corpGroup`. By default, the ownership type is set to `producer`, see the second example for setting the ownership type.
One or more owners can be specified and can be any combination of `corpUser` and `corpGroup` entities. The default entity type is `corpGroup`. By default, the ownership type is set to `technical_owner`, see the second example for setting the ownership type.

The following example assigns the ownership to a group of `myGroup` and a user called `myName`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public Stream<Owner> visitGraph(VisitContext context) {
try {
ownershipType = OwnershipType.valueOf(entry.getKey().getName().toUpperCase());
} catch (IllegalArgumentException e) {
ownershipType = OwnershipType.PRODUCER;
ownershipType = OwnershipType.TECHNICAL_OWNER;
}

String[] id = entry.getValue().toLowerCase().split(":", 2);
return new Owner()
.setType(ownershipType)
.setSource(new OwnershipSource().setType(OwnershipSourceType.MANUAL))
.setOwner(new Urn(id.length > 1 ? id[0] : "corpgroup", id[id.length - 1]));
.setOwner(new Urn(id.length > 1 ? id[0].replaceFirst("corpgroup", "corpGroup") : "corpGroup", id[id.length - 1]));
} catch (URISyntaxException e) {
System.err.println(e.getMessage());
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ public void visitorTest() throws IOException {
OwnershipVisitor test = new OwnershipVisitor();

assertEquals(Set.of(new Owner()
.setType(OwnershipType.PRODUCER)
.setType(OwnershipType.TECHNICAL_OWNER)
.setSource(new OwnershipSource().setType(OwnershipSourceType.MANUAL))
.setOwner(Urn.createFromTuple("corpgroup", "teamb")),
.setOwner(Urn.createFromTuple("corpGroup", "teamb")),
new Owner()
.setType(OwnershipType.PRODUCER)
.setType(OwnershipType.TECHNICAL_OWNER)
.setSource(new OwnershipSource().setType(OwnershipSourceType.MANUAL))
.setOwner(Urn.createFromTuple("corpuser", "datahub")),
new Owner()
.setType(OwnershipType.TECHNICAL_OWNER)
.setSource(new OwnershipSource().setType(OwnershipSourceType.MANUAL))
.setOwner(Urn.createFromTuple("corpgroup", "technicalowner"))
.setOwner(Urn.createFromTuple("corpGroup", "technicalowner"))
),
graph.accept(getVisitContextBuilder("extended_protobuf.MessageA"), List.of(test)).collect(Collectors.toSet()));
}
Expand Down

0 comments on commit b45b02a

Please sign in to comment.