Search in sources :

Example 1 with NetworkOrchestrationService

use of org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService in project cloudstack by apache.

the class FirewallManagerTest method testApplyRules.

@Ignore("Requires database to be set up")
@Test
public void testApplyRules() {
    List<FirewallRuleVO> ruleList = new ArrayList<FirewallRuleVO>();
    FirewallRuleVO rule = new FirewallRuleVO("rule1", 1, 80, "TCP", 1, 2, 1, FirewallRule.Purpose.Firewall, null, null, null, null);
    ruleList.add(rule);
    FirewallManagerImpl firewallMgr = (FirewallManagerImpl) _firewallMgr;
    NetworkOrchestrationService netMgr = mock(NetworkOrchestrationService.class);
    IpAddressManager addrMgr = mock(IpAddressManager.class);
    firewallMgr._networkMgr = netMgr;
    try {
        firewallMgr.applyRules(ruleList, false, false);
        verify(addrMgr).applyRules(any(List.class), any(FirewallRule.Purpose.class), any(NetworkRuleApplier.class), anyBoolean());
    } catch (ResourceUnavailableException e) {
        Assert.fail("Unreachable code");
    }
}
Also used : IpAddressManager(com.cloud.network.IpAddressManager) NetworkOrchestrationService(org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService) ArrayList(java.util.ArrayList) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) ArrayList(java.util.ArrayList) List(java.util.List) Purpose(com.cloud.network.rules.FirewallRule.Purpose) NetworkRuleApplier(com.cloud.network.NetworkRuleApplier) FirewallRuleVO(com.cloud.network.rules.FirewallRuleVO) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)1 IpAddressManager (com.cloud.network.IpAddressManager)1 NetworkRuleApplier (com.cloud.network.NetworkRuleApplier)1 Purpose (com.cloud.network.rules.FirewallRule.Purpose)1 FirewallRuleVO (com.cloud.network.rules.FirewallRuleVO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 NetworkOrchestrationService (org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1