@@ -64,61 +64,61 @@ public void testCreate() throws Exception {
6464 boolean ignoreMissing = randomBoolean ();
6565 config .put ("ignore_missing" , ignoreMissing );
6666
67- String processorTag = randomAlphaOfLength (10 );
68- CommunityIdProcessor communityIdProcessor = factory .create (null , processorTag , null , config , null );
69- assertThat (communityIdProcessor .getTag (), equalTo (processorTag ));
70- assertThat (communityIdProcessor .getSourceIpField (), equalTo (sourceIpField ));
71- assertThat (communityIdProcessor .getSourcePortField (), equalTo (sourcePortField ));
72- assertThat (communityIdProcessor .getDestinationIpField (), equalTo (destIpField ));
73- assertThat (communityIdProcessor .getDestinationPortField (), equalTo (destPortField ));
74- assertThat (communityIdProcessor .getIanaNumberField (), equalTo (ianaNumberField ));
75- assertThat (communityIdProcessor .getTransportField (), equalTo (transportField ));
76- assertThat (communityIdProcessor .getIcmpTypeField (), equalTo (icmpTypeField ));
77- assertThat (communityIdProcessor .getIcmpCodeField (), equalTo (icmpCodeField ));
78- assertThat (communityIdProcessor .getTargetField (), equalTo (targetField ));
79- assertThat (communityIdProcessor .getSeed (), equalTo (toUint16 (seedInt )));
80- assertThat (communityIdProcessor .getIgnoreMissing (), equalTo (ignoreMissing ));
67+ String tag = randomAlphaOfLength (10 );
68+ CommunityIdProcessor processor = factory .create (null , tag , null , config , null );
69+ assertThat (processor .getTag (), equalTo (tag ));
70+ assertThat (processor .getSourceIpField (), equalTo (sourceIpField ));
71+ assertThat (processor .getSourcePortField (), equalTo (sourcePortField ));
72+ assertThat (processor .getDestinationIpField (), equalTo (destIpField ));
73+ assertThat (processor .getDestinationPortField (), equalTo (destPortField ));
74+ assertThat (processor .getIanaNumberField (), equalTo (ianaNumberField ));
75+ assertThat (processor .getTransportField (), equalTo (transportField ));
76+ assertThat (processor .getIcmpTypeField (), equalTo (icmpTypeField ));
77+ assertThat (processor .getIcmpCodeField (), equalTo (icmpCodeField ));
78+ assertThat (processor .getTargetField (), equalTo (targetField ));
79+ assertThat (processor .getSeed (), equalTo (toUint16 (seedInt )));
80+ assertThat (processor .getIgnoreMissing (), equalTo (ignoreMissing ));
8181 }
8282
8383 public void testSeed () throws Exception {
8484 Map <String , Object > config = new HashMap <>();
85- String processorTag = randomAlphaOfLength (10 );
85+ String tag = randomAlphaOfLength (10 );
8686
8787 // negative seeds are rejected
8888 int tooSmallSeed = randomIntBetween (Integer .MIN_VALUE , -1 );
8989 config .put ("seed" , Integer .toString (tooSmallSeed ));
90- ElasticsearchException e = expectThrows (ElasticsearchException .class , () -> factory .create (null , processorTag , null , config , null ));
90+ ElasticsearchException e = expectThrows (ElasticsearchException .class , () -> factory .create (null , tag , null , config , null ));
9191 assertThat (e .getMessage (), containsString ("must be a value between 0 and 65535" ));
9292
9393 // seeds >= 2^16 are rejected
9494 int tooBigSeed = randomIntBetween (65536 , Integer .MAX_VALUE );
9595 config .put ("seed" , Integer .toString (tooBigSeed ));
96- e = expectThrows (ElasticsearchException .class , () -> factory .create (null , processorTag , null , config , null ));
96+ e = expectThrows (ElasticsearchException .class , () -> factory .create (null , tag , null , config , null ));
9797 assertThat (e .getMessage (), containsString ("must be a value between 0 and 65535" ));
9898
9999 // seeds between 0 and 2^16-1 are accepted
100100 int justRightSeed = randomIntBetween (0 , 65535 );
101101 byte [] expectedSeed = new byte [] { (byte ) (justRightSeed >> 8 ), (byte ) justRightSeed };
102102 config .put ("seed" , Integer .toString (justRightSeed ));
103- CommunityIdProcessor communityIdProcessor = factory .create (null , processorTag , null , config , null );
104- assertThat (communityIdProcessor .getSeed (), equalTo (expectedSeed ));
103+ CommunityIdProcessor processor = factory .create (null , tag , null , config , null );
104+ assertThat (processor .getSeed (), equalTo (expectedSeed ));
105105 }
106106
107107 public void testRequiredFields () throws Exception {
108108 HashMap <String , Object > config = new HashMap <>();
109- String processorTag = randomAlphaOfLength (10 );
110- CommunityIdProcessor communityIdProcessor = factory .create (null , processorTag , null , config , null );
111- assertThat (communityIdProcessor .getTag (), equalTo (processorTag ));
112- assertThat (communityIdProcessor .getSourceIpField (), equalTo (DEFAULT_SOURCE_IP ));
113- assertThat (communityIdProcessor .getSourcePortField (), equalTo (DEFAULT_SOURCE_PORT ));
114- assertThat (communityIdProcessor .getDestinationIpField (), equalTo (DEFAULT_DEST_IP ));
115- assertThat (communityIdProcessor .getDestinationPortField (), equalTo (DEFAULT_DEST_PORT ));
116- assertThat (communityIdProcessor .getIanaNumberField (), equalTo (DEFAULT_IANA_NUMBER ));
117- assertThat (communityIdProcessor .getTransportField (), equalTo (DEFAULT_TRANSPORT ));
118- assertThat (communityIdProcessor .getIcmpTypeField (), equalTo (DEFAULT_ICMP_TYPE ));
119- assertThat (communityIdProcessor .getIcmpCodeField (), equalTo (DEFAULT_ICMP_CODE ));
120- assertThat (communityIdProcessor .getTargetField (), equalTo (DEFAULT_TARGET ));
121- assertThat (communityIdProcessor .getSeed (), equalTo (toUint16 (0 )));
122- assertThat (communityIdProcessor .getIgnoreMissing (), equalTo (true ));
109+ String tag = randomAlphaOfLength (10 );
110+ CommunityIdProcessor processor = factory .create (null , tag , null , config , null );
111+ assertThat (processor .getTag (), equalTo (tag ));
112+ assertThat (processor .getSourceIpField (), equalTo (DEFAULT_SOURCE_IP ));
113+ assertThat (processor .getSourcePortField (), equalTo (DEFAULT_SOURCE_PORT ));
114+ assertThat (processor .getDestinationIpField (), equalTo (DEFAULT_DEST_IP ));
115+ assertThat (processor .getDestinationPortField (), equalTo (DEFAULT_DEST_PORT ));
116+ assertThat (processor .getIanaNumberField (), equalTo (DEFAULT_IANA_NUMBER ));
117+ assertThat (processor .getTransportField (), equalTo (DEFAULT_TRANSPORT ));
118+ assertThat (processor .getIcmpTypeField (), equalTo (DEFAULT_ICMP_TYPE ));
119+ assertThat (processor .getIcmpCodeField (), equalTo (DEFAULT_ICMP_CODE ));
120+ assertThat (processor .getTargetField (), equalTo (DEFAULT_TARGET ));
121+ assertThat (processor .getSeed (), equalTo (toUint16 (0 )));
122+ assertThat (processor .getIgnoreMissing (), equalTo (true ));
123123 }
124124}
0 commit comments