2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
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.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.openecomp.appc.client.impl.protocol;
27 import org.openecomp.appc.client.impl.core.MessageContext;
28 import org.openecomp.appc.client.impl.protocol.AsyncProtocol;
29 import org.openecomp.appc.client.impl.protocol.AsyncProtocolImpl;
30 import org.openecomp.appc.client.impl.protocol.RetrieveMessageCallback;
31 import org.junit.Assert;
32 import org.junit.Test;
34 import java.io.IOException;
35 import java.io.InputStream;
36 import java.util.Properties;
38 public class TestAsyncProtocolImplMissingProps {
40 private static AsyncProtocol protocol;
42 private static class TestCallback implements RetrieveMessageCallback {
44 public void onResponse(String payload, MessageContext context) {
45 Assert.assertFalse("bad Callback !",false);
51 * protocol should throw illegal argument exception due to null properties
53 public void testSetUpMissingProps() {
55 Properties props = new Properties();
56 String propFileName = "ueb.missing.properties";
58 InputStream input = TestAsyncProtocolImplMissingProps.class.getClassLoader().getResourceAsStream(propFileName);
62 } catch (IOException e) {
63 Assert.assertFalse(e.getMessage(),false);
66 protocol = new AsyncProtocolImpl();
68 protocol.init(props, new TestCallback());
69 } catch (IllegalArgumentException e) {
70 Assert.assertTrue(true);
71 } catch (Exception e) {
72 Assert.assertFalse(e.getMessage(),false);