Merge "Remove DMaaP Adapter"
diff --git a/auth-token-fetch/HTTPClient.go b/auth-token-fetch/HTTPClient.go
index a765461..5b0d167 100644
--- a/auth-token-fetch/HTTPClient.go
+++ b/auth-token-fetch/HTTPClient.go
@@ -21,24 +21,13 @@
 package main
 
 import (
-	"bytes"
 	"crypto/tls"
 	"crypto/x509"
-	"fmt"
-	"io"
 
 	"net/http"
-	"net/url"
 	"time"
 )
 
-// HTTPClient interface
-type HTTPClient interface {
-	Get(url string) (*http.Response, error)
-
-	Do(*http.Request) (*http.Response, error)
-}
-
 func CreateHttpClient(cert tls.Certificate, caCerts *x509.CertPool, timeout time.Duration) *http.Client {
 	return &http.Client{
 		Timeout:   timeout,
@@ -46,50 +35,6 @@
 	}
 }
 
-type RequestError struct {
-	StatusCode int
-	Body       []byte
-}
-
-func (pe RequestError) Error() string {
-	return fmt.Sprintf("Request failed due to error response with status: %v and body: %v", pe.StatusCode, string(pe.Body))
-}
-
-func Post(url string, body []byte, contentType string, client HTTPClient) error {
-	return do(http.MethodPost, url, body, contentType, client)
-}
-
-func do(method string, url string, body []byte, contentType string, client HTTPClient) error {
-	if req, reqErr := http.NewRequest(method, url, bytes.NewBuffer(body)); reqErr == nil {
-		req.Header.Set("Content-Type", contentType)
-		if response, respErr := client.Do(req); respErr == nil {
-			if isResponseSuccess(response.StatusCode) {
-				return nil
-			} else {
-				return getRequestError(response)
-			}
-		} else {
-			return respErr
-		}
-	} else {
-		return reqErr
-	}
-}
-
-func isResponseSuccess(statusCode int) bool {
-	return statusCode >= http.StatusOK && statusCode <= 299
-}
-
-func getRequestError(response *http.Response) RequestError {
-	defer response.Body.Close()
-	responseData, _ := io.ReadAll(response.Body)
-	putError := RequestError{
-		StatusCode: response.StatusCode,
-		Body:       responseData,
-	}
-	return putError
-}
-
 func createTransport(cert tls.Certificate, caCerts *x509.CertPool) *http.Transport {
 	return &http.Transport{
 		TLSClientConfig: &tls.Config{
@@ -102,8 +47,3 @@
 		},
 	}
 }
-
-func IsUrlSecure(configUrl string) bool {
-	u, _ := url.Parse(configUrl)
-	return u.Scheme == "https"
-}
diff --git a/auth-token-fetch/HTTPClient_test.go b/auth-token-fetch/HTTPClient_test.go
index 7b8deb0..f9d2fa3 100644
--- a/auth-token-fetch/HTTPClient_test.go
+++ b/auth-token-fetch/HTTPClient_test.go
@@ -23,7 +23,6 @@
 import (
 	"crypto/tls"
 
-	"net/http"
 	"reflect"
 	"testing"
 	"time"
@@ -31,15 +30,6 @@
 	"github.com/stretchr/testify/require"
 )
 
-func TestRequestError_Error(t *testing.T) {
-	assertions := require.New(t)
-	actualError := RequestError{
-		StatusCode: http.StatusBadRequest,
-		Body:       []byte("error"),
-	}
-	assertions.Equal("Request failed due to error response with status: 400 and body: error", actualError.Error())
-}
-
 func Test_CreateClient(t *testing.T) {
 	assertions := require.New(t)
 
@@ -49,11 +39,3 @@
 	assertions.Equal("*http.Transport", reflect.TypeOf(transport).String())
 	assertions.Equal(5*time.Second, client.Timeout)
 }
-
-func TestIsUrlSecured(t *testing.T) {
-	assertions := require.New(t)
-
-	assertions.True(IsUrlSecure("https://url"))
-
-	assertions.False(IsUrlSecure("http://url"))
-}
diff --git a/auth-token-fetch/config_test.go b/auth-token-fetch/config_test.go
index 92a63d8..0dd1d35 100644
--- a/auth-token-fetch/config_test.go
+++ b/auth-token-fetch/config_test.go
@@ -61,3 +61,38 @@
 
 	assertions.Equal(&wantConfig, got)
 }
+
+func TestNew_defaultValues(t *testing.T) {
+	assertions := require.New(t)
+
+	wantConfig := Config{
+		LogLevel:                log.InfoLevel,
+		CertPath:                "security/tls.crt",
+		KeyPath:                 "security/tls.key",
+		AuthServiceUrl:          "https://localhost:39687/example-singlelogin-sever/login",
+		GrantType:               "",
+		ClientSecret:            "",
+		ClientId:                "",
+		AuthTokenOutputFileName: "/tmp/authToken.txt",
+		CACertsPath:             "",
+		RefreshMarginSeconds:    5,
+	}
+	got := NewConfig()
+	assertions.Equal(nil, validateConfiguration(got))
+
+	assertions.Equal(&wantConfig, got)
+}
+
+func TestNew_invalidValues(t *testing.T) {
+	assertions := require.New(t)
+
+	os.Setenv("LOG_LEVEL", "Junk")
+	os.Setenv("REFRESH_MARGIN_SECONDS", "Junk")
+	t.Cleanup(func() {
+		os.Clearenv()
+	})
+
+	got := NewConfig()
+	assertions.Equal(log.InfoLevel, got.LogLevel)
+	assertions.Equal(5, got.RefreshMarginSeconds)
+}
diff --git a/onap/oran b/onap/oran
index 31639ac..1db30d5 160000
--- a/onap/oran
+++ b/onap/oran
@@ -1 +1 @@
-Subproject commit 31639ac11cc90c554b5303199c2da6fedc008d7b
+Subproject commit 1db30d5d54156fd373bc386030016a49aeee03b5