Skip to content

Commit

Permalink
adding partition attributes to faker generator
Browse files Browse the repository at this point in the history
  • Loading branch information
aviaIguazio committed Jul 11, 2019
1 parent 0f382fd commit 238ec86
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions httpblaster/data_generator/fakerGenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
log "github.com/sirupsen/logrus"
"github.com/v3io/http_blaster/httpblaster/igz_data"
"math"
"strconv"
"time"
)

// Create structs with random injected data
Expand All @@ -19,11 +21,15 @@ type Fake struct {
BeerName string
Color string
Company string
CreditCardNumber int
CreditCardNumber string
HackerPhrase string
JobTitle string
Password string
CurrencyShort string
Year string
Month string
Day string
Hour string
}

func randomBase64String(l int) string {
Expand All @@ -38,6 +44,7 @@ func (self *Fake) Init() {
}

func (self *Fake) GenerateRandomData() string {
t := time.Now()
self.Key = randomBase64String(16)

self.Name = gofakeit.Name() // Markus Moen
Expand All @@ -47,11 +54,16 @@ func (self *Fake) GenerateRandomData() string {
self.BeerName = gofakeit.BeerName() // Duvel
self.Color = gofakeit.Color() // MediumOrchid
self.Company = gofakeit.Company() // Moen, Pagac and Wuckert
self.CreditCardNumber = gofakeit.CreditCardNumber() // 4287271570245748
self.CreditCardNumber = strconv.Itoa(gofakeit.CreditCardNumber()) // 4287271570245748
self.HackerPhrase = gofakeit.HackerPhrase() // Connecting the array won't do anything, we need to generate the haptic COM driver!
self.JobTitle = gofakeit.JobTitle() // Director
self.Password = gofakeit.Password(true, true, true, true, true, 32) // WV10MzLxq2DX79w1omH97_0ga59j8!kj
self.CurrencyShort = gofakeit.CurrencyShort()
self.Year = strconv.Itoa(t.Year())
self.Month = strconv.Itoa(int(t.Month()))
self.Day = strconv.Itoa(t.Day())
self.Hour = strconv.Itoa(t.Hour())

//return self.ToJsonString()// USD
return ""
}
Expand All @@ -62,6 +74,20 @@ func (self *Fake) ConvertToIgzEmdItemJson() string {
emdItem.InitItem()
emdItem.InsertKey("key", igz_data.T_STRING, self.Key)
emdItem.InsertItemAttr("Name", igz_data.T_STRING, self.Name)
emdItem.InsertItemAttr("Email", igz_data.T_STRING, self.Email)
emdItem.InsertItemAttr("Phone", igz_data.T_STRING, self.Phone)
emdItem.InsertItemAttr("BS", igz_data.T_STRING, self.BS)
emdItem.InsertItemAttr("BeerName", igz_data.T_STRING, self.BeerName)
emdItem.InsertItemAttr("Color", igz_data.T_STRING, self.Color)
emdItem.InsertItemAttr("Company", igz_data.T_STRING, self.Company)
emdItem.InsertItemAttr("CreditCardNumber", igz_data.T_NUMBER, self.CreditCardNumber)
emdItem.InsertItemAttr("HackerPhrase", igz_data.T_STRING, self.HackerPhrase)
emdItem.InsertItemAttr("JobTitle", igz_data.T_STRING, self.JobTitle)
emdItem.InsertItemAttr("Password", igz_data.T_STRING, self.Password)
emdItem.InsertItemAttr("Year", igz_data.T_NUMBER, self.Year)
emdItem.InsertItemAttr("Month", igz_data.T_NUMBER, self.Month)
emdItem.InsertItemAttr("Day", igz_data.T_NUMBER, self.Day)
emdItem.InsertItemAttr("Hour", igz_data.T_NUMBER, self.Hour)
log.Info(emdItem.ToJsonString())
return emdItem.ToJsonString()
}

0 comments on commit 238ec86

Please sign in to comment.