/*
* ============LICENSE_START=======================================================
- * policy-management
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
public List<String> getCanonicalSessionNames();
+ /**
+ * get base domains.
+ *
+ * @return list of base domains.
+ */
+ public List<String> getBaseDomainNames();
+
/**
* offers an event to this controller for processing.
*
/*
* ============LICENSE_START=======================================================
- * policy-management
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return getSessionNames(false);
}
+ @Override
+ public List<String> getBaseDomainNames() {
+ return new ArrayList<>(this.policyContainer.getKieContainer().getKieBaseNames());
+ }
+
/**
* provides the underlying core layer container sessions.
*
/*
* ============LICENSE_START=======================================================
- * policy-management
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.policy.drools.controller.internal;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.core.PolicyContainer;
return new ArrayList<>();
}
+ @Override
+ public List<String> getBaseDomainNames() {
+ return Collections.emptyList();
+ }
+
@Override
public boolean offer(String topic, String event) {
return false;
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public class MavenDroolsControllerTest {
public static final String JUNIT_ECHO_KSESSION = "echo";
+ public static final String JUNIT_ECHO_KBASE = "onap.policies.test";
public static final String JUNIT_ECHO_KMODULE_DRL_PATH = "src/test/resources/echo.drl";
public static final String JUNIT_ECHO_KMODULE_POM_PATH = "src/test/resources/echo.pom";
public static final String JUNIT_ECHO_KMODULE_PATH = "src/test/resources/echo.kmodule";
}
@Test
- public void stop() throws IOException, InterruptedException {
+ public void stop() throws InterruptedException {
createDroolsController(10000L).stop();
}
@Test
- public void shutdown() throws IOException, InterruptedException {
+ public void shutdown() throws InterruptedException {
createDroolsController(10000L).shutdown();
}
@Test
- public void lock() throws IOException, InterruptedException {
+ public void lock() throws InterruptedException {
DroolsController controller = createDroolsController(30000L);
controller.lock();
/* courtesy timer to allow full initialization from local maven repository */
Thread.sleep(courtesyStartTimeMs);
- Assert.assertTrue(controller.getSessionNames().size() == 1);
+ Assert.assertEquals(1, controller.getSessionNames().size());
Assert.assertEquals(JUNIT_ECHO_KSESSION, controller.getSessionNames().get(0));
- Assert.assertTrue(controller.getCanonicalSessionNames().size() == 1);
+ Assert.assertEquals(1, controller.getCanonicalSessionNames().size());
Assert.assertTrue(controller.getCanonicalSessionNames().get(0).contains(JUNIT_ECHO_KSESSION));
+ Assert.assertEquals(JUNIT_ECHO_KBASE, String.join(",", controller.getBaseDomainNames()));
+
return controller;
}
}
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Assert.assertNull(new NullDroolsController().getContainer());
}
+ @Test
+ public void getDomains() {
+ Assert.assertTrue(new NullDroolsController().getBaseDomainNames().isEmpty());
+ }
+
@Test(expected = IllegalStateException.class)
public void ownsCoder() {
new NullDroolsController().ownsCoder(null, 0);
<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START=======================================================
- archetype-closed-loop-demo-rules
+ ONAP
================================================================================
- Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
-->
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
- <kbase name="kbEcho">
+ <kbase name="onap.policies.test">
<ksession name="echo"/>
</kbase>
</kmodule>