当前位置: 首页>>代码示例>>Java>>正文


Java Network类代码示例

本文整理汇总了Java中org.oscm.app.iaas.data.Network的典型用法代码示例。如果您正苦于以下问题:Java Network类的具体用法?Java Network怎么用?Java Network使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Network类属于org.oscm.app.iaas.data包,在下文中一共展示了Network类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNetworks

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
public List<Network> getNetworks() {
    List<Network> result = new LinkedList<Network>();
    if (configuration != null) {
        List<HierarchicalConfiguration> networks = configuration
                .configurationsAt("networks.network");
        for (HierarchicalConfiguration networkEntry : networks) {
            int maxVm = 0;
            try {
                maxVm = Integer.parseInt(networkEntry
                        .getString("numOfMaxVm"));
            } catch (NumberFormatException e) {
                maxVm = Integer.MAX_VALUE;
            }
            Network network = new Network(networkEntry.getString("name"),
                    networkEntry.getString("networkCategory"),
                    networkEntry.getString("networkId"), maxVm);
            result.add(network);
        }
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:22,代码来源:LPlatformBase.java

示例2: resolveValidNetworkId_null_deterministic

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void resolveValidNetworkId_null_deterministic() throws Exception {
    LPlatformClient lPlatformClient = mock(LPlatformClient.class);
    LPlatformConfiguration lPlatformConfiguration = mock(LPlatformConfiguration.class);
    VSystemConfiguration vSystemConfiguration = null;
    paramHandler.getIaasContext().add(vSystemConfiguration);
    List<Network> networks = new ArrayList<>();
    networks.add(new Network(NETWORKID1, "net", NETWORKID1, 2));

    doReturn(lPlatformClient).when(rorVServerCommunication)
            .getLPlatformClient(paramHandler);
    doReturn(lPlatformConfiguration).when(lPlatformClient)
            .getConfiguration();
    doReturn(networks).when(lPlatformConfiguration).getNetworks();

    // when
    String resolvedId = rorVServerCommunication
            .resolveValidNetworkId(paramHandler);

    // then
    assertEquals(NETWORKID1, resolvedId);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:23,代码来源:RORVServerCommunicationTest.java

示例3: resolveValidNetworkId_empty_deterministic

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void resolveValidNetworkId_empty_deterministic() throws Exception {
    LPlatformClient lPlatformClient = mock(LPlatformClient.class);
    LPlatformConfiguration lPlatformConfiguration = mock(LPlatformConfiguration.class);
    paramHandler.getIaasContext().add(lPlatformConfiguration);
    parameters.put(PropertyHandler.NETWORK_ID, new Setting(
            PropertyHandler.NETWORK_ID, ""));
    List<Network> networks = new ArrayList<>();
    networks.add(new Network(NETWORKID1, "net", NETWORKID1, 2));

    doReturn(lPlatformClient).when(rorVServerCommunication)
            .getLPlatformClient(paramHandler);
    doReturn(lPlatformConfiguration).when(lPlatformClient)
            .getConfiguration();
    doReturn(networks).when(lPlatformConfiguration).getNetworks();

    // when
    String resolvedId = rorVServerCommunication
            .resolveValidNetworkId(paramHandler);

    // then
    assertEquals(NETWORKID1, resolvedId);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:24,代码来源:RORVServerCommunicationTest.java

示例4: resolveValidNetworkId_null_nondeterministic

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test(expected = APPlatformException.class)
public void resolveValidNetworkId_null_nondeterministic() throws Exception {
    LPlatformClient lPlatformClient = mock(LPlatformClient.class);
    LPlatformConfiguration lPlatformConfiguration = mock(LPlatformConfiguration.class);
    VSystemConfiguration vSystemConfiguration = null;
    paramHandler.getIaasContext().add(vSystemConfiguration);
    List<Network> networks = new ArrayList<>();
    networks.add(new Network(NETWORKID1, "net", NETWORKID1, 2));
    networks.add(new Network(NETWORKID2, "net", NETWORKID2, 2));

    doReturn(lPlatformClient).when(rorVServerCommunication)
            .getLPlatformClient(paramHandler);
    doReturn(lPlatformConfiguration).when(lPlatformClient)
            .getConfiguration();
    doReturn(networks).when(lPlatformConfiguration).getNetworks();

    // when
    rorVServerCommunication.resolveValidNetworkId(paramHandler);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:20,代码来源:RORVServerCommunicationTest.java

示例5: resolveValidNetworkId_name_deterministic

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void resolveValidNetworkId_name_deterministic() throws Exception {
    LPlatformClient lPlatformClient = mock(LPlatformClient.class);
    LPlatformConfiguration lPlatformConfiguration = mock(LPlatformConfiguration.class);
    VSystemConfiguration vSystemConfiguration = null;
    paramHandler.getIaasContext().add(vSystemConfiguration);
    parameters.put(PropertyHandler.NETWORK_ID, new Setting(
            PropertyHandler.NETWORK_ID, NETWORKID1 + "_name"));
    List<Network> networks = new ArrayList<>();
    networks.add(new Network(NETWORKID1 + "_name", "net", NETWORKID1, 2));
    networks.add(new Network(NETWORKID2 + "_name", "net", NETWORKID2, 2));

    doReturn(lPlatformClient).when(rorVServerCommunication)
            .getLPlatformClient(paramHandler);
    doReturn(lPlatformConfiguration).when(lPlatformClient)
            .getConfiguration();
    doReturn(networks).when(lPlatformConfiguration).getNetworks();

    // when
    String resolvedId = rorVServerCommunication
            .resolveValidNetworkId(paramHandler);

    // then
    assertEquals(NETWORKID1, resolvedId);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:26,代码来源:RORVServerCommunicationTest.java

示例6: resolveValidNetworkId_id_deterministic

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void resolveValidNetworkId_id_deterministic() throws Exception {
    LPlatformClient lPlatformClient = mock(LPlatformClient.class);
    LPlatformConfiguration lPlatformConfiguration = mock(LPlatformConfiguration.class);
    VSystemConfiguration vSystemConfiguration = null;
    paramHandler.getIaasContext().add(vSystemConfiguration);
    parameters.put(PropertyHandler.NETWORK_ID, new Setting(
            PropertyHandler.NETWORK_ID, NETWORKID1));
    List<Network> networks = new ArrayList<>();
    networks.add(new Network(NETWORKID1 + "_name", "net", NETWORKID1, 2));
    networks.add(new Network(NETWORKID2 + "_name", "net", NETWORKID2, 2));

    doReturn(lPlatformClient).when(rorVServerCommunication)
            .getLPlatformClient(paramHandler);
    doReturn(lPlatformConfiguration).when(lPlatformClient)
            .getConfiguration();
    doReturn(networks).when(lPlatformConfiguration).getNetworks();

    // when
    String resolvedId = rorVServerCommunication
            .resolveValidNetworkId(paramHandler);

    // then
    assertEquals(NETWORKID1, resolvedId);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:26,代码来源:RORVServerCommunicationTest.java

示例7: resolveValidNetworkId_name_nondeterministic

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test(expected = APPlatformException.class)
public void resolveValidNetworkId_name_nondeterministic() throws Exception {
    LPlatformClient lPlatformClient = mock(LPlatformClient.class);
    LPlatformConfiguration lPlatformConfiguration = mock(LPlatformConfiguration.class);
    VSystemConfiguration vSystemConfiguration = null;
    paramHandler.getIaasContext().add(vSystemConfiguration);
    parameters.put(PropertyHandler.NETWORK_ID, new Setting(
            PropertyHandler.NETWORK_ID, NETWORKID1 + "_name"));
    List<Network> networks = new ArrayList<>();
    networks.add(new Network(NETWORKID1 + "_name", "net", NETWORKID1, 2));
    networks.add(new Network(NETWORKID1 + "_name", "net", NETWORKID2, 2));

    doReturn(lPlatformClient).when(rorVServerCommunication)
            .getLPlatformClient(paramHandler);
    doReturn(lPlatformConfiguration).when(lPlatformClient)
            .getConfiguration();
    doReturn(networks).when(lPlatformConfiguration).getNetworks();

    // when
    rorVServerCommunication.resolveValidNetworkId(paramHandler);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:22,代码来源:RORVServerCommunicationTest.java

示例8: isNetworkIdValid_Valid

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void isNetworkIdValid_Valid() throws Exception {
    // given
    LPlatformClient lPlatformClient = mock(LPlatformClient.class);
    LPlatformConfiguration lPlatformConfiguration = mock(LPlatformConfiguration.class);
    VSystemConfiguration vSystemConfiguration = null;
    paramHandler.getIaasContext().add(vSystemConfiguration);
    parameters.put(PropertyHandler.NETWORK_ID, new Setting(
            PropertyHandler.NETWORK_ID, NETWORKID1));
    List<Network> networks = new ArrayList<>();
    networks.add(new Network("NETWORKID1", "net", NETWORKID1, 2));
    networks.add(new Network("NETWORKID2", "net", NETWORKID2, 2));

    doReturn(lPlatformClient).when(rorVServerCommunication)
            .getLPlatformClient(paramHandler);
    doReturn(lPlatformConfiguration).when(lPlatformClient)
            .getConfiguration();
    doReturn(networks).when(lPlatformConfiguration).getNetworks();

    // when
    boolean isNetworkIdValid = rorVServerCommunication
            .isNetworkIdValid(paramHandler);

    // then
    assertTrue(isNetworkIdValid);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:27,代码来源:RORVServerCommunicationTest.java

示例9: isNetworkIdValid_NoNetworkIds

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void isNetworkIdValid_NoNetworkIds() throws Exception {
    // given
    LPlatformClient lPlatformClient = mock(LPlatformClient.class);
    LPlatformConfiguration lPlatformConfiguration = mock(LPlatformConfiguration.class);
    VSystemConfiguration vSystemConfiguration = null;
    paramHandler.getIaasContext().add(vSystemConfiguration);
    parameters.put(PropertyHandler.NETWORK_ID, new Setting(
            PropertyHandler.NETWORK_ID, NETWORKID1));

    doReturn(lPlatformClient).when(rorVServerCommunication)
            .getLPlatformClient(paramHandler);
    doReturn(lPlatformConfiguration).when(lPlatformClient)
            .getConfiguration();
    doReturn(new ArrayList<Network>()).when(lPlatformConfiguration)
            .getNetworks();

    // when
    boolean isNetworkIdValid = rorVServerCommunication
            .isNetworkIdValid(paramHandler);

    // then
    assertFalse(isNetworkIdValid);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:25,代码来源:RORVServerCommunicationTest.java

示例10: getNetworkIds_ConfigurationIsNull

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void getNetworkIds_ConfigurationIsNull() {
    // when
    lPlatformConfiguration = new LPlatformConfiguration(null);
    List<Network> result = lPlatformConfiguration.getNetworks();

    // then
    assertEquals(0, result.size());
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:10,代码来源:LPlatformConfigurationTest.java

示例11: getNetworkIds_NetworkIdIsNull

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void getNetworkIds_NetworkIdIsNull() {
    // given
    HierarchicalConfiguration configuration = prepareConfiguration(
            NETWORKID, null);

    // when
    lPlatformConfiguration = new LPlatformConfiguration(configuration);
    List<Network> result = lPlatformConfiguration.getNetworks();

    // then
    assertEquals(0, result.size());
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:14,代码来源:LPlatformConfigurationTest.java

示例12: getNetworkIds_NetworkIdTrimLengthIsZero

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void getNetworkIds_NetworkIdTrimLengthIsZero() {
    // given
    HierarchicalConfiguration configuration = prepareConfiguration(
            NETWORKID, "   ");

    // when
    lPlatformConfiguration = new LPlatformConfiguration(configuration);
    List<Network> result = lPlatformConfiguration.getNetworks();

    // then
    assertEquals(0, result.size());
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:14,代码来源:LPlatformConfigurationTest.java

示例13: getNetworkIds

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void getNetworkIds() {
    // given
    HierarchicalConfiguration configuration = prepareConfiguration(
            NETWORKID, NETWORKID);
    prepareNetWorks(configuration, NETWORKS);

    // when
    lPlatformConfiguration = new LPlatformConfiguration(configuration);
    List<Network> result = lPlatformConfiguration.getNetworks();

    // then
    assertEquals(1, result.size());
    assertEquals(NETWORKID, result.get(0).getId());
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:16,代码来源:LPlatformConfigurationTest.java

示例14: validateClusterSize

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test
public void validateClusterSize() throws Exception {
    // given
    VSystemTemplateConfiguration templateConfiguration = mock(VSystemTemplateConfiguration.class);
    DiskImage masterImage = mock(DiskImage.class);
    doReturn("masterId").when(masterImage).getDiskImageId();
    doReturn("master").when(masterImage).getDiskImageName();
    doReturn("4").when(masterImage).getMaxCpuCount();
    diskImages.put(masterImage.getDiskImageId(), masterImage);

    DiskImage slaveImage = mock(DiskImage.class);
    doReturn("slaveId").when(slaveImage).getDiskImageId();
    doReturn("slave").when(slaveImage).getDiskImageName();
    doReturn("4").when(slaveImage).getMaxCpuCount();
    diskImages.put(slaveImage.getDiskImageId(), slaveImage);

    Network network = new Network("network", "networkCategory",
            "networkId", 4);
    ArrayList<Network> networkList = new ArrayList<>();
    networkList.add(network);
    doReturn(networkList).when(templateConfiguration).getNetworks();

    VServerConfiguration vserverMaster = mock(VServerConfiguration.class);
    doReturn("networkId").when(vserverMaster).getNetworkId();
    doReturn(masterImage.getDiskImageId()).when(vserverMaster)
            .getDiskImageId();
    VServerConfiguration vserverSlave = mock(VServerConfiguration.class);
    doReturn("networkId").when(vserverSlave).getNetworkId();
    doReturn(slaveImage.getDiskImageId()).when(vserverSlave)
            .getDiskImageId();

    ArrayList<VServerConfiguration> vServerList = new ArrayList<>();
    vServerList.add(vserverMaster);
    vServerList.add(vserverSlave);
    doReturn(vServerList).when(templateConfiguration).getVServers();

    paramHandler.setState(FlowState.VSYSTEM_CREATION_REQUESTED);
    parameters.put(PropertyHandler.COUNT_CPU, new Setting(
            PropertyHandler.COUNT_CPU, "2"));
    parameters.put(PropertyHandler.CLUSTER_SIZE, new Setting(
            PropertyHandler.CLUSTER_SIZE, "2"));
    parameters.put(
            PropertyHandler.MASTER_TEMPLATE_ID,
            new Setting(PropertyHandler.MASTER_TEMPLATE_ID, masterImage
                    .getDiskImageId()));
    parameters
            .put(PropertyHandler.SLAVE_TEMPLATE_ID,
                    new Setting(PropertyHandler.SLAVE_TEMPLATE_ID,
                            slaveImage.getDiskImageId()));
    // when
    vSystemProcessor.validateClusterSize(paramHandler, true, false,
            templateConfiguration);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:54,代码来源:VSystemProcessorBeanTest.java

示例15: validateClusterSize_CreateLimitReached

import org.oscm.app.iaas.data.Network; //导入依赖的package包/类
@Test(expected = AbortException.class)
public void validateClusterSize_CreateLimitReached() throws Exception {
    // given
    VSystemTemplateConfiguration templateConfiguration = mock(VSystemTemplateConfiguration.class);
    DiskImage masterImage = mock(DiskImage.class);
    doReturn("masterId").when(masterImage).getDiskImageId();
    doReturn("master").when(masterImage).getDiskImageName();
    doReturn("4").when(masterImage).getMaxCpuCount();
    diskImages.put(masterImage.getDiskImageId(), masterImage);

    DiskImage slaveImage = mock(DiskImage.class);
    doReturn("slaveId").when(slaveImage).getDiskImageId();
    doReturn("slave").when(slaveImage).getDiskImageName();
    doReturn("4").when(slaveImage).getMaxCpuCount();
    diskImages.put(slaveImage.getDiskImageId(), slaveImage);

    Network network = new Network("network", "networkCategory",
            "networkId", 1);
    ArrayList<Network> networkList = new ArrayList<>();
    networkList.add(network);
    doReturn(networkList).when(templateConfiguration).getNetworks();
    VServerConfiguration vserverMaster = mock(VServerConfiguration.class);
    doReturn("networkId").when(vserverMaster).getNetworkId();
    doReturn(masterImage.getDiskImageId()).when(vserverMaster)
            .getDiskImageId();
    VServerConfiguration vserverSlave = mock(VServerConfiguration.class);
    doReturn("networkId").when(vserverSlave).getNetworkId();
    doReturn(slaveImage.getDiskImageId()).when(vserverSlave)
            .getDiskImageId();

    ArrayList<VServerConfiguration> vServerList = new ArrayList<>();
    vServerList.add(vserverMaster);
    vServerList.add(vserverSlave);
    doReturn(vServerList).when(templateConfiguration).getVServers();

    paramHandler.setState(FlowState.VSYSTEM_CREATION_REQUESTED);
    parameters.put(PropertyHandler.COUNT_CPU, new Setting(
            PropertyHandler.COUNT_CPU, "2"));
    parameters.put(PropertyHandler.CLUSTER_SIZE, new Setting(
            PropertyHandler.CLUSTER_SIZE, "2"));
    parameters.put(
            PropertyHandler.MASTER_TEMPLATE_ID,
            new Setting(PropertyHandler.MASTER_TEMPLATE_ID, masterImage
                    .getDiskImageId()));
    parameters
            .put(PropertyHandler.SLAVE_TEMPLATE_ID,
                    new Setting(PropertyHandler.SLAVE_TEMPLATE_ID,
                            slaveImage.getDiskImageId()));
    // when
    vSystemProcessor.validateClusterSize(paramHandler, true, false,
            templateConfiguration);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:53,代码来源:VSystemProcessorBeanTest.java


注:本文中的org.oscm.app.iaas.data.Network类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。