-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from odair-pedro/feature/refactory-sonarrestapi
Support to Sonar version 6.x, 7.x and 8.x
- Loading branch information
Showing
43 changed files
with
588 additions
and
235 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
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
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
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,35 @@ | ||
package cmd | ||
|
||
import "testing" | ||
|
||
func Test_padRight(t *testing.T) { | ||
type args struct { | ||
str string | ||
suffix string | ||
length int | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{"test-0", args{"test", "0", 10}, "test000000"}, | ||
{"test-01", args{"test", "01", 10}, "test010101"}, | ||
{"test-010", args{"test", "010", 10}, "test010010"}, | ||
{"test-01010101", args{"test", "01010101", 10}, "test010101"}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := padRight(tt.args.str, tt.args.suffix, tt.args.length); got != tt.want { | ||
t.Errorf("padRight() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func Test_NewSearchCmd_CheckReturn(t *testing.T) { | ||
cmd := NewSearchCmd() | ||
if cmd == nil { | ||
t.Errorf("NewSearchCmd() = nil") | ||
} | ||
} |
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
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,12 @@ | ||
package cmd | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_NewServerVersionCmd_CheckReturn(t *testing.T) { | ||
cmd := NewServerVersionCmd() | ||
if cmd == nil { | ||
t.Errorf("NewServerVersionCmd() = nil") | ||
} | ||
} |
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
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,12 @@ | ||
package cmd | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_NewValidateCmd_CheckReturn(t *testing.T) { | ||
cmd := NewValidateCmd() | ||
if cmd == nil { | ||
t.Errorf("NewValidateCmd() = nil") | ||
} | ||
} |
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,13 @@ | ||
package logging | ||
|
||
import ( | ||
"log" | ||
"testing" | ||
) | ||
|
||
func Test_Setup_CheckFlags(t *testing.T) { | ||
Setup() | ||
if log.Flags() != 0 { | ||
t.Error("Setup() not set flas to 0") | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package net | ||
|
||
type Connection interface { | ||
GetHostServer() string | ||
DoGet(route string) (<-chan []byte, <-chan error) | ||
} |
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,11 @@ | ||
package factory | ||
|
||
import ( | ||
"sonarci/net" | ||
"sonarci/net/http" | ||
"time" | ||
) | ||
|
||
func CreateConnection(server string, token string, timeout time.Duration) net.Connection { | ||
return http.NewConnection(server, token, timeout) | ||
} |
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,18 @@ | ||
package factory | ||
|
||
import ( | ||
"sonarci/net/http" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func Test_CreateConnection_CheckReturn(t *testing.T) { | ||
api := CreateConnection("server", "token", time.Second) | ||
|
||
switch tp := api.(type) { | ||
case *http.Connection: | ||
return | ||
default: | ||
t.Errorf("Invalid returned type: %T", tp) | ||
} | ||
} |
Oops, something went wrong.