public TSentryRole deepCopy() { return new TSentryRole(this); }
/** * Performs a deep copy on <i>other</i>. */ public TListSentryRolesResponse(TListSentryRolesResponse other) { if (other.isSetStatus()) { this.status = other.status; } if (other.isSetRoles()) { Set<TSentryRole> __this__roles = new HashSet<TSentryRole>(other.roles.size()); for (TSentryRole other_element : other.roles) { __this__roles.add(new TSentryRole(other_element)); } this.roles = __this__roles; } }
public Set<TSentryRole> execute(PersistenceManager pm) throws Exception { Set<TSentryRole> tRoles = Sets.newHashSet(); pm.setDetachAllOnCommit(false); // No need to detach objects Set<MSentryRole> mSentryRoles = Sets.newHashSet(); if(groups.contains(null)) { mSentryRoles.addAll(delegate.getAllRoles(pm)); } else { mSentryRoles = delegate.getRolesForGroups(pm, groups); } for(MSentryRole mSentryRole: mSentryRoles) { String roleName = mSentryRole.getRoleName().intern(); Set<String> groupNames = Sets.newHashSet(); Set<MSentryGroup> mSentryGroups = mSentryRole.getGroups(); for(MSentryGroup mSentryGroup: mSentryGroups) { groupNames.add(mSentryGroup.getGroupName()); } tRoles.add(new TSentryRole(roleName, groupNames)); } return tRoles; } });
for (int _i34 = 0; _i34 < _set32.size; ++_i34) _elem33 = new TSentryRole(); _elem33.read(iprot); struct.roles.add(_elem33);
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(); struct.status.read(iprot); struct.setStatusIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { org.apache.thrift.protocol.TSet _set37 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.roles = new HashSet<TSentryRole>(2*_set37.size); TSentryRole _elem38; for (int _i39 = 0; _i39 < _set37.size; ++_i39) { _elem38 = new TSentryRole(); _elem38.read(iprot); struct.roles.add(_elem38); } } struct.setRolesIsSet(true); } } }
TSentryRole tSentryRole = new TSentryRole(roleName, Sets.newHashSet(groupName)); mockTRoles.add(tSentryRole); Mockito.when(mockStore.getTSentryRolesByGroupName(anyString(), anySetOf(String.class)))