Merge "Fix JUnit Race Conditions"
[policy/drools-applications.git] / controlloop / templates / template.demo.v1.0.0 / template.demo / src / test / java / org / onap / policy / template / demo / TestAPPCPayload.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * demo
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.template.demo;
22
23 import java.util.HashMap;
24 import java.util.UUID;
25
26 import org.junit.Test;
27 import org.onap.policy.appc.CommonHeader;
28 import org.onap.policy.appc.Request;
29 import org.onap.policy.appc.util.Serialization;
30 import org.onap.policy.vnf.trafficgenerator.PGRequest;
31 import org.onap.policy.vnf.trafficgenerator.PGStream;
32 import org.onap.policy.vnf.trafficgenerator.PGStreams;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
35
36 public class TestAPPCPayload {
37
38         private static final Logger logger = LoggerFactory.getLogger(TestAPPCPayload.class);
39         @Test
40         public void test() {
41                 PGRequest request = new PGRequest();
42                 request.pgStreams = new PGStreams();
43                 
44                 PGStream pgStream;
45                 for(int i = 0; i < 5; i++){
46                         pgStream = new PGStream();
47                         pgStream.streamId = "fw_udp"+(i+1);
48                         pgStream.isEnabled = "true";
49                         request.pgStreams.pgStream.add(pgStream);
50                 }
51                 
52                 Request appc = new Request();
53                 appc.CommonHeader = new CommonHeader();
54                 appc.CommonHeader.RequestID = UUID.randomUUID();
55                 appc.Action = "ModifyConfig";
56                 appc.Payload = new HashMap<String, Object>();
57                 appc.Payload.put("pg-streams", request);
58                 logger.debug(Serialization.gsonPretty.toJson(appc));
59         }
60
61 }