2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property
6 * ================================================================================
7 * Modifications Copyright (C) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ================================================================================
23 package org.onap.portalapp.scheduler;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.fail;
27 import org.junit.Rule;
28 import org.junit.Test;
29 import org.junit.rules.ExpectedException;
30 import org.onap.portalsdk.core.scheduler.Registerable;
31 import org.onap.portalsdk.workflow.services.WorkflowScheduleService;
32 import org.springframework.scheduling.quartz.SchedulerFactoryBean;
34 public class RegistryAdapterTest {
36 public final ExpectedException thrown = ExpectedException.none();
39 public void testRegistryAdapter() {
40 RegistryAdapter adapter = new RegistryAdapter();
41 SchedulerFactoryBean schedulerBean = new SchedulerFactoryBean();
42 Registerable registry = null;
43 WorkflowScheduleService workflowScheduleService = null;
45 adapter.setSchedulerBean(schedulerBean);
46 assertEquals(adapter.getSchedulerBean(), schedulerBean);
47 adapter.setRegistry(registry);
48 assertEquals(adapter.getRegistry(), registry);
49 adapter.setWorkflowScheduleService(workflowScheduleService);
50 assertEquals(adapter.getWorkflowScheduleService(), workflowScheduleService);
54 public void testRegistryAdapterNegCase1() {
55 thrown.expect(NullPointerException.class);
57 RegistryAdapter adapter = new RegistryAdapter();
58 adapter.getTriggers();
59 fail("Expecting an exception.");
63 public void testRegistryAdapterNegCase2() {
64 thrown.expect(NullPointerException.class);
66 RegistryAdapter adapter = new RegistryAdapter();
67 adapter.addCoreTriggers();
68 fail("Expecting an exception.");