本文整理汇总了Java中org.oscm.vo.VOUser类的典型用法代码示例。如果您正苦于以下问题:Java VOUser类的具体用法?Java VOUser怎么用?Java VOUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VOUser类属于org.oscm.vo包,在下文中一共展示了VOUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserDetails
import org.oscm.vo.VOUser; //导入依赖的package包/类
/**
* Gets the user details from BES. If user is null, the current user details
* will be returned, otherwise of the specified user.
*
* @param si
* @param user
* @param password
* @param controllerId
* @return
* @throws APPlatformException
* @throws BESNotificationException
*/
public VOUserDetails getUserDetails(ServiceInstance si, VOUser user,
String password, Optional<String> controllerId) throws APPlatformException {
VOUserDetails userDetails = null;
IdentityService idServ = getBESWebService(IdentityService.class, si, controllerId);
if (user != null) {
Map<String, Setting> proxySettings = configService
.getAllProxyConfigurationSettings();
boolean isSso = isSsoMode(proxySettings);
setUserCredentialsInContext((BindingProvider) idServ,
isSso ? user.getUserId() : String.valueOf(user.getKey()),
password, proxySettings);
}
try {
userDetails = idServ.getCurrentUserDetails();
} catch (Exception e) {
throw new APPlatformException(e.getMessage(), e);
}
return userDetails;
}
示例2: testAuthenticateTMForInstance_NullUserDetails
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Test(expected = AuthenticationException.class)
public void testAuthenticateTMForInstance_NullUserDetails()
throws Throwable {
// applyDefaultTMCredentials();
createServiceInstance(ProvisioningStatus.COMPLETED,
InstanceParameter.PUBLIC_IP);
VOUserDetails userToGet = createVOUserDetails(1000, "user", "customer");
identityService = Mockito.mock(EnhancedIdentityService.class);
Mockito.doReturn(null).doReturn(userToGet).when(besDAO).getUserDetails(
any(ServiceInstance.class), any(VOUser.class),
anyString(), any(Optional.class));
Mockito.doReturn(userToGet).when(besDAO).getUser(
any(ServiceInstance.class),
any(VOUser.class), any(Optional.class));
authenticateTMForInstance(CTRL_ID, "appInstanceId", defaultAuth);
}
示例3: testAuthenticateTMForInstance_NullOrganizationId
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Test(expected = AuthenticationException.class)
public void testAuthenticateTMForInstance_NullOrganizationId()
throws Throwable {
createServiceInstance(ProvisioningStatus.COMPLETED,
InstanceParameter.PUBLIC_IP);
VOUserDetails userToGet = createVOUserDetails(1000, "user", null);
Mockito.doReturn(new VOUserDetails()).when(besDAO).getUserDetails(
any(ServiceInstance.class), any(VOUser.class),
anyString(), any(Optional.class));
Mockito.doReturn(userToGet).when(besDAO).getUser(
any(ServiceInstance.class),
any(VOUser.class), any(Optional.class));
authenticateTMForInstance(CTRL_ID, "appInstanceId", defaultAuth);
}
示例4: testAuthenticateTMForInstance_wrongOrg
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Test(expected = AuthenticationException.class)
public void testAuthenticateTMForInstance_wrongOrg() throws Throwable {
// given
createServiceInstance(ProvisioningStatus.COMPLETED,
InstanceParameter.PUBLIC_IP);
VOUserDetails org = createVOUserDetails(10000, "supplier", "tp123");
VOUserDetails wrongOrg = createVOUserDetails(20001, "user", "customer");
Mockito.doReturn(org).doReturn(wrongOrg).when(besDAO).getUserDetails(
any(ServiceInstance.class), any(VOUser.class),
anyString(), any(Optional.class));
// when
authenticateTMForInstance(CTRL_ID, "appInstanceId",
new PasswordAuthentication(wrongOrg.getUserId(), "secret"));
}
示例5: testAuthenticateTMForInstance_UserNotFound
import org.oscm.vo.VOUser; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = AuthenticationException.class)
public void testAuthenticateTMForInstance_UserNotFound() throws Throwable {
// given
createServiceInstance(ProvisioningStatus.COMPLETED,
InstanceParameter.PUBLIC_IP);
VOUserDetails currentUserDetails = createVOUserDetails(1000, "userid",
"orgid");
Mockito.doReturn(currentUserDetails).when(besDAO).getUserDetails(
any(ServiceInstance.class), any(VOUser.class),
anyString(), any(Optional.class));
Mockito.doReturn(new PasswordAuthentication(
currentUserDetails.getUserId(), "pass")).when(configService)
.getWebServiceAuthentication(
any(ServiceInstance.class), Matchers.anyMap(), any(Optional.class));
Mockito.doThrow(new AuthenticationException("not found")).when(besDAO)
.getUser(any(ServiceInstance.class),
any(VOUser.class), any(Optional.class));
// when
authenticateTMForInstance(CTRL_ID, "appInstanceId",
new PasswordAuthentication("someone", "secret"));
}
示例6: testAuthenticateTMForInstance_OperationNotPermitted
import org.oscm.vo.VOUser; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = APPlatformException.class)
public void testAuthenticateTMForInstance_OperationNotPermitted()
throws Throwable {
// given
createServiceInstance(ProvisioningStatus.COMPLETED,
InstanceParameter.PUBLIC_IP);
VOUserDetails currentUserDetails = createVOUserDetails(1000,
defaultAuth.getUserName(), "orgid");
Mockito.doReturn(currentUserDetails).when(besDAO).getUserDetails(
any(ServiceInstance.class), any(VOUser.class),
anyString(), any(Optional.class));
Mockito.doReturn(new PasswordAuthentication(
currentUserDetails.getUserId(), "pass")).when(configService)
.getWebServiceAuthentication(
any(ServiceInstance.class), Matchers.anyMap(), any(Optional.class));
Mockito.doThrow(new APPlatformException("any")).when(besDAO).getUser(
any(ServiceInstance.class),
any(VOUser.class), any(Optional.class));
// when
authenticateTMForInstance(CTRL_ID, "appInstanceId", defaultAuth);
}
示例7: testAuthenticateTMForInstance_wrongRole
import org.oscm.vo.VOUser; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = AuthenticationException.class)
public void testAuthenticateTMForInstance_wrongRole() throws Throwable {
// given
createServiceInstance(ProvisioningStatus.COMPLETED,
InstanceParameter.PUBLIC_IP);
VOUserDetails user = createVOUserDetails(10000, "supplier", "tp123");
user.addUserRole(UserRoleType.MARKETPLACE_OWNER);
Mockito.doReturn(user).when(besDAO).getUserDetails(
any(ServiceInstance.class), any(VOUser.class),
anyString(), any(Optional.class));
Mockito.doReturn(new PasswordAuthentication("nobody", ""))
.when(configService).getWebServiceAuthentication(
any(ServiceInstance.class), Matchers.anyMap(), any(Optional.class));
// when
authenticateTMForInstance(CTRL_ID, "appInstanceId",
new PasswordAuthentication("supplier", "secret"));
}
示例8: testAuthenticateTMForInstance_wrongCreds
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Ignore
// TODO in besDAO
@Test(expected = AuthenticationException.class)
public void testAuthenticateTMForInstance_wrongCreds() throws Throwable {
createServiceInstance(ProvisioningStatus.COMPLETED,
InstanceParameter.PUBLIC_IP);
VOUserDetails user = createVOUserDetails(10000, "supplier", "tp123");
Mockito.doReturn(user).when(identityService).getCurrentUserDetails();
Mockito.doReturn(user).when(identityService)
.getUser(any(VOUser.class));
authenticateTMForInstance(CTRL_ID, "appInstanceId",
new PasswordAuthentication("supplier", "wrong"));
}
示例9: getUserDetails_givenUser_INTERNAL
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Test
public void getUserDetails_givenUser_INTERNAL() throws APPlatformException {
// given
besDAO.configService = confServ;
Map<String, Setting> settings = getSettingsForMode("INTERNAL");
doReturn(settings).when(besDAO.configService)
.getAllProxyConfigurationSettings();
doReturn(idServ).when(besDAO).getBESWebService(
eq(IdentityService.class), any(ServiceInstance.class), any(Optional.class));
VOUser user = givenUser(null, "mail");
// when
besDAO.getUserDetails(new ServiceInstance(), user, "password", Optional.empty());
// then
verify(besDAO).setUserCredentialsInContext(any(BindingProvider.class),
eq(Long.valueOf(user.getKey()).toString()), eq("password"),
eq(settings));
verify(idServ).getCurrentUserDetails();
}
示例10: testAuthenticateTMForInstance_noRoles
import org.oscm.vo.VOUser; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = AuthenticationException.class)
public void testAuthenticateTMForInstance_noRoles() throws Throwable {
// given
createServiceInstance(ProvisioningStatus.COMPLETED,
InstanceParameter.PUBLIC_IP);
VOUserDetails user = createVOUserDetails(10000, "supplier", "tp123");
Mockito.doReturn(user).when(besDAO).getUserDetails(
any(ServiceInstance.class), any(VOUser.class),
anyString(), any(Optional.class));
Mockito.doReturn(new PasswordAuthentication("nobody", ""))
.when(configService).getWebServiceAuthentication(
any(ServiceInstance.class), Matchers.anyMap(), any(Optional.class));
// when
authenticateTMForInstance(CTRL_ID, "appInstanceId",
new PasswordAuthentication("supplier", "secret"));
}
示例11: toExtUserConvert
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Test
public void toExtUserConvert() {
// given
PlatformUser user = new PlatformUser();
user.setKey(VALID_KEY);
user.setUserId(VALID_ID);
// when
VOUser vUser = Converter
.convert(user, PlatformUser.class, VOUser.class);
// then
Assert.assertEquals(user.getKey(), vUser.getKey());
Assert.assertEquals(user.getUserId(), vUser.getUserId());
}
示例12: getUserDetails_givenUser_SSO
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Test
public void getUserDetails_givenUser_SSO() throws APPlatformException {
// given
besDAO.configService = confServ;
Map<String, Setting> settings = getSettingsForMode("SAML_SP");
doReturn(settings).when(besDAO.configService)
.getAllProxyConfigurationSettings();
doReturn(idServ).when(besDAO).getBESWebService(
eq(IdentityService.class), any(ServiceInstance.class), any(Optional.class));
VOUser user = givenUser(null, "mail");
// when
besDAO.getUserDetails(new ServiceInstance(), user, "password", Optional.empty());
// then
verify(besDAO).setUserCredentialsInContext(any(BindingProvider.class),
eq(user.getUserId()), eq("password"), eq(settings));
verify(idServ).getCurrentUserDetails();
}
示例13: run
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Override
public void run() {
while (!interrupted()) {
if (userIds.size() > 0) {
String userId = pickRandomUser(userIds);
try {
IdentityService idSrv = ServiceFactory.getDefault()
.getIdentityService(organizationAdminKey,
WebserviceTestBase.DEFAULT_PASSWORD);
VOUser user = new VOUser();
user.setUserId(userId);
VOUserDetails userDetails = idSrv.getUserDetails(user);
System.out.println("DISTURBER (" + userId
+ "): read user information... ("
+ userDetails.getKey() + ")");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
示例14: grantUserRoles
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Test
@Order(order = 5)
public void grantUserRoles() throws ObjectNotFoundException,
NonUniqueBusinessKeyException, MailOperationException,
OperationNotPermittedException {
// given
identityService.addRevokeUserUnitAssignment(userGroup.getName(),
Collections.<VOUser>singletonList(USER),
Collections.<VOUser>emptyList());
// when and then
VOOrganizationalUnit unit = getUnitWithName(userGroup.getName());
Assert.assertNotNull(unit);
unitService.revokeUserRoles(USER,
Collections.singletonList(UnitRoleType.USER), unit);
unitService.grantUserRoles(USER,
Collections.singletonList(UnitRoleType.ADMINISTRATOR), unit);
}
示例15: testGetUserDetails
import org.oscm.vo.VOUser; //导入依赖的package包/类
@Test
public void testGetUserDetails() throws Exception {
// given
VOTenant tenant = createTenantWithSettings("qwerty10");
VOOrganization orgWithTenant = WebserviceTestBase.createOrganization(
USER_ID_FOR_TENANT, "qwerty10org", tenant.getKey(),
OrganizationRoleType.SUPPLIER);
IdentityService isWithTenant = ServiceFactory
.getSTSServiceFactory("qwerty10", null)
.getIdentityService(USER_ID_FOR_TENANT, "secret");
VOUser user = prepareUser(USER_ID_FOR_TENANT);
// when
VOUserDetails userDetails = isWithTenant.getUserDetails(user);
// then
assertEquals(orgWithTenant.getOrganizationId(),
userDetails.getOrganizationId());
}