本文整理汇总了Java中org.osc.sdk.controller.element.Element.getElementId方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getElementId方法的具体用法?Java Element.getElementId怎么用?Java Element.getElementId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osc.sdk.controller.element.Element
的用法示例。
在下文中一共展示了Element.getElementId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: throwExceptionIfNullElementAndId
import org.osc.sdk.controller.element.Element; //导入方法依赖的package包/类
public void throwExceptionIfNullElementAndId(Element element, String type) {
if (element == null || element.getElementId() == null) {
String msg = String.format("null passed for %s !", type);
LOG.error(msg);
throw new IllegalArgumentException(msg);
}
}
示例2: testApi_RemoveAllInspectionHooks_PortPairRemains
import org.osc.sdk.controller.element.Element; //导入方法依赖的package包/类
@Test
public void testApi_RemoveAllInspectionHooks_PortPairRemains() throws Exception {
// Arrange.
InspectionPortEntity inspectionPortElement = new InspectionPortEntity(null, ingress, egress);
String inspectedId = inspected.getElementId();
assertNotNull(inspectedId);
this.txControl.required(() -> {
PortEntity tmp = this.em.find(PortEntity.class, inspectedId);
assertEquals(null, tmp);
return null;
});
// expected before installInspectionHook
Element registeredElement = this.redirApi.registerInspectionPort(inspectionPortElement);
String elementId = registeredElement.getElementId();
InspectionPortEntity foundInspectionPort = this.txControl.required(() -> {
return this.em.find(InspectionPortEntity.class, elementId);
});
assertNotNull(foundInspectionPort);
assertEquals(elementId, foundInspectionPort.getElementId());
// Act.
this.redirApi.removeAllInspectionHooks(inspected);
// Assert.
foundInspectionPort = this.txControl.required(() -> {
return this.em.find(InspectionPortEntity.class, elementId);
});
assertNotNull(foundInspectionPort);
assertEquals(elementId, foundInspectionPort.getElementId());
}
开发者ID:opensecuritycontroller,项目名称:sdn-controller-nsc-plugin,代码行数:37,代码来源:SampleSdnRedirectionApiTest.java
示例3: testApi_RemoveInspectionPort_InspectionPortDisappears
import org.osc.sdk.controller.element.Element; //导入方法依赖的package包/类
@Test
public void testApi_RemoveInspectionPort_InspectionPortDisappears() throws Exception {
// Arrange.
InspectionPortEntity inspectionPortElement = new InspectionPortEntity(null, ingress, egress);
String inspectedId = inspected.getElementId();
assertNotNull(inspectedId);
// expected before installInspectionHook
Element registeredElement = this.redirApi.registerInspectionPort(inspectionPortElement);
assertTrue(registeredElement instanceof InspectionPortEntity);
String elementId = registeredElement.getElementId();
InspectionPortEntity foundInspectionPort = this.txControl.required(() -> {
InspectionPortEntity tmpInspectionPort = this.em.find(InspectionPortEntity.class, elementId);
assertNotNull(tmpInspectionPort);
return tmpInspectionPort;
});
assertEquals(elementId, foundInspectionPort.getElementId());
// Act.
// The inspectionPortElement does not have an id. Should still work.
this.redirApi.removeInspectionPort(inspectionPortElement);
// Assert.
foundInspectionPort = this.txControl.required(() -> {
return this.em.find(InspectionPortEntity.class, elementId);
});
assertEquals(null, foundInspectionPort);
}
开发者ID:opensecuritycontroller,项目名称:sdn-controller-nsc-plugin,代码行数:34,代码来源:SampleSdnRedirectionApiTest.java
示例4: matches
import org.osc.sdk.controller.element.Element; //导入方法依赖的package包/类
@Override
public boolean matches(Object object) {
if (object == null || !(object instanceof Element)) {
return false;
}
Element element = (Element) object;
return (element.getElementId() == null && this.id == null) || this.id.equals(element.getElementId());
}
示例5: DefaultInspectionPort
import org.osc.sdk.controller.element.Element; //导入方法依赖的package包/类
public DefaultInspectionPort(NetworkElement ingressPort, NetworkElement egressPort, Element element) {
this.ingressPort = ingressPort;
this.egressPort = egressPort;
this.elementId = (element != null ? element.getElementId() : null);
this.parentId = (element != null ? element.getParentId() : null);
}