コード例 #1
0
func TestDo(t *testing.T) {
	var err error
	package_copier := aptly_package_copier.New(nil, nil, nil)
	packageLastestVersion := aptly_package_latest_version.New(nil)
	packageDetailLister := aptly_model_lister.New(nil)

	err = do(package_copier, packageLastestVersion, packageDetailLister, "", "", "", "", "", "", "", "", "", "")
	err = AssertThat(err, NotNilValue())
	if err != nil {
		t.Fatal(err)
	}
}
コード例 #2
0
func main() {
	defer glog.Flush()
	glog.CopyStandardLogTo("info")
	flag.Parse()

	runtime.GOMAXPROCS(runtime.NumCPU())

	httpClient := http_client_builder.New().WithoutProxy().Build()
	httpRequestBuilderProvider := http_requestbuilder.NewHTTPRequestBuilderProvider()
	requestbuilder_executor := aptly_requestbuilder_executor.New(httpClient.Do)
	requestbuilder := http_requestbuilder.NewHTTPRequestBuilderProvider()
	repo_publisher := aptly_repo_publisher.New(requestbuilder_executor, requestbuilder)
	packageUploader := aptly_package_uploader.New(requestbuilder_executor, requestbuilder, repo_publisher.PublishRepo)
	packageCopier := aptly_package_copier.New(packageUploader, requestbuilder, httpClient.Do)
	packageLister := aptly_package_lister.New(httpClient.Do, httpRequestBuilderProvider.NewHTTPRequestBuilder)
	packageDetailLister := aptly_model_lister.New(packageLister.ListPackages)
	packageVersion := aptly_package_versions.New(packageDetailLister.ListPackageDetails)
	packageLastestVersion := aptly_package_latest_version.New(packageVersion.PackageVersions)
	packageDetailLatestLister := aptly_model_latest_lister.New(packageDetailLister.ListPackageDetails)

	if len(*repoURLPtr) == 0 {
		*repoURLPtr = *apiURLPtr
	}

	err := do(
		packageCopier,
		packageLastestVersion,
		packageDetailLatestLister,
		*repoURLPtr,
		*apiURLPtr,
		*apiUserPtr,
		*apiPasswordPtr,
		*apiPasswordFilePtr,
		*sourcePtr,
		*targetPtr,
		*targetDistributionPtr,
		*namePtr,
		*versionPtr,
	)
	if err != nil {
		glog.Exit(err)
	}
}