package org.onap.policy.controlloop;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
import org.junit.Test;
package org.onap.policy.controlloop.compiler;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
import java.io.InputStream;
import java.io.Serializable;
-import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
* @return builder object
* @throws BuilderException builder exception
*/
- public ControlLoopPolicyBuilder setPNF(Pnf pnf) throws BuilderException;
+ public ControlLoopPolicyBuilder setPnf(Pnf pnf) throws BuilderException;
/**
* Remove PNF.
* @return the object
* @throws BuilderException builder exception
*/
- public ControlLoopPolicyBuilder removePNF() throws BuilderException;
+ public ControlLoopPolicyBuilder removePnf() throws BuilderException;
/**
* Set the abatement.
public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Pnf pnf) throws BuilderException {
this(controlLoopName, timeout);
- this.setPNF(pnf);
+ this.setPnf(pnf);
}
/**
}
@Override
- public ControlLoopPolicyBuilder removePNF() throws BuilderException {
+ public ControlLoopPolicyBuilder removePnf() throws BuilderException {
controlLoopPolicy.getControlLoop().setPnf(null);
return this;
}
}
@Override
- public ControlLoopPolicyBuilder setPNF(Pnf pnf) throws BuilderException {
+ public ControlLoopPolicyBuilder setPnf(Pnf pnf) throws BuilderException {
if (pnf == null) {
throw new BuilderException("PNF must not be null");
}
import org.onap.policy.controlloop.policy.FinalResult;
public class ControlLoopCompilerTest {
-
- private static final String POLICY_RECIPE_IS_INVALID = "Policy recipe is invalid";
private static final String RESTART_UNKNOWN_POLICY =
"Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy";
@Rule
ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, pnf);
assertEquals(pnf, builder.getControlLoop().getPnf());
- builder.removePNF();
+ builder.removePnf();
assertNull(builder.getControlLoop().getPnf());
}
Pnf pnf = new Pnf();
pnf.setPnfType(PnfType.ENODEB);
- builder.setPNF(pnf);
+ builder.setPnf(pnf);
assertEquals(pnf, builder.getControlLoop().getPnf());
- builder.removePNF();
+ builder.removePnf();
assertNull(builder.getControlLoop().getPnf());
}
ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("PNF must not be null");
- builder.setPNF(null);
+ builder.setPnf(null);
}
@Test
ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Invalid PNF - need either pnfName or pnfType");
- builder.setPNF(new Pnf());
+ builder.setPnf(new Pnf());
}
@Test
// Set pnf
//
if (policyTobuild.getControlLoop().getPnf() != null) {
- builder = builder.setPNF(policyTobuild.getControlLoop().getPnf());
+ builder = builder.setPnf(policyTobuild.getControlLoop().getPnf());
}
//
// Add the policies and be sure to set the trigger policy