Exemple #1
0
func GetTestResourcesPath() string {
	dir, _ := os.Getwd()
	fileSepatatr := ioutils.GetFileSeperator()
	index := strings.LastIndex(dir, fileSepatatr)
	dir = dir[:index]
	return dir + ioutils.GetFileSeperator() + "testsdata" + ioutils.GetFileSeperator()
}
func TestBintrayFileDownloads(t *testing.T) {
	initBintrayTest(t)

	repositoryPath := bintrayConfig.User + "/" + tests.BintrayRepo1
	packagePath := repositoryPath + "/" + tests.BintrayUploadTestPackageName
	versionPath := packagePath + "/" + tests.BintrayUploadTestVersion
	createPackageAndVersion(packagePath, versionPath)
	bintrayCli.Exec("upload", tests.GetTestResourcesPath()+"a/*", versionPath, "--flat=true --recursive=true")
	bintrayCli.Exec("upload", tests.GetTestResourcesPath()+"a/a1.in", versionPath, "--flat=false")

	bintrayCli.Exec("download-file", repositoryPath+"/a1.in", tests.Out+"/bintray/", "--unpublished=true")
	bintrayCli.Exec("download-file", repositoryPath+"/b1.in", tests.Out+"/bintray/x.in", "--unpublished=true")
	bintrayCli.Exec("download-file", repositoryPath+"/(c)1.in", tests.Out+"/bintray/z{1}.in", "--unpublished=true")
	bintrayCli.Exec("download-file", repositoryPath+"/"+tests.GetTestResourcesPath()[1:]+"(a)/a1.in", tests.Out+"/bintray/{1}/fullpatha1.in", "--flat=true --unpublished=true")

	paths, _ := ioutils.ListFilesRecursive(tests.Out + "/bintray/")
	expected := []string{
		tests.Out + ioutils.GetFileSeperator() + "bintray" + ioutils.GetFileSeperator() + "a1.in",
		tests.Out + ioutils.GetFileSeperator() + "bintray" + ioutils.GetFileSeperator() + "x.in",
		tests.Out + ioutils.GetFileSeperator() + "bintray" + ioutils.GetFileSeperator() + "zc.in",
		tests.Out + ioutils.GetFileSeperator() + "bintray" + ioutils.GetFileSeperator() + "a" + ioutils.GetFileSeperator() + "fullpatha1.in",
	}
	tests.IsExistLocally(expected, paths, t)
	bintrayCli.Exec("package-delete", packagePath, "--quiet=true")
	cleanBintrayTest()
}
Exemple #3
0
func GetFilePath(fileName string) string {
	filePath := GetTestResourcesPath() + "specs/common" + ioutils.GetFileSeperator() + fileName
	isExists, _ := ioutils.IsFileExists(filePath)
	if isExists {
		return filePath
	}
	return getFileByOs(fileName)
}
Exemple #4
0
func getFileByOs(fileName string) string {
	var currentOs string
	fileSepatatr := ioutils.GetFileSeperator()
	if runtime.GOOS == "windows" {
		currentOs = "win"
	} else {
		currentOs = "unix"
	}
	return GetTestResourcesPath() + "specs" + fileSepatatr + currentOs + fileSepatatr + fileName
}
Exemple #5
0
func createAttachLicFlags(c *cli.Context) (flags *rtinstances.AttachLicFlags, err error) {
	flags = new(rtinstances.AttachLicFlags)
	flags.MissionControlDetails, err = createMissionControlDetails(c, true)
	if err != nil {
		return
	}
	flags.LicensePath = c.String("license-path")
	if strings.HasSuffix(flags.LicensePath, ioutils.GetFileSeperator()) {
		cliutils.Exit(cliutils.ExitCodeError, "The --license-path option cannot be a directory")
	}
	if flags.BucketId = c.String("bucket-id"); flags.BucketId == "" {
		cliutils.Exit(cliutils.ExitCodeError, "The --bucket-id option is mandatory")
	}
	flags.Override = cliutils.GetBoolFlagValue(c, "override", false)
	flags.Deploy = cliutils.GetBoolFlagValue(c, "deploy", false)
	flags.NodeId = c.String("node-id")
	return
}
	Repo2 + "/properties_target/properties_source/a/a1.in",
	Repo2 + "/properties_target/properties_source/a/a2.in",
	Repo2 + "/properties_target/properties_source/a/a3.in",
	Repo2 + "/properties_target/properties_source/a/b/b1.in",
	Repo2 + "/properties_target/properties_source/a/b/b2.in",
	Repo2 + "/properties_target/properties_source/a/b/b3.in",
	Repo2 + "/properties_target/properties_source/a/b/c/c1.in",
	Repo2 + "/properties_target/properties_source/a/b/c/c2.in",
	Repo2 + "/properties_target/properties_source/a/b/c/c3.in",
	Repo2 + "/rename_target/RENAMED.in",
	Repo2 + "/simple_placeholder_target/a/a1.in",
	Repo2 + "/simple_target/a1.in",
}

var MassiveDownload = []string{
	Out + ioutils.GetFileSeperator() + "a1.in",
	Out + ioutils.GetFileSeperator() + "a2.in",
	Out + ioutils.GetFileSeperator() + "a3.in",
	Out + ioutils.GetFileSeperator() + "download",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "3_only_flat_recursive" + ioutils.GetFileSeperator() + "a3.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "3_only_flat_recursive" + ioutils.GetFileSeperator() + "b3.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "3_only_flat_recursive" + ioutils.GetFileSeperator() + "c3.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql" + ioutils.GetFileSeperator() + "downloadTestResources" + ioutils.GetFileSeperator() + "a",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql" + ioutils.GetFileSeperator() + "downloadTestResources" + ioutils.GetFileSeperator() + "a" + ioutils.GetFileSeperator() + "a1.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql_flat" + ioutils.GetFileSeperator() + "a1.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql_flat" + ioutils.GetFileSeperator() + "a2.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql_flat" + ioutils.GetFileSeperator() + "a3.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql_flat" + ioutils.GetFileSeperator() + "b1.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql_flat" + ioutils.GetFileSeperator() + "b2.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql_flat" + ioutils.GetFileSeperator() + "b3.in",
	Out + ioutils.GetFileSeperator() + "download" + ioutils.GetFileSeperator() + "aql_flat" + ioutils.GetFileSeperator() + "c1.in",