aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java
blob: 13a8cb21e76677449807575000af679b0513879e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.onap.so.heatbridge.utils;

import static org.assertj.core.api.Assertions.assertThat;
import java.util.Optional;
import org.junit.Test;

public class HeatBridgeUtilsTest {

    @Test(expected = IllegalStateException.class)
    public void matchServerName_canNotBeNull() {
        HeatBridgeUtils.getMatchingPserverPifName(null);
    }

    @Test
    public void matchServerName_isDedicated() {
        Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("dedicated-testServer");
        assertThat(serverName).isNotEmpty().hasValue("sriov-d-testServer");
    }

    @Test
    public void matchServerName_isShared() {
        Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("shared-testServer");
        assertThat(serverName).isNotEmpty().hasValue("sriov-s-testServer");
    }

    @Test
    public void matchServerName_unknown() {
        Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("differentServerName");
        assertThat(serverName).isNotEmpty().hasValue("differentServerName");
    }
}