fmt
This commit is contained in:
@@ -9,24 +9,20 @@ import (
|
||||
)
|
||||
|
||||
type ApiKeyService struct {
|
||||
|
||||
}
|
||||
|
||||
type ApiKey struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Apikey string `json:"apiKey,omitempty"`
|
||||
CreateDAte timestamp.Timestamp`json:"createDate,omitempty"`
|
||||
HostName string `json:"hostName,omitempty"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Apikey string `json:"apiKey,omitempty"`
|
||||
CreateDAte timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
HostName string `json:"hostName,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
func NewApiKeyService() *ApiKeyService {
|
||||
return &ApiKeyService{}
|
||||
}
|
||||
|
||||
|
||||
func(k *ApiKeyService)SaveApikey(key *ApiKey) (string, error) {
|
||||
|
||||
func (k *ApiKeyService) SaveApikey(key *ApiKey) (string, error) {
|
||||
|
||||
//bytes, err := json.Marshal(key)
|
||||
//
|
||||
@@ -52,10 +48,10 @@ func(k *ApiKeyService)SaveApikey(key *ApiKey) (string, error) {
|
||||
|
||||
}
|
||||
|
||||
func(k *ApiKeyService)CheckApikey(apikey string) (bool, error) {
|
||||
func (k *ApiKeyService) CheckApikey(apikey string) (bool, error) {
|
||||
|
||||
ak := ApiKey{
|
||||
Apikey:apikey,
|
||||
Apikey: apikey,
|
||||
}
|
||||
|
||||
//bytes, err := json.Marshal(ak)
|
||||
@@ -80,5 +76,4 @@ func(k *ApiKeyService)CheckApikey(apikey string) (bool, error) {
|
||||
|
||||
return true, nil
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
package apikey
|
||||
|
||||
|
||||
|
||||
@@ -1,35 +1,32 @@
|
||||
package discovery
|
||||
|
||||
import (
|
||||
"git.loafle.net/overflow/overflow_service/proxy/probe"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
"encoding/json"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/probe"
|
||||
)
|
||||
|
||||
type Discovery struct {
|
||||
StartIp int64 `json:"startIp,omitempty"`
|
||||
EndIp int64 `json:"endIp,omitempty"`
|
||||
StartPort int `json:"startPort,omitempty"`
|
||||
EndPort int `json:"endPort,omitempty"`
|
||||
ExcludeIp []int64 `json:"excludeIp,omitempty"`
|
||||
Probe *probe.Probe `json:"probe,omitempty"`
|
||||
StartIp int64 `json:"startIp,omitempty"`
|
||||
EndIp int64 `json:"endIp,omitempty"`
|
||||
StartPort int `json:"startPort,omitempty"`
|
||||
EndPort int `json:"endPort,omitempty"`
|
||||
ExcludeIp []int64 `json:"excludeIp,omitempty"`
|
||||
Probe *probe.Probe `json:"probe,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
type DiscoveryService struct {
|
||||
|
||||
}
|
||||
|
||||
func NewDiscoveryService() *DiscoveryService {
|
||||
return &DiscoveryService{}
|
||||
}
|
||||
|
||||
|
||||
func (dis *DiscoveryService)Discovery(d *Discovery) (string, error) {
|
||||
func (dis *DiscoveryService) Discovery(d *Discovery) (string, error) {
|
||||
|
||||
pts := probe.NewProbeTaskService()
|
||||
|
||||
bytes,err := json.Marshal(d)
|
||||
bytes, err := json.Marshal(d)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -44,4 +41,4 @@ func (dis *DiscoveryService)Discovery(d *Discovery) (string, error) {
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package discovery
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/probe"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDiscovery(t *testing.T) {
|
||||
@@ -29,5 +29,4 @@ func TestDiscovery(t *testing.T) {
|
||||
|
||||
t.Log(out)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,27 +7,24 @@ import (
|
||||
)
|
||||
|
||||
type Domain struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
type DomainService struct {
|
||||
|
||||
}
|
||||
|
||||
func NewDomainService() *DomainService {
|
||||
return &DomainService{}
|
||||
}
|
||||
|
||||
func (d *DomainService) Create(dm *Domain) (string, error) {
|
||||
|
||||
func (d *DomainService)Create(dm *Domain) (string, error) {
|
||||
|
||||
str,err :=utils.InvokeDBByModel("domain", "save", dm, "com.loafle.overflow.module.domain.model.Domain")
|
||||
str, err := utils.InvokeDBByModel("domain", "save", dm, "com.loafle.overflow.module.domain.model.Domain")
|
||||
|
||||
if err != nil {
|
||||
return "",err
|
||||
return "", err
|
||||
}
|
||||
|
||||
return str, nil
|
||||
|
||||
@@ -8,12 +8,11 @@ func TestSave(t *testing.T) {
|
||||
|
||||
d.Name = "snoop's domain"
|
||||
|
||||
str, err := NewDomainService().Create(&d)
|
||||
|
||||
str,err := NewDomainService().Create(&d)
|
||||
|
||||
if err != nil{
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Log(str)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
"git.loafle.net/overflow/commons_go/model/timestamp"
|
||||
"git.loafle.net/overflow/overflow_service/proxy"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/member"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/utils"
|
||||
"github.com/google/uuid"
|
||||
"log"
|
||||
"net"
|
||||
"net/mail"
|
||||
"net/smtp"
|
||||
"strings"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -148,7 +148,7 @@ func (es *EmailService) SendEmailForAuth(e *Email) error {
|
||||
|
||||
func (es *EmailService) saveEmail(e *Email) {
|
||||
|
||||
rr, err := utils.InvokeDBByModel("emailAuth","save", e, utils.MODEL_EMAIL_AUTH)
|
||||
rr, err := utils.InvokeDBByModel("emailAuth", "save", e, utils.MODEL_EMAIL_AUTH)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -162,13 +162,12 @@ func (es *EmailService) CheckAuthURL(e *Email) bool {
|
||||
|
||||
//Query from the database with an authentication token.
|
||||
|
||||
re, err := utils.InvokeDBByModel("emailAuth","findByEmailAuthKey", e.EmailAuthKey, utils.MODEL_STRING)
|
||||
re, err := utils.InvokeDBByModel("emailAuth", "findByEmailAuthKey", e.EmailAuthKey, utils.MODEL_STRING)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
|
||||
tempEmail := &Email{}
|
||||
json.Unmarshal([]byte(re), tempEmail)
|
||||
|
||||
@@ -190,7 +189,7 @@ func (es *EmailService) CheckAuthURL(e *Email) bool {
|
||||
func (es *EmailService) modifyEmailAuth(e *Email) {
|
||||
|
||||
proxy.InvokeDB("emailAuth", "update", emMap)
|
||||
re, err := utils.InvokeDBByModel("emailAuth","save", e, utils.MODEL_EMAIL_AUTH)
|
||||
re, err := utils.InvokeDBByModel("emailAuth", "save", e, utils.MODEL_EMAIL_AUTH)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
package email
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/member"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func getEmailObj() (*Email,*EmailService) {
|
||||
func getEmailObj() (*Email, *EmailService) {
|
||||
es := NewEmailService()
|
||||
m := member.Member{
|
||||
Email:"geek@loafle.com",
|
||||
Name:"geek",
|
||||
CompanyName:"loafle",
|
||||
Id:json.Number("2"),
|
||||
Email: "geek@loafle.com",
|
||||
Name: "geek",
|
||||
CompanyName: "loafle",
|
||||
Id: json.Number("2"),
|
||||
}
|
||||
e := NewEmail(m, "Hello Oveflow")
|
||||
|
||||
return e,es
|
||||
return e, es
|
||||
}
|
||||
func TestSendEmailForAuth(t *testing.T) {
|
||||
e, es := getEmailObj()
|
||||
@@ -35,7 +35,7 @@ func TestEmailService_CheckAuthURL(t *testing.T) {
|
||||
|
||||
fmt.Println(rr)
|
||||
}
|
||||
func TestAuthTokenGeneration(t *testing.T) {
|
||||
func TestAuthTokenGeneration(t *testing.T) {
|
||||
|
||||
e, es := getEmailObj()
|
||||
tt := es.generationAuthToken(e)
|
||||
|
||||
@@ -6,15 +6,13 @@ import (
|
||||
)
|
||||
|
||||
type KeyStoreService struct {
|
||||
|
||||
}
|
||||
|
||||
|
||||
func NewKeyStoreSerivce() *KeyStoreService {
|
||||
return &KeyStoreService{}
|
||||
}
|
||||
|
||||
func(k *KeyStoreService)CreateKey() (string,error) {
|
||||
func (k *KeyStoreService) CreateKey() (string, error) {
|
||||
uu, err := uuid.NewUUID()
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -2,17 +2,13 @@ package keystore
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
)
|
||||
|
||||
func TestGetKey(t *testing.T) {
|
||||
|
||||
|
||||
str, _:= NewKeyStoreSerivce().CreateKey()
|
||||
|
||||
str, _ := NewKeyStoreSerivce().CreateKey()
|
||||
|
||||
t.Log(str)
|
||||
t.Log(len(str))
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,19 +6,19 @@ import (
|
||||
"git.loafle.net/overflow/encryption_go"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/apikey"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/keystore"
|
||||
"log"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/utils"
|
||||
"log"
|
||||
)
|
||||
|
||||
type Member struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Email string `json:"email"`
|
||||
PwSalt string `json:"pwSalt"`
|
||||
Pw string `json:"pw"`
|
||||
Name string `json:"name"`
|
||||
CompanyName string `json:"companyName"`
|
||||
Phone string `json:"phone"`
|
||||
Status *MetaMemberStatus `json:"status"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Email string `json:"email"`
|
||||
PwSalt string `json:"pwSalt"`
|
||||
Pw string `json:"pw"`
|
||||
Name string `json:"name"`
|
||||
CompanyName string `json:"companyName"`
|
||||
Phone string `json:"phone"`
|
||||
Status *MetaMemberStatus `json:"status"`
|
||||
}
|
||||
|
||||
type MetaMemberStatus struct {
|
||||
@@ -87,7 +87,7 @@ func (m *MemberService) Regist(mem *Member) (string, error) {
|
||||
func (m *MemberService) ReadByEmail(mem *Member) (string, error) {
|
||||
log.Println("Call ReadByEmail", mem.Email)
|
||||
|
||||
re, err := utils.InvokeDBByModel(TARGET_DAO, "findByEmail",mem, utils.MODEL_MEMBER)
|
||||
re, err := utils.InvokeDBByModel(TARGET_DAO, "findByEmail", mem, utils.MODEL_MEMBER)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -98,7 +98,7 @@ func (m *MemberService) ReadByEmail(mem *Member) (string, error) {
|
||||
|
||||
func (m *MemberService) Read(mem *Member) (string, error) {
|
||||
|
||||
re, err := utils.InvokeDBByModel("member","findOne",mem.Id,"java.lang.Long")
|
||||
re, err := utils.InvokeDBByModel("member", "findOne", mem.Id, "java.lang.Long")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -113,7 +113,7 @@ func (m *MemberService) Modify(mem *Member) (string, error) {
|
||||
log.Fatal("Id nil")
|
||||
}
|
||||
|
||||
re, err := utils.InvokeDBByModel("member","findOne",mem,utils.MODEL_MEMBER)
|
||||
re, err := utils.InvokeDBByModel("member", "findOne", mem, utils.MODEL_MEMBER)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -124,7 +124,7 @@ func (m *MemberService) Modify(mem *Member) (string, error) {
|
||||
|
||||
func (m *MemberService) Remove(mem *Member) (string, error) {
|
||||
|
||||
re, err := utils.InvokeDBByModel("member","delete",mem.Id,"java.lang.Long")
|
||||
re, err := utils.InvokeDBByModel("member", "delete", mem.Id, "java.lang.Long")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package member
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"encoding/json"
|
||||
"github.com/golang/glog"
|
||||
"fmt"
|
||||
"github.com/golang/glog"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMemberService_Login(t *testing.T) {
|
||||
@@ -25,13 +25,13 @@ func TestMemberService_Regist(t *testing.T) {
|
||||
ms := NewMemberService()
|
||||
|
||||
m := &Member{
|
||||
Email:"geek2@loafle.com",
|
||||
PwSalt:"qwer5795",
|
||||
Pw:"qwer5795",
|
||||
CompanyName:"Loafle",
|
||||
Name:"Geek",
|
||||
Phone:"010-4055-6699",
|
||||
Status:&MetaMemberStatus{Id:"1"},
|
||||
Email: "geek2@loafle.com",
|
||||
PwSalt: "qwer5795",
|
||||
Pw: "qwer5795",
|
||||
CompanyName: "Loafle",
|
||||
Name: "Geek",
|
||||
Phone: "010-4055-6699",
|
||||
Status: &MetaMemberStatus{Id: "1"},
|
||||
}
|
||||
retMem, _ := ms.Regist(m)
|
||||
t.Log(retMem)
|
||||
@@ -46,8 +46,8 @@ func TestMemberLogin(t *testing.T) {
|
||||
//}
|
||||
ms := NewMemberService()
|
||||
m := &Member{
|
||||
Email:"geek@loafle.com",
|
||||
PwSalt:"qwer5795",
|
||||
Email: "geek@loafle.com",
|
||||
PwSalt: "qwer5795",
|
||||
}
|
||||
|
||||
b, _ := ms.Login(m)
|
||||
@@ -56,7 +56,7 @@ func TestMemberLogin(t *testing.T) {
|
||||
|
||||
func TestMemberService_Read(t *testing.T) {
|
||||
mm := &Member{
|
||||
Id:"1",
|
||||
Id: "1",
|
||||
}
|
||||
|
||||
ms := NewMemberService()
|
||||
@@ -69,10 +69,10 @@ func TestMemberService_Read(t *testing.T) {
|
||||
t.Log(rr)
|
||||
}
|
||||
|
||||
func TestMemberService_ReadByEmail(t *testing.T) {
|
||||
func TestMemberService_ReadByEmail(t *testing.T) {
|
||||
ms := NewMemberService()
|
||||
m := &Member{
|
||||
Email:"overflow@loafle.com",
|
||||
Email: "overflow@loafle.com",
|
||||
}
|
||||
|
||||
rr, err := ms.ReadByEmail(m)
|
||||
@@ -87,7 +87,7 @@ func TestMemberUpdate(t *testing.T) {
|
||||
|
||||
ms := NewMemberService()
|
||||
m := &Member{
|
||||
Id:"1",
|
||||
Id: "1",
|
||||
}
|
||||
rm, _ := ms.Read(m)
|
||||
|
||||
@@ -125,4 +125,4 @@ func TestComvertJson(t *testing.T) {
|
||||
// glog.Fatal("Json Unmarshal Failed : ", err.Error())
|
||||
//}
|
||||
//fmt.Println(mem.(*Member).Email)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
NOAUTH_PROBE_STATUS_ACCEPT = 1
|
||||
NOAUTH_PROBE_STATUS_DENY = 2
|
||||
NOAUTH_PROBE_STATUS_ACCEPT = 1
|
||||
NOAUTH_PROBE_STATUS_DENY = 2
|
||||
NOAUTH_PROBE_STATUS_PROCESS = 3
|
||||
)
|
||||
|
||||
@@ -18,8 +18,8 @@ var metaNoauthProbeStatusMap = map[int]string{
|
||||
}
|
||||
|
||||
type MetaNoAuthProbeStatus struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func NewMetaNoAuthProbeStatus(types int) *MetaNoAuthProbeStatus {
|
||||
@@ -31,7 +31,7 @@ func NewMetaNoAuthProbeStatus(types int) *MetaNoAuthProbeStatus {
|
||||
}
|
||||
|
||||
return &MetaNoAuthProbeStatus{
|
||||
Id:json.Number(strconv.Itoa(types)),
|
||||
Name:str,
|
||||
Id: json.Number(strconv.Itoa(types)),
|
||||
Name: str,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,16 +7,17 @@ import (
|
||||
|
||||
const (
|
||||
PROBE_STATUS_INITIAL = 1
|
||||
PROBE_STATUS_NORMAL = 2
|
||||
PROBE_STATUS_NORMAL = 2
|
||||
)
|
||||
|
||||
var metaProbeStatusMap = map[int]string{
|
||||
1: "INITIAL",
|
||||
2: "NORMAL",
|
||||
}
|
||||
|
||||
type MetaProbeStatus struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func NewMetaProbeStatus(types int) *MetaProbeStatus {
|
||||
@@ -27,8 +28,7 @@ func NewMetaProbeStatus(types int) *MetaProbeStatus {
|
||||
return nil
|
||||
}
|
||||
return &MetaProbeStatus{
|
||||
Id:json.Number(strconv.Itoa(types)),
|
||||
Name:str,
|
||||
Id: json.Number(strconv.Itoa(types)),
|
||||
Name: str,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,21 +6,19 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
||||
const (
|
||||
PROBE_TASK_TYPE_DISOCVERY = 1
|
||||
|
||||
)
|
||||
|
||||
var metaProbeTaskTypeMap = map[int]string{
|
||||
1: "DISOCVERY",
|
||||
}
|
||||
|
||||
|
||||
type MetaProbeTaskType struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
}
|
||||
|
||||
func NewMetaProbeTaskType(types int) *MetaProbeTaskType {
|
||||
@@ -31,7 +29,7 @@ func NewMetaProbeTaskType(types int) *MetaProbeTaskType {
|
||||
return nil
|
||||
}
|
||||
return &MetaProbeTaskType{
|
||||
Id:json.Number(strconv.Itoa(types)),
|
||||
Name:str,
|
||||
Id: json.Number(strconv.Itoa(types)),
|
||||
Name: str,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package noauthprobe
|
||||
|
||||
import (
|
||||
|
||||
"git.loafle.net/overflow/commons_go/model/timestamp"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
"git.loafle.net/overflow/overflow_service/proxy/probe"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/domain"
|
||||
"errors"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/utils"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/domain"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/probe"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/utils"
|
||||
)
|
||||
|
||||
type NoAuthProbeService struct {
|
||||
@@ -20,42 +19,38 @@ func NewNoAuthProbeService() *NoAuthProbeService {
|
||||
return &NoAuthProbeService{}
|
||||
}
|
||||
|
||||
|
||||
type NoAuthProbe struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
|
||||
HostName string `json:"hostName,omitempty"`
|
||||
MacAddress int64 `json:"macAddress,omitempty"`
|
||||
IpAddress int64 `json:"ipAddress,omitempty"`
|
||||
HostName string `json:"hostName,omitempty"`
|
||||
MacAddress int64 `json:"macAddress,omitempty"`
|
||||
IpAddress int64 `json:"ipAddress,omitempty"`
|
||||
|
||||
// P rocess, A ccept, D eny
|
||||
Status *meta.MetaNoAuthProbeStatus `json:"status,omitempty"`
|
||||
Status *meta.MetaNoAuthProbeStatus `json:"status,omitempty"`
|
||||
|
||||
TempProbeKey string `json:"tempProbeKey,omitempty"`
|
||||
|
||||
CreateDate timestamp.Timestamp`json:"createDate,omitempty"`
|
||||
ApiKey string `json:"apiKey,omitempty"`
|
||||
Domain *domain.Domain `json:"domain,omitempty"`
|
||||
Probe *probe.Probe `json:"probe,omitempty"`
|
||||
TempProbeKey string `json:"tempProbeKey,omitempty"`
|
||||
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
ApiKey string `json:"apiKey,omitempty"`
|
||||
Domain *domain.Domain `json:"domain,omitempty"`
|
||||
Probe *probe.Probe `json:"probe,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
func NewNoAuthProbe(apikey string, ipAddress int64, hostName string, md int64) *NoAuthProbe {
|
||||
|
||||
na := &NoAuthProbe{
|
||||
CreateDate:timestamp.Now(),
|
||||
ApiKey:apikey,
|
||||
IpAddress:ipAddress,
|
||||
HostName:hostName,
|
||||
MacAddress:md,
|
||||
Status:meta.NewMetaNoAuthProbeStatus(meta.NOAUTH_PROBE_STATUS_PROCESS),
|
||||
CreateDate: timestamp.Now(),
|
||||
ApiKey: apikey,
|
||||
IpAddress: ipAddress,
|
||||
HostName: hostName,
|
||||
MacAddress: md,
|
||||
Status: meta.NewMetaNoAuthProbeStatus(meta.NOAUTH_PROBE_STATUS_PROCESS),
|
||||
}
|
||||
return na
|
||||
}
|
||||
|
||||
|
||||
func(as *NoAuthProbeService)Regist(na *NoAuthProbe) (string, error) {
|
||||
func (as *NoAuthProbeService) Regist(na *NoAuthProbe) (string, error) {
|
||||
|
||||
out, err := utils.InvokeDBByModel("noauthProbe", "save", na, utils.MODEL_NOAUTHPROBE)
|
||||
|
||||
@@ -63,10 +58,10 @@ func(as *NoAuthProbeService)Regist(na *NoAuthProbe) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil;
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func(as *NoAuthProbeService)CheckAuth(tempKey string) (string,error) {
|
||||
func (as *NoAuthProbeService) CheckAuth(tempKey string) (string, error) {
|
||||
|
||||
//memMap := make(map[string]string)
|
||||
//
|
||||
@@ -82,7 +77,7 @@ func(as *NoAuthProbeService)CheckAuth(tempKey string) (string,error) {
|
||||
//
|
||||
//out, err := proxy.InvokeDB("noauthProbe", "findByTempKey", memMap);
|
||||
|
||||
out, err:= utils.InvokeDBByModel("noauthProbe","findByTempProbeKey",tempKey, utils.MODEL_STRING)
|
||||
out, err := utils.InvokeDBByModel("noauthProbe", "findByTempProbeKey", tempKey, utils.MODEL_STRING)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -95,24 +90,21 @@ func(as *NoAuthProbeService)CheckAuth(tempKey string) (string,error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out,nil;
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (as *NoAuthProbeService) ReadAllByDomain(d *domain.Domain) (string, error) {
|
||||
|
||||
func(as *NoAuthProbeService)ReadAllByDomain(d *domain.Domain) (string,error) {
|
||||
|
||||
out, err := utils.InvokeDBByModel("noauthProbe","findAllByDomain", d, utils.MODEL_DOMAIN);
|
||||
out, err := utils.InvokeDBByModel("noauthProbe", "findAllByDomain", d, utils.MODEL_DOMAIN)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out,nil;
|
||||
return out, nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
func (as *NoAuthProbeService)RequestAuth(np *NoAuthProbe, domainId int, desc string) (string, error) {
|
||||
func (as *NoAuthProbeService) RequestAuth(np *NoAuthProbe, domainId int, desc string) (string, error) {
|
||||
//paramMap := make(map[string]string)
|
||||
//noauthAgt.Status = "A"
|
||||
//
|
||||
@@ -123,7 +115,7 @@ func (as *NoAuthProbeService)RequestAuth(np *NoAuthProbe, domainId int, desc str
|
||||
//paramMap["com.loafle.overflow.noauthprobe.model.NoAuthProbe"] = string(bytes)
|
||||
//out, err := proxy.InvokeDB("noauthProbe", "update", paramMap)
|
||||
|
||||
out ,err := utils.InvokeDBByModel("noauthProbe","findByTempProbeKey", np.TempProbeKey, utils.MODEL_STRING);
|
||||
out, err := utils.InvokeDBByModel("noauthProbe", "findByTempProbeKey", np.TempProbeKey, utils.MODEL_STRING)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -133,12 +125,12 @@ func (as *NoAuthProbeService)RequestAuth(np *NoAuthProbe, domainId int, desc str
|
||||
}
|
||||
dbnp := NoAuthProbe{}
|
||||
|
||||
err = json.Unmarshal([]byte(out), &dbnp);
|
||||
err = json.Unmarshal([]byte(out), &dbnp)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
dbnp.Status = np.Status;
|
||||
dbnp.Status = np.Status
|
||||
|
||||
//FIXME:: probe
|
||||
|
||||
@@ -146,23 +138,23 @@ func (as *NoAuthProbeService)RequestAuth(np *NoAuthProbe, domainId int, desc str
|
||||
d.Id = json.Number(domainId)
|
||||
newAgent := probe.NewProbe("", "")
|
||||
newone, err := probe.NewProbeService().Regist(newAgent)
|
||||
if err!= nil {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return newone, nil
|
||||
}
|
||||
|
||||
func (as *NoAuthProbeService)Read(id string) (string, error){
|
||||
func (as *NoAuthProbeService) Read(id string) (string, error) {
|
||||
//mm := make(map[string]string)
|
||||
//mm["id"] = id
|
||||
//out, err := proxy.InvokeDB("noauthProbe", "findOne", id, "java.lang.Long")
|
||||
|
||||
out,err :=utils.InvokeDBByModel("noauthProbe","findOne",id,utils.MODEL_LONG)
|
||||
out, err := utils.InvokeDBByModel("noauthProbe", "findOne", id, utils.MODEL_LONG)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package noauthprobe
|
||||
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"testing"
|
||||
@@ -10,7 +9,6 @@ import (
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
)
|
||||
|
||||
|
||||
func TestCreateUUid(t *testing.T) {
|
||||
|
||||
uu, err := uuid.NewUUID()
|
||||
@@ -22,12 +20,12 @@ func TestCreateUUid(t *testing.T) {
|
||||
t.Log(uu)
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
func TestCreateNoAuthAgent(t *testing.T) {
|
||||
|
||||
na := NewNoAuthProbe("52abd6fd57e511e7ac52080027658d13", 3232235521, "Snoop2222", 8796753988883)
|
||||
|
||||
|
||||
ns := &meta.MetaNoAuthProbeStatus{}
|
||||
ns.Id = "3"
|
||||
na.Status = ns
|
||||
@@ -49,6 +47,7 @@ func TestCreateNoAuthAgent(t *testing.T) {
|
||||
t.Log(out)
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
//func TestCheckAuthNoAuthAgent(t *testing.T) {
|
||||
//
|
||||
@@ -69,10 +68,8 @@ func TestCreateNoAuthAgent(t *testing.T) {
|
||||
// //
|
||||
//}
|
||||
|
||||
|
||||
func TestNoAuthList(t *testing.T) {
|
||||
|
||||
|
||||
nas := NewNoAuthProbeService()
|
||||
|
||||
d := domain.Domain{}
|
||||
@@ -87,6 +84,7 @@ func TestNoAuthList(t *testing.T) {
|
||||
t.Log(out)
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
//func TestRequestAuth(t *testing.T) {
|
||||
// nas := NewNoAuthProbeService()
|
||||
@@ -102,10 +100,8 @@ func TestNoAuthList(t *testing.T) {
|
||||
// t.Log(newone)
|
||||
//}
|
||||
|
||||
|
||||
func TestCheckAuth(t *testing.T) {
|
||||
|
||||
|
||||
ns := NewNoAuthProbeService()
|
||||
|
||||
str, err := ns.CheckAuth("3398473-90847903874")
|
||||
@@ -117,7 +113,6 @@ func TestCheckAuth(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
func TestRead(t *testing.T) {
|
||||
|
||||
out, err := NewNoAuthProbeService().Read("1")
|
||||
|
||||
@@ -7,26 +7,25 @@ import (
|
||||
|
||||
"git.loafle.net/overflow/overflow_service/proxy/utils"
|
||||
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
"git.loafle.net/overflow/commons_go/model/timestamp"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/domain"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
)
|
||||
|
||||
type ProbeService struct {
|
||||
}
|
||||
|
||||
type Probe struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Status *meta.MetaProbeStatus `json:"status,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
LastPollingDate timestamp.Timestamp `json:"lastPollingDate,omitempty"`
|
||||
NextPollingDate timestamp.Timestamp `json:"nextPollingDate,omitempty"`
|
||||
Domain *domain.Domain `json:"domain,omitempty"`
|
||||
ProbeKey string `json:"probeKey,omitempty"`
|
||||
EncryptionKey string `json:"encryptionKey,omitempty"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
Status *meta.MetaProbeStatus `json:"status,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
LastPollingDate timestamp.Timestamp `json:"lastPollingDate,omitempty"`
|
||||
NextPollingDate timestamp.Timestamp `json:"nextPollingDate,omitempty"`
|
||||
Domain *domain.Domain `json:"domain,omitempty"`
|
||||
ProbeKey string `json:"probeKey,omitempty"`
|
||||
EncryptionKey string `json:"encryptionKey,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
func NewProbeService() *ProbeService {
|
||||
return &ProbeService{}
|
||||
}
|
||||
@@ -34,10 +33,9 @@ func NewProbeService() *ProbeService {
|
||||
func NewProbe(probeKey string, encryptionKey string) *Probe {
|
||||
|
||||
na := &Probe{
|
||||
Status:meta.NewMetaProbeStatus(meta.PROBE_STATUS_INITIAL),
|
||||
ProbeKey:probeKey,
|
||||
EncryptionKey:encryptionKey,
|
||||
|
||||
Status: meta.NewMetaProbeStatus(meta.PROBE_STATUS_INITIAL),
|
||||
ProbeKey: probeKey,
|
||||
EncryptionKey: encryptionKey,
|
||||
}
|
||||
return na
|
||||
}
|
||||
@@ -73,4 +71,4 @@ func (as *ProbeService) ReadByProbeKey(probeKey string) (string, error) {
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package probe
|
||||
|
||||
import (
|
||||
|
||||
"testing"
|
||||
|
||||
"git.loafle.net/overflow/overflow_service/proxy/keystore"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/domain"
|
||||
|
||||
|
||||
"git.loafle.net/overflow/overflow_service/proxy/keystore"
|
||||
)
|
||||
|
||||
func TestSaveProbe(t *testing.T) {
|
||||
@@ -17,7 +14,7 @@ func TestSaveProbe(t *testing.T) {
|
||||
enks, _ := ks.CreateKey()
|
||||
|
||||
ppp := NewProbe(pks, enks)
|
||||
ppp.Domain = &domain.Domain{Id:"1"}
|
||||
ppp.Domain = &domain.Domain{Id: "1"}
|
||||
as := NewProbeService()
|
||||
|
||||
res, err := as.Regist(ppp)
|
||||
@@ -30,12 +27,11 @@ func TestSaveProbe(t *testing.T) {
|
||||
func TestListProbe(t *testing.T) {
|
||||
as := NewProbeService()
|
||||
|
||||
d := &domain.Domain{Id:"1"}
|
||||
|
||||
d := &domain.Domain{Id: "1"}
|
||||
|
||||
if res, err := as.ReadAllByDomain(d); err != nil {
|
||||
t.Fatal(err)
|
||||
}else {
|
||||
} else {
|
||||
t.Log(res)
|
||||
}
|
||||
|
||||
@@ -55,7 +51,6 @@ func TestReadProbeKey(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
func TestDDDD(t *testing.T) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,44 +2,43 @@ package probe
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
"git.loafle.net/overflow/commons_go/model/timestamp"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/utils"
|
||||
)
|
||||
|
||||
type ProbeTask struct {
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
MetaProbeTaskType *meta.MetaProbeTaskType `json:"metaProbeTaskType,omitempty"`
|
||||
Probe *Probe `json:"probe,omitempty"`
|
||||
Data string `json:"data,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
SendDate timestamp.Timestamp `json:"sendDate,omitempty"`
|
||||
StartDate timestamp.Timestamp `json:"startDate,omitempty"`
|
||||
EndDate timestamp.Timestamp `json:"startDate,omitempty"`
|
||||
Succeed bool `json:"succeed,omitempty"`
|
||||
Id json.Number `json:"id,Number,omitempty"`
|
||||
MetaProbeTaskType *meta.MetaProbeTaskType `json:"metaProbeTaskType,omitempty"`
|
||||
Probe *Probe `json:"probe,omitempty"`
|
||||
Data string `json:"data,omitempty"`
|
||||
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
|
||||
SendDate timestamp.Timestamp `json:"sendDate,omitempty"`
|
||||
StartDate timestamp.Timestamp `json:"startDate,omitempty"`
|
||||
EndDate timestamp.Timestamp `json:"startDate,omitempty"`
|
||||
Succeed bool `json:"succeed,omitempty"`
|
||||
}
|
||||
|
||||
func NewProbeTask(types *meta.MetaProbeTaskType, data string, p *Probe) *ProbeTask {
|
||||
|
||||
return &ProbeTask{
|
||||
MetaProbeTaskType:types,
|
||||
Data:data,
|
||||
Probe:p,
|
||||
MetaProbeTaskType: types,
|
||||
Data: data,
|
||||
Probe: p,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type ProbeTaskService struct {
|
||||
|
||||
}
|
||||
|
||||
func NewProbeTaskService() *ProbeTaskService{
|
||||
func NewProbeTaskService() *ProbeTaskService {
|
||||
return &ProbeTaskService{}
|
||||
}
|
||||
|
||||
func(pts* ProbeTaskService)Regist(pt *ProbeTask) (string, error) {
|
||||
func (pts *ProbeTaskService) Regist(pt *ProbeTask) (string, error) {
|
||||
|
||||
out, err := utils.InvokeDBByModel("probeTask","save", pt, utils.MODEL_PROBE_TASK)
|
||||
out, err := utils.InvokeDBByModel("probeTask", "save", pt, utils.MODEL_PROBE_TASK)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -48,9 +47,9 @@ func(pts* ProbeTaskService)Regist(pt *ProbeTask) (string, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func(pts* ProbeTaskService)ReadAllByProbe(p *Probe) (string, error) {
|
||||
func (pts *ProbeTaskService) ReadAllByProbe(p *Probe) (string, error) {
|
||||
|
||||
out, err := utils.InvokeDBByModel("probeTask","findAllByProbe", p, utils.MODEL_PROBE)
|
||||
out, err := utils.InvokeDBByModel("probeTask", "findAllByProbe", p, utils.MODEL_PROBE)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package probe
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/meta"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
@@ -17,14 +17,13 @@ func TestCreate(t *testing.T) {
|
||||
|
||||
out, err := pts.Regist(pt)
|
||||
|
||||
if err != nil{
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Log(out)
|
||||
}
|
||||
|
||||
|
||||
func TestListByProbe(t *testing.T) {
|
||||
|
||||
p := &Probe{}
|
||||
@@ -40,6 +39,4 @@ func TestListByProbe(t *testing.T) {
|
||||
|
||||
t.Log(out)
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ func (sims *SensorItemMappingService) CreateAll(siml *[]*SensorItemMapping) (str
|
||||
|
||||
outlist := make([]string, 0)
|
||||
for _, sim := range *siml {
|
||||
out,err := sims.Create(sim)
|
||||
out, err := sims.Create(sim)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
outlist = append(outlist, out)
|
||||
}
|
||||
|
||||
bytes,err := json.Marshal(outlist)
|
||||
bytes, err := json.Marshal(outlist)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
@@ -2,11 +2,11 @@ package sensorItemMapping
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/sensor"
|
||||
"testing"
|
||||
"fmt"
|
||||
"sync"
|
||||
"git.loafle.net/overflow/overflow_service/proxy/sensor"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSensorItemMappingService_List(t *testing.T) {
|
||||
@@ -19,7 +19,6 @@ func TestSensorItemMappingService_List(t *testing.T) {
|
||||
t.Log(res)
|
||||
}
|
||||
|
||||
|
||||
func TestSensorItemMappingService_List_GoRutine(t *testing.T) {
|
||||
//s := &sensor.Sensor{}
|
||||
//s.Id = json.Number("14")
|
||||
@@ -36,7 +35,6 @@ func TestSensorItemMappingService_List_GoRutine(t *testing.T) {
|
||||
|
||||
for _, ii := range il {
|
||||
|
||||
|
||||
go func(i int) {
|
||||
s := &sensor.Sensor{}
|
||||
s.Id = json.Number(strconv.Itoa(ii))
|
||||
@@ -44,14 +42,12 @@ func TestSensorItemMappingService_List_GoRutine(t *testing.T) {
|
||||
fmt.Print(res)
|
||||
}(ii)
|
||||
|
||||
|
||||
}
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
|
||||
wg.Wait()
|
||||
|
||||
//res, _ := sims.List(s)
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"log"
|
||||
pb "git.loafle.net/overflow/overflow_api_db/build/golang"
|
||||
"google.golang.org/grpc"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"log"
|
||||
)
|
||||
|
||||
|
||||
func InvokeDB(targetDb, methodName string, param map[string]string) (string, error) {
|
||||
|
||||
in := &pb.DBInput{}
|
||||
@@ -34,4 +32,3 @@ func InvokeDB(targetDb, methodName string, param map[string]string) (string, err
|
||||
|
||||
return out.Result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import "git.loafle.net/overflow/overflow_service/proxy/member"
|
||||
func GetSessionMember() *member.Member {
|
||||
|
||||
m := member.NewMember()
|
||||
m.Id = "1";
|
||||
m.Id = "1"
|
||||
|
||||
return m;
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
)
|
||||
|
||||
// Deprecated: package rule changed...T__T
|
||||
func InvokeDB( db string, method string, obj interface{}) (string, error) {
|
||||
func InvokeDB(db string, method string, obj interface{}) (string, error) {
|
||||
|
||||
var m map[string]string = nil;
|
||||
var m map[string]string = nil
|
||||
|
||||
if obj != nil {
|
||||
bytes, err := json.Marshal(obj)
|
||||
@@ -21,13 +21,12 @@ func InvokeDB( db string, method string, obj interface{}) (string, error) {
|
||||
m[GenerateModelStr(db)] = string(bytes)
|
||||
}
|
||||
|
||||
|
||||
out, err := proxy.InvokeDB(db, method, m)
|
||||
|
||||
return out, err
|
||||
}
|
||||
|
||||
func InvokeDBByModel( db string, method string, obj interface{}, model string) (string, error) {
|
||||
func InvokeDBByModel(db string, method string, obj interface{}, model string) (string, error) {
|
||||
|
||||
bytes, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
@@ -40,6 +39,5 @@ func InvokeDBByModel( db string, method string, obj interface{}, model string) (
|
||||
|
||||
out, err := proxy.InvokeDB(db, method, m)
|
||||
|
||||
|
||||
return out, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package utils
|
||||
import "strings"
|
||||
|
||||
const (
|
||||
defaultPackage = "com.loafle.overflow."
|
||||
defaultPackage = "com.loafle.overflow."
|
||||
modelPackageName = ".model."
|
||||
)
|
||||
|
||||
@@ -11,11 +11,10 @@ func GenerateModelStr(model string) string {
|
||||
|
||||
tm := strings.Title(model)
|
||||
|
||||
|
||||
res := defaultPackage
|
||||
res += model
|
||||
res += modelPackageName
|
||||
res += tm
|
||||
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStringUpper(t *testing.T) {
|
||||
@@ -11,10 +11,8 @@ func TestStringUpper(t *testing.T) {
|
||||
|
||||
aa := strings.Title(res)
|
||||
|
||||
|
||||
t.Log(aa)
|
||||
|
||||
|
||||
}
|
||||
|
||||
func TestGM(t *testing.T) {
|
||||
@@ -23,16 +21,14 @@ func TestGM(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
func TestNil(t *testing.T) {
|
||||
|
||||
var oo interface{}
|
||||
|
||||
oo = nil;
|
||||
oo = nil
|
||||
|
||||
if oo == nil {
|
||||
t.Log("nil!!!")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user