use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.
the class SuppressionConfigTest method setUp.
@Before
public void setUp() throws Exception {
ConfigApplyDelegate delegate = config -> {
};
ObjectMapper mapper = new ObjectMapper();
cfg = new SuppressionConfig();
cfg.init(APP_ID, LldpLinkProvider.CONFIG_KEY, JsonNodeFactory.instance.objectNode(), mapper, delegate);
}
use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.
the class SnmpDeviceProviderTest method setUp.
@Before
public void setUp() throws Exception {
provider.controller = controller;
provider.providerRegistry = providerRegistry;
provider.deviceService = deviceService;
provider.netCfgService = netCfgService;
provider.deviceStore = deviceStore;
provider.coreService = coreService;
JsonNode jsonNode = mapper.readTree(jsonStream);
ConfigApplyDelegate delegate = new MockDelegate();
config.init(deviceId, KEY, jsonNode, mapper, delegate);
provider.activate(null);
}
use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.
the class BasicFeatureConfigTest method basicTest.
@Test
public void basicTest() {
ConfigApplyDelegate delegate = configApply -> {
};
ObjectMapper mapper = new ObjectMapper();
TestConfig enabled = new TestConfig(true);
TestConfig disabled = new TestConfig(false);
enabled.init("enabled", "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
disabled.init("disabled", "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
assertThat(enabled.enabled(), is(true));
assertThat(disabled.enabled(), is(false));
disabled.enabled(true);
enabled.enabled(false);
assertThat(enabled.enabled(), is(false));
assertThat(disabled.enabled(), is(true));
}
use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.
the class McastConfigTest method setUp.
/**
* Initialize test related variables.
*
* @throws Exception
*/
@Before
public void setUp() throws Exception {
InputStream jsonStream = McastConfigTest.class.getResourceAsStream("/mcast-config.json");
InputStream invalidJsonStream = McastConfigTest.class.getResourceAsStream("/mcast-config-invalid.json");
InputStream jsonStreamForInnerVlan = McastConfigTest.class.getResourceAsStream("/mcast-config-inner.json");
InputStream invalidJsonStreamForInnerVlan = McastConfigTest.class.getResourceAsStream("/mcast-config-invalid-inner.json");
ApplicationId subject = APP_ID;
String key = CoreService.CORE_APP_NAME;
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(jsonStream);
JsonNode invalidJsonNode = mapper.readTree(invalidJsonStream);
JsonNode jsonNodeForInnerVlan = mapper.readTree(jsonStreamForInnerVlan);
JsonNode invalidJsonNodeForInnerVlan = mapper.readTree(invalidJsonStreamForInnerVlan);
ConfigApplyDelegate delegate = new MockDelegate();
config = new McastConfig();
config.init(subject, key, jsonNode, mapper, delegate);
invalidConfig = new McastConfig();
invalidConfig.init(subject, key, invalidJsonNode, mapper, delegate);
configForInnerVlan = new McastConfig();
configForInnerVlan.init(subject, key, jsonNodeForInnerVlan, mapper, delegate);
invalidConfigForInnerVlan = new McastConfig();
invalidConfigForInnerVlan.init(subject, key, invalidJsonNodeForInnerVlan, mapper, delegate);
}
use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.
the class AllowedEntityConfigTest method basicTest.
@Test
public void basicTest() {
ConfigApplyDelegate delegate = configApply -> {
};
ObjectMapper mapper = new ObjectMapper();
TestConfig allowed = new TestConfig();
TestConfig notAllowed = new TestConfig();
allowed.init("enabled", "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
notAllowed.init("disabled", "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
notAllowed.isAllowed(false);
assertThat(allowed.isAllowed(), is(true));
assertThat(notAllowed.isAllowed(), is(false));
notAllowed.isAllowed(true);
allowed.isAllowed(false);
assertThat(allowed.isAllowed(), is(false));
assertThat(notAllowed.isAllowed(), is(true));
}
Aggregations