Skip to content

Commit

Permalink
Adding maven version to the list of default Grok patterns (#130)
Browse files Browse the repository at this point in the history
* 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
carlphilipp authored and jsvd committed Sep 16, 2016
1 parent 07af464 commit d435f8e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions patterns/maven
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAVEN_VERSION (?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)(?:[.-](RELEASE|SNAPSHOT))?
61 changes: 61 additions & 0 deletions spec/patterns/maven_spec.rb
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

0 comments on commit d435f8e

Please sign in to comment.