Esempio n. 1
0
func TestHiveExecMulti(t *testing.T) {
	e := h.Conn.Open()
	fatalCheck(t, "Populate", e)

	var ms1, ms2 []HiveResult
	q := "select * from sample_07 limit 5"

	e = h.Exec(q, func(x HiveResult) error {
		ms1 = append(ms1, x)
		return nil
	})

	fatalCheck(t, "HS1 exec", e)

	e = h.Exec(q, func(x HiveResult) error {
		ms2 = append(ms2, x)
		return nil
	})

	fatalCheck(t, "HS2 Exec", e)

	t.Logf("Value of HS1\n%s\n\nValue of HS2\n%s", toolkit.JsonString(ms1), toolkit.JsonString(ms2))

	h.Conn.Close()
}
Esempio n. 2
0
func TestScan(t *testing.T) {
	var e error

	fmt.Println("Test Scan")
	if econnect := connect(); econnect != nil {
		t.Error("Unable to connect to database")
		return
	}
	defer close()

	ormConn := orm.New(ctx)
	defer ormConn.Close()

	cats := make([]OutageCategory, 0)
	e = ormConn.Find(new(OutageCategory), nil).FetchAll(&cats, true)
	if e != nil {
		t.Error(e.Error())
	}

	os := make([]*Outage, 0)
	e = ormConn.Find(new(Outage), nil).FetchAll(&os, true)
	if e != nil {
		t.Error(e.Error())
	}

	for _, o := range os {
		fmt.Printf("Before: %s \n\n", tk.JsonString(o))
		for k, sum := range o.Summaries {
			for k, i := range sum.Outages {
				i.Valid = false
				i.SuggestedCategoryId = ""
				for _, c := range cats {
					fmt.Printf("Evaluating keyword: %s ...", strings.Join(c.Keywords, ","))
					c*k := c.Scan(i.Reason)
					fmt.Printf("%+v \n", c*k)
					if c*k {
						if i.Valid == false && sum.CategoryId == c.Id {
							fmt.Printf("Tag: %s as valid \n", c.Id)
							i.Valid = true
							i.SuggestedCategoryId = ""
						} else if i.Valid == false {
							fmt.Printf("Suggesting: %s \n", c.Id)
							i.SuggestedCategoryId = c.Id
						}
					}
				}
				sum.Outages[k] = i
			}
			o.Summaries[k] = sum
		}
		o.Sync()
		e = ormConn.Save(o)
		fmt.Printf("After: %s \n\n", tk.JsonString(o))
	}
}
Esempio n. 3
0
func TestAggr(t *testing.T) {
	skipIfNil(t)
	c2 := c.Min(fn).Max(fn).Sum(fn).Avg(fn).Exec()
	check(t, c2.Error, "Aggr")
	if toolkit.ToInt(c2.Result.Min, toolkit.RoundingAuto) != min ||
		toolkit.ToInt(c2.Result.Max, toolkit.RoundingAuto) != max ||
		c2.Result.Sum != toolkit.ToFloat64(sum, 4, toolkit.RoundingAuto) ||
		c2.Result.Avg != avg {
		t.Fatalf("Error aggr. Got %v\n", toolkit.JsonString(c2.Result))
	}
	toolkit.Println("Value: ", toolkit.JsonString(c2.Result))
}
Esempio n. 4
0
func TestSaveQuery(t *testing.T) {
	var e error
	for i := 1; i <= 5; i++ {
		ds := new(colonycore.DataSource)
		ds.ID = toolkit.Sprintf("ds%d", i)
		ds.ConnectionID = "conn1"
		ds.QueryInfo = toolkit.M{}
		ds.MetaData = nil
		e = colonycore.Save(ds)
		if e != nil {
			t.Fatalf("Save datasource fail. " + e.Error())
		}
	}

	var dss []colonycore.DataSource
	c, e := colonycore.Find(new(colonycore.DataSource), nil)
	if e != nil {
		t.Fatalf("Load ds fail: " + e.Error())
	}

	e = c.Fetch(&dss, 0, true)
	if e != nil {
		t.Fatalf("Ftech ds fail: " + e.Error())
	}
	if len(dss) != 5 {
		t.Fatal("Fetch ds fail. Got %d records only", len(dss))
	}
	toolkit.Println("Data:", toolkit.JsonString(dss))
}
Esempio n. 5
0
func TestSelect(t *testing.T) {
	skipIfConnectionIsNil(t)

	cursor, e := ctx.NewQuery().From(tableName).Where(dbox.Eq("Enable", false)).Cursor(nil)
	if e != nil {
		t.Fatalf("Cursor error: " + e.Error())
	}
	defer cursor.Close()

	if cursor.Count() == 0 {
		t.Fatalf("No record found")
	}

	var datas []toolkit.M
	e = cursor.Fetch(&datas, 0, false)
	if e != nil {
		t.Fatalf("Fetch error: %s", e.Error())
	}
	if len(datas) != cursor.Count() {
		t.Fatalf("Expect %d records got %d\n%s\n", cursor.Count(), len(datas), toolkit.JsonString(datas))
	}
	toolkit.Printf("Record found: %d\nData:\n%s\n", len(datas),
		func() string {
			var ret []string
			for _, v := range datas {
				ret = append(ret, v.GetString("_id"))
			}
			return strings.Join(ret, ",")
		}())
}
Esempio n. 6
0
func TestSelect(t *testing.T) {
	t.Skip()
	c, e := prepareConnection()

	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
	}
	defer c.Close()

	// csr, e := c.NewQuery().Select().From("tes").Where(dbox.Eq("id", "3")).Cursor(nil)
	csr, e := c.NewQuery().
		// Select("empno", "ename", "hiredate").
		From(tableCustomers).Cursor(nil)

	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	rets := []toolkit.M{}
	e = csr.Fetch(&rets, 0, false)
	if e != nil {
		t.Errorf("Unable to fetch N: %s \n", e.Error())
	} else {
		toolkit.Printf("Fetch N OK. Result: %v \n", toolkit.JsonString(rets))
		toolkit.Printf("Total Fetch OK : %v \n", toolkit.SliceLen(rets))
	}
}
Esempio n. 7
0
func TestTakeSkip(t *testing.T) {
	t.Skip()
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
	}
	defer c.Close()

	csr, e := c.NewQuery().
		Select("id", "productname").
		From(tableProducts).
		Take(5).
		Skip(10).
		Cursor(nil)
	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	rets := []toolkit.M{}
	e = csr.Fetch(&rets, 0, false)
	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		toolkit.Printf("Fetch OK. Result: %v \n", toolkit.JsonString(rets))
		toolkit.Printf("Total Record OK. Result: %v \n", toolkit.SliceLen(rets))

	}
}
Esempio n. 8
0
func TestSelectAggregate(t *testing.T) {
	t.Skip()
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
	}
	defer c.Close()

	csr, e := c.NewQuery().
		Select("productname").
		Aggr(dbox.AggrSum, "price", "Total Price").
		Aggr(dbox.AggrAvr, "price", "Avg").
		From(tableProducts).
		Group("productname").
		Cursor(nil)
	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	rets := []toolkit.M{}
	e = csr.Fetch(&rets, 0, false)
	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		toolkit.Printf("Fetch OK. Result: %v \n", toolkit.JsonString(rets))

	}
}
Esempio n. 9
0
func TestSelectFilter(t *testing.T) {
	t.Skip()
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
		return
	}
	defer c.Close()

	csr, e := c.NewQuery().
		Select("empno", "ename", "mgr", "hiredate").
		Where(dbox.Or(dbox.Eq("empno", 7521), dbox.Eq("ename", "ADAMS"))).
		From(tableName).Cursor(nil)
	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	rets := /*[]customers{}*/ []toolkit.M{}
	e = csr.Fetch(&rets, 0, false)
	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		toolkit.Printf("Filter OK. Result: %v \n", toolkit.JsonString(rets))
	}
}
Esempio n. 10
0
func TestSelectAggregate(t *testing.T) {
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
		return
	}
	defer c.Close()

	//fb := c.Fb()
	csr, e := c.NewQuery().
		Aggr(dbox.AggrSum, 1, "Sum").
		Aggr(dbox.AggrMax, "$fullname", "Name").
		From("ORMUsers").
		Group("enable").
		Cursor(nil)
	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	ds, e := csr.Fetch(nil, 0, false)
	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		fmt.Printf("Fetch OK. Result: %v \n",
			toolkit.JsonString(ds.Data))

	}
}
Esempio n. 11
0
func TestSelectFilter(t *testing.T) {
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
		return
	}
	defer c.Close()

	csr, e := c.NewQuery().
		//Select("_id", "email").
		Where(dbox.Eq("email", "*****@*****.**")).
		Cursor(nil)
	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	//rets := []toolkit.M{}

	ds, e := csr.Fetch(nil, 0, false)
	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		fmt.Printf("Fetch OK. Result: %v \n",
			toolkit.JsonString(ds.Data[0]))

	}
}
Esempio n. 12
0
func TestSelect(t *testing.T) {
	// t.Skip()
	skipIfConnectionIsNil(t)

	cursor, e := ctx.NewQuery().
		Select("id", "nama", "amount").
		From(tableName).
		Cursor(nil)
	if e != nil {
		t.Fatalf("Cursor error: " + e.Error())
	}
	defer cursor.Close()

	var results []toolkit.M
	e = cursor.Fetch(&results, 0, false)

	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		toolkit.Println("======================")
		toolkit.Println(operation)
		toolkit.Println("======================")
		toolkit.Println(sintaks)
		toolkit.Println("Number of rows", cursor.Count())
		toolkit.Println("Fetch OK. Result:")
		for _, val := range results {
			toolkit.Printf("%v \n",
				toolkit.JsonString(val))
		}
	}
}
Esempio n. 13
0
func TestSelectAggregateUsingCommand(t *testing.T) {
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
		return
	}
	defer c.Close()

	//fb := c.Fb()
	pipe := []toolkit.M{toolkit.M{}.Set("$group", toolkit.M{}.Set("_id", "$enable").Set("count", toolkit.M{}.Set("$sum", 1)))}
	csr, e := c.NewQuery().
		Command("pipe", pipe).
		From("ORMUsers").
		Cursor(nil)
	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	ds, e := csr.Fetch(nil, 0, false)
	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		fmt.Printf("Fetch OK. Result: %v \n",
			toolkit.JsonString(ds.Data))
	}
}
Esempio n. 14
0
func TestFreeQuery(t *testing.T) {
	t.Skip()
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
	}
	defer c.Close()

	csr, e := c.NewQuery().
		Command("freequery", toolkit.M{}.
			Set("syntax", "select name from tes where name like 'r%'")).
		Cursor(nil)

	if csr == nil {
		t.Errorf("Cursor not initialized", e.Error())
		return
	}
	defer csr.Close()

	results := make([]map[string]interface{}, 0)
	err := csr.Fetch(&results, 0, false)
	if err != nil {
		t.Errorf("Unable to fetch: %s \n", err.Error())
	} else {
		toolkit.Println("======================")
		toolkit.Println("TEST FREE QUERY")
		toolkit.Println("======================")
		toolkit.Println("Fetch N OK. Result: ")
		for _, val := range results {
			toolkit.Printf("%v \n",
				toolkit.JsonString(val))
		}
	}
}
Esempio n. 15
0
func main() {
	//emp := new(Employee)
	//var emps interface{}
	emps := tk.MakeSlice(&Employee{}).([]*Employee)
	fillArray(&emps)
	fmt.Printf("Value of empls:\n%s\n", tk.JsonString(emps))
}
Esempio n. 16
0
func TestDelete(t *testing.T) {
	//t.Skip()
	ctx, e := prepareContext()
	if e != nil {
		t.Errorf("Error Connect: %s", e.Error())
		return
	}
	defer ctx.Close()
	u := new(UserModel)
	e = ctx.GetById(u, "user2")
	if e == nil {
		fmt.Printf("Will Delete UserModel:\n %s \n", tk.JsonString(u))
		e = ctx.Delete(u)
		if e != nil {
			t.Errorf("Error Load: %s", e.Error())
			return
		} else {
			tk.Unjson(tk.Jsonify(u), u)
			fmt.Printf("UserModel: %v has been deleted \n", u.RandomDate.UTC())
			fmt.Println("")
		}
	} else {
		t.Errorf("Delete error: %s", e.Error())
	}
}
Esempio n. 17
0
func TestSelectAllField(t *testing.T) {
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
	}
	defer c.Close()

	csr, e := c.NewQuery().Cursor(nil)
	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	//rets := []toolkit.M{}

	//ds, e := csr.Fetch(nil, 0, false)
	results := []toolkit.M{} //make([]toolkit.M, 0)
	e = csr.Fetch(&results, 0, false)
	if e != nil {
		t.Errorf("Unable to fetch all: %s \n", e.Error())
	} else {
		fmt.Printf("Fetch all fields. Result: %v \n", toolkit.JsonString(results[0]))
	}
}
Esempio n. 18
0
func TestFindByEnable(t *testing.T) {
	//InitCall()

	emp6, _ := office.EmployeeGetByID("emp6", "")
	emp8, _ := office.EmployeeGetByID("emp8", "")
	office.DB().Delete(emp6)
	office.DB().Delete(emp8)

	emps := office.EmployeeFindByEnable(true,
		"_id,title,enable", 0, 0)
	defer emps.Close()
	log.Printf("EMPS => %+v\n", emps.Count())

	i := 0
	for {
		emp := office.NewEmployee()
		e := emps.Fetch(emp, 1, false)
		if e != nil {
			break
		}
		toolkit.Println(toolkit.JsonString(emp))
		i++
		if i == 10 {
			break
		}
	}
}
Esempio n. 19
0
func TestSelectLimit(t *testing.T) {
	t.Skip("Skip : Comment this line to do test")
	skipIfConnectionIsNil(t)

	cursor, e := ctx.NewQuery().
		Select("EmployeeId", "FirstName").
		Skip(0).Take(3).
		From(tableName).
		Cursor(nil)

	if e != nil {
		t.Fatalf("Cursor error: " + e.Error())
	}

	datas := make([]toolkit.M, 0, 0)
	e = cursor.Fetch(&datas, 0, false)
	if e != nil {
		t.Fatalf("Fetch error: %s", e.Error())
	}

	toolkit.Printf("Total Record : %d\n", cursor.Count())
	toolkit.Printf("Record found: %d\nData:\n%s\n", len(datas), toolkit.JsonString(datas))

	cursor.Close()

	//==================
	cursor, e = ctx.NewQuery().
		Select("EmployeeId").
		Skip(3).Take(5).
		From(tableName).
		Cursor(nil)

	if e != nil {
		t.Fatalf("Cursor error: " + e.Error())
	}

	datas = make([]toolkit.M, 0, 0)
	e = cursor.Fetch(&datas, 0, false)
	if e != nil {
		t.Fatalf("Fetch error: %s", e.Error())
	}

	toolkit.Printf("Total Record : %d\n", cursor.Count())
	toolkit.Printf("Record found: %d\nData:\n%s\n", len(datas), toolkit.JsonString(datas))

	cursor.Close()
}
Esempio n. 20
0
func TestGetById(t *testing.T) {
	//InitCall()
	emp, e := office.EmployeeGetByID("emp110", "")
	if e != nil {
		t.Fatal(e.Error())
	}
	log.Printf("EMP => %+v\n", toolkit.JsonString(emp))
}
Esempio n. 21
0
func TestGetByTitleEnable(t *testing.T) {
	//InitCall()
	emp, e := office.EmployeeGetByTitleEnable("Test Title 116", true, "")
	if e != nil {
		t.Fatal(e.Error())
	}
	log.Printf("EMP => %+v\n", toolkit.JsonString(emp))
}
Esempio n. 22
0
func TestViewAllTables(t *testing.T) {
	t.Skip()
	skipIfConnectionIsNil(t)

	csr := ctx.ObjectNames(dbox.ObjTypeTable)

	toolkit.Println("list of table : ")
	for i := 0; i < len(csr); i++ {
		toolkit.Printf("%v \n", toolkit.JsonString(csr[i]))
	}
}
Esempio n. 23
0
func TestAllObj(t *testing.T) {
	t.Skip()
	skipIfConnectionIsNil(t)

	all := ctx.ObjectNames(dbox.ObjTypeAll)

	toolkit.Println("list of all objects : ")
	for i := 0; i < len(all); i++ {
		toolkit.Printf("%v \n", toolkit.JsonString(all[i]))
	}

}
Esempio n. 24
0
func TestViewName(t *testing.T) {
	t.Skip()
	skipIfConnectionIsNil(t)

	view := ctx.ObjectNames(dbox.ObjTypeView)

	toolkit.Println("list of view : ")
	for i := 0; i < len(view); i++ {
		toolkit.Printf("%v \n", toolkit.JsonString(view[i]))
	}

}
Esempio n. 25
0
func TestViewProcedureName(t *testing.T) {
	t.Skip()
	skipIfConnectionIsNil(t)

	proc := ctx.ObjectNames(dbox.ObjTypeProcedure)

	toolkit.Println("list of procedure : ")
	for i := 0; i < len(proc); i++ {
		toolkit.Printf("%v \n", toolkit.JsonString(proc[i]))
	}

}
Esempio n. 26
0
func TestSort(t *testing.T) {
	csort := c.Clone().Sort(crowd.SortDescending, func(x interface{}) interface{} {
		return x.(Obj).F
	}).Apply(func(x interface{}) interface{} {
		return x.(Obj).F
	}).Exec()
	if csort.Error != nil {
		t.Fatal(csort.Error)
	}
	toolkit.Println("Data after sort:",
		toolkit.JsonString(csort.Result.Data()))
}
Esempio n. 27
0
func TestFilter(t *testing.T) {
	fb := dbox.NewFilterBuilder(new(FilterBuilder))
	fb.AddFilter(dbox.Or(
		dbox.Eq("_id", 1),
		dbox.Eq("group", "administrators")))
	b, e := fb.Build()
	if e != nil {
		t.Errorf("Error %s", e.Error())
	} else {
		fmt.Printf("Result:\n%v\n", toolkit.JsonString(b))
	}
}
Esempio n. 28
0
func TestSelectTake(t *testing.T) {
	c, e := prepareConnection()
	if e != nil {
		t.Errorf("Unable to connect %s \n", e.Error())
		return
	}
	defer c.Close()

	csr, e := c.NewQuery().
		Take(5).
		Cursor(nil)
	if e != nil {
		t.Errorf("Cursor pre error: %s \n", e.Error())
		return
	}
	if csr == nil {
		t.Errorf("Cursor not initialized")
		return
	}
	defer csr.Close()

	results := []toolkit.M{}
	e = csr.Fetch(&results, 3, false)
	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		fmt.Printf("Fetch take N3. Result: %v \n",
			toolkit.JsonString(results))

	}

	e = csr.Fetch(&results, 3, false)
	if e != nil {
		t.Errorf("Unable to fetch: %s \n", e.Error())
	} else {
		fmt.Printf("Fetch take 3. Result: %v \n",
			toolkit.JsonString(results))

	}
}
Esempio n. 29
0
func TestDb2(t *testing.T) {
	fmt.Println("Test 2b - Insert Data (Parallel)")
	numCount := pnumCount
	workerCount := pworkerCount
	idxs := make([]interface{}, numCount)
	for i := 1; i <= numCount; i++ {
		idxs[i-1] = i + 2000
	}

	conn := mongodb.NewConnection("localhost:27888", "root", "Database.1", "ectest")
	//conn := mongodb.NewConnection("localhost:27888", "", "", "ectest")
	e = conn.Connect()
	if e != nil {
		t.Error("Unable to connect to Database | " + e.Error())
		return
	}
	defer conn.Close()
	_, e = conn.Execute("appusers", toolkit.M{"find": toolkit.M{}, "operation": base.DB_DELETE})
	if e != nil {
		fmt.Println("Unable to delete: " + e.Error())
	}

	fmt.Printf("Insert %d data within %d pools \n", numCount, workerCount)
	pr := Run(idxs, workerCount, func(js <-chan interface{}, rs chan<- *toolkit.Result) {
		for jb := range js {
			j := jb.(int)
			user := toolkit.M{}
			userid := "User " + strconv.Itoa(j)
			user.Set("_id", userid)
			user.Set("fullname", "User "+strconv.Itoa(j))
			user.Set("email", "user"+strconv.Itoa(j)+"@email.com")
			r := new(toolkit.Result)
			//_, _, e = conn.Query().From("ORMUsers").Save(user).Run()
			_, e := conn.Execute("appusers",
				toolkit.M{"find": toolkit.M{"_id": userid}, "operation": base.DB_SAVE, "data": user})
			if e == nil {
				r.Status = toolkit.Status_OK
				r.Data = user
			} else {
				r.Status = toolkit.Status_NOK
				r.Message = "Error ID " + strconv.Itoa(j) + " " + e.Error()
			}
			rs <- r
		}
	})

	if pr.Success == numCount {
		fmt.Printf("Test OK in %v \n\n", pr.Duration)
	} else {
		fmt.Printf("Test Fail has %d records. \nErrors\n%v\nIn %v \n\n", pr.Success, toolkit.JsonString(pr.Errors[0]), pr.Duration)
	}
}
Esempio n. 30
0
func TestHiveExecMulti(t *testing.T) {
	var ms1, ms2 []toolkit.M
	q := "select * from sample_07 limit 5"

	hs1, e := h.Exec(q, toolkit.M{}, func(x toolkit.M) error {
		ms1 = append(ms1, x)
		return nil
	})
	fatalCheck(t, "HS1 exec", e)
	e = hs1.Wait()
	fatalCheck(t, "HS1 wait", e)

	hs2, e := h.Exec(q, toolkit.M{}, func(x toolkit.M) error {
		ms2 = append(ms2, x)
		return nil
	})
	fatalCheck(t, "HS2 exec", e)
	e = hs2.Wait()
	fatalCheck(t, "HS2 wait", e)

	for i, v1 := range ms1 {
		if i > len(ms2) {
			t.Fatalf("Len of both HS is not the same")
			return
		}
		v2 := ms2[i]
		for k, vm1 := range v1 {
			if !v2.Has(k) {
				t.Fatalf("Key not same")
			}
			vm2 := v2[k]
			if vm1 != vm2 {
				t.Fatalf("Value not the same")
			}
		}
	}

	t.Logf("Value of HS1\n%s\n\nValue of HS2\n%s", toolkit.JsonString(ms1), toolkit.JsonString(ms2))
}