本文整理汇总了Java中org.oscm.provisioning.data.InstanceInfo类的典型用法代码示例。如果您正苦于以下问题:Java InstanceInfo类的具体用法?Java InstanceInfo怎么用?Java InstanceInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InstanceInfo类属于org.oscm.provisioning.data包,在下文中一共展示了InstanceInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBaseUrlWithPublicIp
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
private String getBaseUrlWithPublicIp(ServiceInstance si, InstanceInfo ii)
throws BadResultException {
InstanceParameter publicIpParam = si
.getParameterForKey(InstanceParameter.PUBLIC_IP);
if (publicIpParam == null) {
BadResultException bre = new BadResultException(
String.format("Parameter for key '%s' not found",
InstanceParameter.PUBLIC_IP));
logger.warn(bre.getMessage(), bre);
throw bre;
}
String ip = publicIpParam.getDecryptedValue();
String baseUrl = ii.getBaseUrl();
int idx = baseUrl.indexOf("//") + 2;
String tmp = baseUrl.substring(0, idx) + ip
+ baseUrl.substring(baseUrl.indexOf(':', idx));
return tmp;
}
示例2: createProductInstance
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public TenantProvisioningResult createProductInstance(
Subscription subscription)
throws TechnicalServiceNotAliveException,
TechnicalServiceOperationException {
boolean asyncTenantProvisioning = isAsyncProvisioning(subscription);
TenantProvisioningResult result = new TenantProvisioningResult();
result.setAsyncProvisioning(asyncTenantProvisioning);
if (asyncTenantProvisioning) {
BaseResult baseResult = appManager.asyncCreateInstance(subscription);
result.setResultMesage(baseResult.getDesc());
} else {
InstanceResult instanceResult = appManager.createInstance(subscription);
InstanceInfo instanceInfo = instanceResult.getInstance();
result.setProductInstanceId(instanceInfo.getInstanceId());
result.setAccessInfo(instanceInfo.getAccessInfo());
result.setBaseUrl(instanceInfo.getBaseUrl());
result.setLoginPath(instanceInfo.getLoginPath());
result.setResultMesage(instanceResult.getDesc());
}
return result;
}
示例3: validateInstanceInfo
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
/**
* Validates the {@link InstanceInfo} returned by
* {@link #createInstance(Subscription)}.
*
* @param info
* the {@link InstanceInfo} to validate
* @param sub
* the {@link Subscription} to create the instance for
* @throws TechnicalServiceOperationException
* in case of invalid data
*/
void validateInstanceInfo(InstanceInfo info, Subscription sub)
throws TechnicalServiceOperationException {
try {
BLValidator.isDescription("instanceId", info.getInstanceId(), true);
BLValidator.isAccessinfo("accessInfo", info.getAccessInfo(),
isAccessInfoMandatory(info, sub));
BLValidator.isUrl("baseUrl", info.getBaseUrl(),
isBaseUrlMandatory(info, sub));
BLValidator.isDescription("loginPath", info.getLoginPath(),
isLoginPathMandatory(info, sub));
} catch (ValidationException e) {
String message = String.format("%s validation of field %s failed",
e.getReason().name(), e.getMember());
TechnicalServiceOperationException ex = new TechnicalServiceOperationException(
"Service createInstance() returned invalid data.",
new Object[] { sub.getSubscriptionId(), message }, e);
logger.logWarn(Log4jLogger.SYSTEM_LOG, ex,
LogMessageIdentifier.WARN_TECH_SERVICE_VALIDATION_FAILED,
sub.getSubscriptionId(), e.getReason().name(),
e.getMember());
throw ex;
}
}
示例4: isAccessInfoMandatory
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
private boolean isAccessInfoMandatory(InstanceInfo info, Subscription sub) {
ServiceAccessType accessType = sub.getProduct().getTechnicalProduct()
.getAccessType();
if ((accessType == ServiceAccessType.DIRECT
|| accessType == ServiceAccessType.USER)
&& (info.getAccessInfo() == null
|| info.getAccessInfo().trim().length() <= 0)) {
// mandatory if no AccessInfo available on technical service at
// least for the fall-back locale 'en'
String accessInfo = localizer.getLocalizedTextFromDatabase("en",
sub.getProduct().getTechnicalProduct().getKey(),
LocalizedObjectTypes.TEC_PRODUCT_LOGIN_ACCESS_DESC);
return accessInfo == null || accessInfo.trim().length() <= 0;
}
return false;
}
示例5: createInstance
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
@Override
public InstanceResult createInstance(InstanceRequest request,
User requestingUser) {
checkThrowError();
InstanceResult result = new InstanceResult();
if (request.getOrganizationId() != null) {
if (returnedInstanceInfo == null) {
InstanceInfo info = new InstanceInfo();
info.setAccessInfo(request.getDefaultLocale());
info.setBaseUrl(ApplicationServiceBeanTest.BASE_URL);
info.setInstanceId(request.getOrganizationId()
+ request.getSubscriptionId());
info.setLoginPath(request.getLoginUrl());
result.setInstance(info);
} else {
result.setInstance(returnedInstanceInfo);
}
}
setParameters(request.getParameterValue());
this.requestingUser = requestingUser;
return setRcAndDesc(result);
}
示例6: createInstance
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
@Test
public void createInstance() throws TechnicalServiceNotAliveException,
TechnicalServiceOperationException {
Subscription sub = createSubscription(true);
InstanceResult result = am.createInstance(sub);
InstanceInfo info = result.getInstance();
assertEquals(sub.getOrganization().getLocale(), info.getAccessInfo());
assertEquals(BASE_URL, info.getBaseUrl());
assertEquals(sub.getOrganization().getOrganizationId()
+ sub.getSubscriptionId(), info.getInstanceId());
assertEquals(ApplicationServiceBean.SERVICE_PATH
+ Long.toHexString(sub.getKey()), info.getLoginPath());
validateParameters(sub, null);
assertNotNull(servicePort.getRequestingUser());
assertTrue(servicePort.getRequestingUser().getEmail().length() > 0);
assertTrue(servicePort.getRequestingUser().getUserId().length() > 0);
assertTrue(servicePort.getRequestingUser().getUserFirstName()
.length() > 0);
assertTrue(
servicePort.getRequestingUser().getUserLastName().length() > 0);
}
示例7: validateInstanceInfo_NoAccessInfo_NoneOnTP
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
private void validateInstanceInfo_NoAccessInfo_NoneOnTP(
ServiceAccessType accessType) throws Throwable {
ApplicationServiceBean bean = mockForInstanceInfoValidation(accessType);
// no access info available on technical service
doReturn(null).when(bean.localizer).getLocalizedTextFromDatabase(
anyString(), anyLong(),
eq(LocalizedObjectTypes.TEC_PRODUCT_LOGIN_ACCESS_DESC));
InstanceInfo info = createInstanceInfo();
info.setAccessInfo(null);
try {
bean.validateInstanceInfo(info, subscription);
fail();
} catch (TechnicalServiceOperationException e) {
ValidationException ve = (ValidationException) e.getCause();
assertEquals("accessInfo", ve.getMember());
assertEquals(ReasonEnum.REQUIRED, ve.getReason());
}
}
示例8: createInstance
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
@Override
public InstanceResult createInstance(InstanceRequest request,
User requestingUser) {
final RequestLogEntry entry = createLogEntry("createInstance");
entry.addParameter("request", request);
entry.addParameter("requestingUser", requestingUser);
InstanceInfo instance = new InstanceInfo();
instance.setInstanceId(request.getSubscriptionId());
instance.setAccessInfo(null);
InstanceResult result = new InstanceResult();
result.setInstance(instance);
String message = Messages.get(requestingUser.getLocale(),
"info.subscription.created");
setOk(result, message);
return result;
}
示例9: getInstanceInfo
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
VOInstanceInfo getInstanceInfo(ServiceInstance currentSI,
InstanceResult instanceResult) {
InstanceInfo instanceInfo = instanceResult.getInstance();
VOInstanceInfo voInstanceInfo = new VOInstanceInfo();
voInstanceInfo.setInstanceId(currentSI.getInstanceId());
voInstanceInfo.setAccessInfo(instanceInfo.getAccessInfo());
voInstanceInfo.setBaseUrl(instanceInfo.getBaseUrl());
voInstanceInfo.setLoginPath(instanceInfo.getLoginPath());
voInstanceInfo.setVmsNumber(currentSI.getVmsNumber());
return voInstanceInfo;
}
示例10: createInstanceResult
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
/**
* Creates an <code>InstanceResult</code> with given access information.
*
* @param status
* the instance status to take access information from
* @return the instance result object
*/
private InstanceResult createInstanceResult(InstanceStatus status) {
InstanceResult instanceResult = new InstanceResult();
InstanceInfo instanceInfo = new InstanceInfo();
instanceInfo.setAccessInfo(status.getAccessInfo());
instanceInfo.setBaseUrl(status.getBaseUrl());
instanceInfo.setLoginPath(status.getLoginPath());
instanceResult.setRc(0);
instanceResult.setInstance(instanceInfo);
return instanceResult;
}
示例11: createInstanceResult
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
private InstanceResult createInstanceResult(ServiceInstance currentSI) {
InstanceInfo instance = new InstanceInfo();
instance.setInstanceId(currentSI.getSubscriptionId());
instance.setAccessInfo(currentSI.getServiceAccessInfo());
instance.setBaseUrl(currentSI.getServiceBaseURL());
instance.setLoginPath(currentSI.getServiceLoginPath());
InstanceResult instanceResult = new InstanceResult();
instanceResult.setInstance(instance);
return instanceResult;
}
示例12: getInstanceResult
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
private InstanceResult getInstanceResult(int returnCode) {
InstanceResult instanceResult = new InstanceResult();
InstanceInfo instanceInfo = new InstanceInfo();
instanceInfo.setAccessInfo("TSReturnAccessInfo");
instanceInfo.setBaseUrl(TS_RETURN_BASE_URL);
instanceInfo.setInstanceId("TSReturnInstanceId");
instanceInfo.setLoginPath("TSReturnLoginPath");
instanceResult.setInstance(instanceInfo);
instanceResult.setRc(returnCode);
return instanceResult;
}
示例13: givenInstanceResult
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
private InstanceResult givenInstanceResult(int returnCode) {
InstanceResult instanceResult = new InstanceResult();
InstanceInfo instanceInfo = new InstanceInfo();
instanceInfo.setAccessInfo("TSReturnAccessInfo");
instanceInfo.setBaseUrl("TS_RETURN_BASE_URL");
instanceInfo.setInstanceId("TSReturnInstanceId");
instanceInfo.setLoginPath("TSReturnLoginPath");
instanceResult.setInstance(instanceInfo);
instanceResult.setRc(returnCode);
return instanceResult;
}
示例14: validateInstanceInfo
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
private void validateInstanceInfo(ServiceAccessType accessType)
throws Throwable {
ApplicationServiceBean bean = mockForInstanceInfoValidation(accessType);
InstanceInfo info = createInstanceInfo();
bean.validateInstanceInfo(info, subscription);
}
示例15: validateInstanceInfo_AccessInfo_NoneOnTP
import org.oscm.provisioning.data.InstanceInfo; //导入依赖的package包/类
private void validateInstanceInfo_AccessInfo_NoneOnTP(
ServiceAccessType accessType) throws Throwable {
ApplicationServiceBean bean = mockForInstanceInfoValidation(accessType);
// no access info available on technical service
doReturn(null).when(bean.localizer).getLocalizedTextFromDatabase(
anyString(), anyLong(),
eq(LocalizedObjectTypes.TEC_PRODUCT_LOGIN_ACCESS_DESC));
InstanceInfo info = createInstanceInfo();
bean.validateInstanceInfo(info, subscription);
}