本文整理汇总了Java中org.oscm.app.iaas.data.ResourceType类的典型用法代码示例。如果您正苦于以下问题:Java ResourceType类的具体用法?Java ResourceType怎么用?Java ResourceType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceType类属于org.oscm.app.iaas.data包,在下文中一共展示了ResourceType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process_CatchMissingResourceException
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test
public void process_CatchMissingResourceException() throws Exception {
// given
paramHandler.setOperation(Operation.VSERVER_DELETION);
paramHandler.setVserverId("serverId");
doThrow(
new MissingResourceException("test", ResourceType.VSERVER,
"serverId")).when(vServerProcessor).validateParameters(
paramHandler);
// when
vServerProcessor.process("controllerId", "instanceId", paramHandler);
// then
assertEquals(FlowState.VSERVER_DELETING, paramHandler.getState());
assertEquals("", paramHandler.getVserverId());
}
示例2: process_CatchMissingResourceException
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test
public void process_CatchMissingResourceException() throws Exception {
// given
paramHandler.setOperation(Operation.VSYSTEM_DELETION);
paramHandler.setVsysId("systemId");
doThrow(
new MissingResourceException("test", ResourceType.VSYSTEM,
"systemId")).when(vSystemProcessor).validateParameters(
paramHandler);
// when
vSystemProcessor.process("controllerId", "instanceId", paramHandler);
// then
assertEquals(FlowState.DESTROYED, paramHandler.getState());
assertEquals("", paramHandler.getVsysId());
}
示例3: createMissingResourceException
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
public void createMissingResourceException(String message,
HashMap<String, String> values) throws MissingResourceException {
ResourceType type = ResourceType.UNKNOWN;
String id = null;
if (message != null) {
message = message.trim();
if (message.startsWith("VSYS10050")) {
type = ResourceType.VSYSTEM;
id = values.get(LParameter.LPLATFORM_ID);
} else if (message.startsWith("VSYS10069")
|| message.startsWith("VSYS10060")) {
type = ResourceType.VSERVER;
id = values.get(LParameter.LSERVER_ID);
}
}
throw new MissingResourceException(message, type, id);
}
示例4: createMissingResourceException_VSYS10060
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test
public void createMissingResourceException_VSYS10060() throws Exception {
// given
String errormessage = "VSYS10060";
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put(LParameter.LSERVER_ID, "SERVER01");
// when
try {
vdcClient.createMissingResourceException(errormessage, parameters);
}
// then
catch (MissingResourceException e) {
assertEquals(errormessage, e.getMessage());
assertEquals("SERVER01", e.getResouceId());
assertEquals(ResourceType.VSERVER, e.getResouceType());
}
}
示例5: createMissingResourceException_VSYS10050
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test
public void createMissingResourceException_VSYS10050() throws Exception {
// given
String errormessage = "VSYS10050";
String platformID = "PLATFORM1";
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put(LParameter.LPLATFORM_ID, platformID);
// when
try {
vdcClient.createMissingResourceException(errormessage, parameters);
}
// then
catch (MissingResourceException e) {
assertEquals(errormessage, e.getMessage());
assertEquals(platformID, e.getResouceId());
assertEquals(ResourceType.VSYSTEM, e.getResouceType());
}
}
示例6: getSuspendException
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
/**
* Creates a SuspendException related to this exception.
*
* @return the SuspendException
*/
public SuspendException getSuspendException() {
if (ResourceType.UNKNOWN.equals(getResouceType())) {
return new SuspendException(Messages.getAll(
"error_resource_missing_unknown_type", new Object[] {
getResouceType(), getResouceId(), getMessage() }));
} else {
return new SuspendException(Messages.getAll(
"error_resource_missing", new Object[] { getResouceType(),
getResouceId() }));
}
}
示例7: process
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Override
public void process(String controllerId, String instanceId,
PropertyHandler paramHandler) throws Exception {
if (paramHandler.isVirtualSystemProvisioning()) {
try {
validateParameters(paramHandler);
dispatch(controllerId, instanceId, paramHandler);
} catch (MissingResourceException e) {
ResourceType resourceType = e.getResouceType();
if (ResourceType.VSYSTEM.equals(resourceType)
&& Operation.VSYSTEM_DELETION.equals(paramHandler
.getOperation())
&& paramHandler.getVsysId() != null
&& paramHandler.getVsysId().equals(e.getResouceId())) {
logger.warn(
"Ignoring missing resource since virtual system {} is to be deleted anyway",
paramHandler.getVsysId());
// adapt internal knowledge about the instance an try to
// finalize the deletion process
paramHandler.setState(FlowState.VSYSTEM_DELETING);
paramHandler.setVsysId("");
dispatch(controllerId, instanceId, paramHandler);
} else if (ResourceType.VSYSTEM.equals(resourceType)
&& Operation.VSYSTEM_OPERATION.equals(paramHandler
.getOperation())) {
throw new InstanceNotAliveException(Messages.getAll(
"error_suspend_instance_error", e.getMessage()));
} else {
throw e.getSuspendException();
}
}
} else {
throw new RuntimeException("Wrong processoer");
}
}
示例8: process_ThrowSuspendException_ResourceTypeFalse
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test(expected = SuspendException.class)
public void process_ThrowSuspendException_ResourceTypeFalse()
throws Exception {
// given
doThrow(
new MissingResourceException("test", ResourceType.UNKNOWN,
"serverId")).when(vServerProcessor).validateParameters(
paramHandler);
// when
vServerProcessor.process("controllerId", "instanceId", paramHandler);
}
示例9: process_ThrowSuspendException_NoResourceType
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test(expected = SuspendException.class)
public void process_ThrowSuspendException_NoResourceType() throws Exception {
// given
doThrow(
new MissingResourceException("test", ResourceType.VSERVER,
"serverId")).when(vServerProcessor).validateParameters(
paramHandler);
// when
vServerProcessor.process("controllerId", "instanceId", paramHandler);
}
示例10: process_ThrowSuspendException_NoServerId
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test(expected = SuspendException.class)
public void process_ThrowSuspendException_NoServerId() throws Exception {
// given
paramHandler.setOperation(Operation.VSERVER_DELETION);
paramHandler.setVserverId(null);
doThrow(
new MissingResourceException("test", ResourceType.VSERVER,
"serverId")).when(vServerProcessor).validateParameters(
paramHandler);
// when
vServerProcessor.process("controllerId", "instanceId", paramHandler);
}
示例11: process_ThrowSuspendException_ServerIdFalse
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test(expected = SuspendException.class)
public void process_ThrowSuspendException_ServerIdFalse() throws Exception {
// given
paramHandler.setOperation(Operation.VSERVER_DELETION);
paramHandler.setVserverId("serverIdTest");
doThrow(
new MissingResourceException("test", ResourceType.VSERVER,
"serverId")).when(vServerProcessor).validateParameters(
paramHandler);
// when
vServerProcessor.process("controllerId", "instanceId", paramHandler);
}
示例12: process_ThrowSuspendException_ResourceTypeFalse
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test(expected = SuspendException.class)
public void process_ThrowSuspendException_ResourceTypeFalse()
throws Exception {
// given
doThrow(
new MissingResourceException("test", ResourceType.UNKNOWN,
"systemId")).when(vSystemProcessor).validateParameters(
paramHandler);
// when
vSystemProcessor.process("controllerId", "instanceId", paramHandler);
}
示例13: process_ThrowSuspendException_NoResourceType
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test(expected = SuspendException.class)
public void process_ThrowSuspendException_NoResourceType() throws Exception {
// given
doThrow(
new MissingResourceException("test", ResourceType.VSYSTEM,
"systemId")).when(vSystemProcessor).validateParameters(
paramHandler);
// when
vSystemProcessor.process("controllerId", "instanceId", paramHandler);
}
示例14: process_ThrowSuspendException_NoServerId
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test(expected = SuspendException.class)
public void process_ThrowSuspendException_NoServerId() throws Exception {
// given
paramHandler.setOperation(Operation.VSYSTEM_DELETION);
paramHandler.setVsysId(null);
doThrow(
new MissingResourceException("test", ResourceType.VSYSTEM,
"systemId")).when(vSystemProcessor).validateParameters(
paramHandler);
// when
vSystemProcessor.process("controllerId", "instanceId", paramHandler);
}
示例15: process_ThrowSuspendException_ServerIdFalse
import org.oscm.app.iaas.data.ResourceType; //导入依赖的package包/类
@Test(expected = SuspendException.class)
public void process_ThrowSuspendException_ServerIdFalse() throws Exception {
// given
paramHandler.setOperation(Operation.VSYSTEM_DELETION);
paramHandler.setVsysId("serverIdTest");
doThrow(
new MissingResourceException("test", ResourceType.VSYSTEM,
"systemId")).when(vSystemProcessor).validateParameters(
paramHandler);
// when
vSystemProcessor.process("controllerId", "instanceId", paramHandler);
}