/** * Create new instance of <code>MongoEndpointUser</code>. * @param dto data transfer object contain data that * assign on fields of new instance */ public MongoEndpointUser(EndpointUserDto dto) { this.id = dto.getId(); this.username = dto.getUsername(); this.externalId = dto.getExternalId(); this.tenantId = dto.getTenantId(); this.accessToken = dto.getAccessToken(); this.endpointIds = dto.getEndpointIds(); this.version = dto.getVersion(); }
/** * Create new instance of <code>CassandraEndpointUser</code>. * * @param dto data transfer object contain data that * assign on fields of new instance */ public CassandraEndpointUser(EndpointUserDto dto) { this.id = dto.getId(); this.username = dto.getUsername(); this.externalId = dto.getExternalId(); this.tenantId = dto.getTenantId(); this.accessToken = dto.getAccessToken(); this.endpointIds = dto.getEndpointIds(); this.version = dto.getVersion(); }
@Test public void attachEndpointToNewUserByExternalIdTest() { TenantDto tenant = generateTenantDto(); String endpointGroupId = "124"; EndpointProfileDto endpointProfile = generateEndpointProfileWithGroupIdDto(endpointGroupId); String userExternalId = UUID.randomUUID().toString(); String tenantId = tenant.getId(); EndpointProfileDto savedEndpointProfile = endpointService.attachEndpointToUser(userExternalId, tenantId, endpointProfile); Assert.assertNotNull(savedEndpointProfile); Assert.assertNotNull(savedEndpointProfile.getEndpointUserId()); EndpointUserDto attachedEndpointUser = endpointService.findEndpointUserById(savedEndpointProfile.getEndpointUserId()); Assert.assertNotNull(attachedEndpointUser); Assert.assertEquals(userExternalId, attachedEndpointUser.getExternalId()); Assert.assertEquals(userExternalId, attachedEndpointUser.getUsername()); Assert.assertEquals(tenantId, attachedEndpointUser.getTenantId()); List<String> endpointIds = attachedEndpointUser.getEndpointIds(); Assert.assertNotNull(endpointIds); Assert.assertEquals(1, endpointIds.size()); Assert.assertEquals(endpointProfile.getId(), endpointIds.get(0)); }