github.com/jfrog/jfrog-cli-core@v1.12.1/artifactory/commands/mvn/mvn_test.go (about) 1 package mvn 2 3 import ( 4 "fmt" 5 "os" 6 "path/filepath" 7 "testing" 8 9 "github.com/jfrog/jfrog-cli-core/artifactory/utils" 10 "github.com/jfrog/jfrog-cli-core/utils/coreutils" 11 "github.com/jfrog/jfrog-client-go/utils/io/fileutils" 12 "github.com/stretchr/testify/assert" 13 ) 14 15 func TestDownloadExtractorsFromOjo(t *testing.T) { 16 // Set 'JFROG_CLI_DEPENDENCIES_DIR' env var to a temp dir 17 tempDirPath, err := fileutils.CreateTempDir() 18 assert.NoError(t, err) 19 defer fileutils.RemoveTempDir(tempDirPath) 20 err = os.Setenv(coreutils.DependenciesDir, tempDirPath) 21 assert.NoError(t, err) 22 23 // Make sure the JAR will be downloaded from ojo 24 err = os.Unsetenv(utils.JCenterRemoteServerEnv) 25 assert.NoError(t, err) 26 err = os.Unsetenv(utils.ExtractorsRemoteEnv) 27 assert.NoError(t, err) 28 29 // Download JAR and create classworlds.conf 30 dependenciesPath, err := downloadDependencies() 31 assert.NoError(t, err) 32 33 // Make sure the Maven build-info extractor JAR and the classwords.conf file exists 34 expectedJarPath := filepath.Join(dependenciesPath, fmt.Sprintf("build-info-extractor-maven3-%s-uber.jar", mavenExtractorDependencyVersion)) 35 assert.FileExists(t, expectedJarPath) 36 expectedClasswordsPath := filepath.Join(dependenciesPath, "classworlds.conf") 37 assert.FileExists(t, expectedClasswordsPath) 38 }