Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
Minor code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sfuhrm committed Dec 11, 2019
1 parent 7fd1fe0 commit 84c4665
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ public Device getDevice(final File path) {
* @param port the port of the agent
* @param community the community of the agent or {@code null} will set it to {@code public}
*/
public AgentConfiguration(@JsonProperty(value = "name", required = false) final String name,
@JsonProperty(value = "device", required = false) final File deviceConfiguration,
public AgentConfiguration(@JsonProperty(value = "name") final String name,
@JsonProperty(value = "device") final File deviceConfiguration,
@JsonProperty(value = "walk", required = true) final File walk,
@JsonProperty(value = "ip", required = true) final String ip,
@JsonProperty(value = "port", required = true) final int port,
@JsonProperty(value = "community", required = false) final String community) {
@JsonProperty(value = "community") final String community) {
this.name = Optional.ofNullable(name).orElse(ip + ":" + port);
this.address = GenericAddress.parse(ip + "/" + port);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Device {
* @param name the name of the device
* @param modifiers the modifiers
*/
Device(@JsonProperty("name") final String name, @JsonProperty("modifiers") final Modifier[] modifiers, @JsonProperty(value = "vlans", required = false) final Long[] vlans) {
Device(@JsonProperty("name") final String name, @JsonProperty("modifiers") final Modifier[] modifiers, @JsonProperty(value = "vlans") final Long[] vlans) {
this.name = name;
if (modifiers != null) {
this.modifiers = Collections.unmodifiableList(Arrays.asList(modifiers));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class CommunityIndexCounter32Modifier implements CommunityContextModifier
@Getter private Map<Long, Long> communityContextMapping = new HashMap<>();

@Override
@SuppressWarnings("unchecked")
public void init(final ModifierProperties properties) {
communityContextMapping = new HashMap<>();
properties.entrySet().stream().filter(property -> getUnsignedLong(property.getKey()) != -1L &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public int compareTo(final Variable variable) {
return this.variable.compareTo(variable);
}

@SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException", "CloneDoesntCallSuperClone", "unchecked"})
@SuppressWarnings({"CloneDoesntCallSuperClone", "unchecked"})
@Override
public Object clone() {
log.trace("variable {} will be cloned", variable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public abstract class AbstractSnmpmanTest {

protected Snmpman snmpman;
protected static String COMMUNITY = "public";
protected static final String COMMUNITY = "public";
protected static final int PORT = 10009;

@BeforeMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CommunityIndexCounter32ModifierTest {
private long contextValue1;
private long context2;
private long contextValue2;
private final String oid = "1.3.6.1.2.1.17.2.4.0";
private static final String OID = "1.3.6.1.2.1.17.2.4.0";

@BeforeTest
private void setUp() {
Expand Down Expand Up @@ -75,7 +75,7 @@ public void testGetVariableBindings() {
modifier.init(modifierProperties);

final OctetString context1 = new OctetString("20");
final OID queryOID1 = new OID(oid);
final OID queryOID1 = new OID(OID);
final Map<OID, Variable> variableBindings1 = modifier.getVariableBindings(context1, queryOID1);

assertEquals(variableBindings1.size(), 1);
Expand Down

0 comments on commit 84c4665

Please sign in to comment.