fix(protobuf) Set undeprecated ownership type & fix case sentitive urn corpGroup (#5425)

This commit is contained in:
leifker 2022-07-18 17:56:43 -05:00 committed by GitHub
parent 9d79fd3767
commit e9c943f3b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -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`.

View File

@ -37,14 +37,14 @@ public class OwnershipVisitor implements ProtobufModelVisitor<Owner> {
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;

View File

@ -27,17 +27,17 @@ public class OwnershipVisitorTest {
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()));
}