2 * Copyright (c) 2016 Red Hat and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.mdsalutil.tests;
10 import static org.junit.Assert.assertEquals;
12 import java.math.BigInteger;
13 import java.util.ArrayList;
14 import java.util.List;
15 import org.junit.Test;
16 import org.opendaylight.genius.mdsalutil.ActionInfo;
17 import org.opendaylight.genius.mdsalutil.ActionType;
18 import org.opendaylight.genius.mdsalutil.FlowEntity;
19 import org.opendaylight.genius.mdsalutil.InstructionInfo;
20 import org.opendaylight.genius.mdsalutil.InstructionType;
21 import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack;
23 public class ActionInfoImmutableTest {
26 public void actionInfoActionKeyDoesNotMagicallyChangeOnFlowEntityGetFlowBuilder() {
27 FlowEntity flowEntity = new FlowEntity(BigInteger.valueOf(123L));
28 flowEntity.setFlowId("TEST");
29 flowEntity.setCookie(BigInteger.valueOf(110100480L));
30 ActionInfo actionInfo = new ActionNxConntrack(27, 1, 0, 0, (short) 255);
31 List<ActionInfo> actionInfos = new ArrayList<>();
32 actionInfos.add(actionInfo);
33 flowEntity.getInstructionInfoList().add(new InstructionInfo(InstructionType.apply_actions, actionInfos));
34 assertEquals(27, flowEntity.getInstructionInfoList().get(0).getActionInfos().get(0).getActionKey());
36 flowEntity.getFlowBuilder();
37 assertEquals(27, flowEntity.getInstructionInfoList().get(0).getActionInfos().get(0).getActionKey());
38 flowEntity.getFlowBuilder();
39 assertEquals(27, flowEntity.getInstructionInfoList().get(0).getActionInfos().get(0).getActionKey());