2 * Copyright 2017 BOCO Corporation. CMCC Technologies Co., Ltd
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.vfc.nfvo.emsdriver.messagemgr;
18 import static org.junit.Assert.*;
20 import org.junit.Before;
21 import org.junit.Test;
22 import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannel;
24 public class MessageChannelTest {
26 private MessageChannel messageChannel;
29 messageChannel = new MessageChannel();
33 public void MessageChannel(){
34 MessageChannel messageChannel = new MessageChannel(10);
35 assertNotNull(messageChannel.getQueue());
36 MessageChannel messageChannel1 = new MessageChannel(0);
37 assertNotNull(messageChannel1.getQueue());
41 public void put() throws Exception{
42 Object obj = new Object();
43 messageChannel.put(obj);
45 assertEquals(1, messageChannel.size());
49 public void get() throws Exception{
50 Object obj = new Object();
51 messageChannel.put(obj);
52 Object objr = messageChannel.get();
57 public void poll() throws Exception{
58 Object obj = new Object();
59 messageChannel.put(obj);
60 Object objr = messageChannel.poll();
65 public void clear() throws Exception{
66 Object obj = new Object();
67 messageChannel.put(obj);
68 messageChannel.clear();
69 assertEquals(0, messageChannel.size());