-
Notifications
You must be signed in to change notification settings - Fork 979
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding maven version to the list of default Grok patterns (#130)
* Adding maven version to the list of default Grok patterns * Create maven file and put its regex in it * Add maven regex test
- Loading branch information
1 parent
07af464
commit d435f8e
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
MAVEN_VERSION (?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)(?:[.-](RELEASE|SNAPSHOT))? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# encoding: utf-8 | ||
require "spec_helper" | ||
require "logstash/patterns/core" | ||
|
||
describe "MAVEN_VERSION" do | ||
|
||
let(:pattern) { 'MAVEN_VERSION' } | ||
|
||
context "when maven version is simple" do | ||
let(:value) { '1.1.0' } | ||
|
||
it "should match the version" do | ||
expect(grok_match(pattern,value)).to pass | ||
end | ||
end | ||
|
||
context "when maven version is a bit more complex" do | ||
let(:value) { '2.35.128' } | ||
|
||
it "should match the version" do | ||
expect(grok_match(pattern,value)).to pass | ||
end | ||
end | ||
|
||
context "when maven version contains release" do | ||
let(:value) { '1.1.0.RELEASE' } | ||
|
||
it "should match the version" do | ||
expect(grok_match(pattern,value)).to pass | ||
end | ||
end | ||
|
||
context "when maven version contains shapshot" do | ||
let(:value) { '1.1.0.SNAPSHOT' } | ||
|
||
it "should match the version" do | ||
expect(grok_match(pattern,value)).to pass | ||
end | ||
end | ||
|
||
context "when maven version contains release" do | ||
context "and the version contains a dash" do | ||
let(:value) { '1.1.0-RELEASE' } | ||
|
||
it "should match the version" do | ||
expect(grok_match(pattern,value)).to pass | ||
end | ||
end | ||
end | ||
|
||
context "when maven version contains shapshot" do | ||
context "and the version contains a dash" do | ||
let(:value) { '1.1.0-SNAPSHOT' } | ||
|
||
it "should match the version" do | ||
expect(grok_match(pattern,value)).to pass | ||
end | ||
end | ||
end | ||
|
||
end |