當前位置: 首頁>>代碼示例>>Golang>>正文


Golang directories.NewDirectoriesProvider函數代碼示例

本文整理匯總了Golang中bosh/settings/directories.NewDirectoriesProvider函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewDirectoriesProvider函數的具體用法?Golang NewDirectoriesProvider怎麽用?Golang NewDirectoriesProvider使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewDirectoriesProvider函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: buildMigrateDiskAction

func buildMigrateDiskAction() (platform *fakeplatform.FakePlatform, action migrateDiskAction) {
	platform = fakeplatform.NewFakePlatform()
	settings := &fakesettings.FakeSettingsService{}
	dirProvider := boshdirs.NewDirectoriesProvider("/foo")
	action = newMigrateDisk(settings, platform, dirProvider)
	return
}
開發者ID:UhuruSoftware,項目名稱:bosh_old,代碼行數:7,代碼來源:migrate_disk_test.go

示例2: getNewProvider

func getNewProvider() (provider provider) {
	dirProvider := boshsys.NewDirectoriesProvider("/var/vcap")
	fs := fakefs.NewFakeFileSystem()

	provider = NewProvider(boshlog.NewLogger(boshlog.LEVEL_NONE), fs, dirProvider)
	return
}
開發者ID:kangaroo,項目名稱:bosh,代碼行數:7,代碼來源:provider_test.go

示例3: createBlobManager

func createBlobManager() (blobManager BlobManager, fs *fakesys.FakeFileSystem) {
	fs = fakesys.NewFakeFileSystem()
	dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")

	blobManager = NewBlobManager(fs, dirProvider)
	return
}
開發者ID:UhuruSoftware,項目名稱:bosh_old,代碼行數:7,代碼來源:blob_manager_test.go

示例4: buildCompiler

func buildCompiler() (
	deps compilerDeps,
	compiler Compiler,
) {
	deps.compressor = fakecmd.NewFakeCompressor()
	deps.blobstore = &fakeblobstore.FakeBlobstore{}
	deps.fs = fakesys.NewFakeFileSystem()
	deps.runner = fakesys.NewFakeCmdRunner()
	deps.packageApplier = fakepa.NewFakePackageApplier()
	fakeBundleCollection := fakebc.NewFakeBundleCollection()
	bundleDefinition := boshmodels.Package{
		Name:    "pkg_name",
		Version: "pkg_version",
	}
	deps.bundle = fakeBundleCollection.FakeGet(bundleDefinition)
	deps.bundle.InstallPath = "/fake-dir/data/packages/pkg_name/pkg_version"
	deps.bundle.EnablePath = "/fake-dir/packages/pkg_name"
	deps.packagesBc = fakeBundleCollection

	compiler = NewConcreteCompiler(
		deps.compressor,
		deps.blobstore,
		deps.fs,
		deps.runner,
		boshdirs.NewDirectoriesProvider("/fake-dir"),
		deps.packageApplier,
		deps.packagesBc,
	)
	return
}
開發者ID:nkuacac,項目名稱:bosh,代碼行數:30,代碼來源:concrete_compiler_test.go

示例5: buildFactory

func buildFactory() (
	deps concreteFactoryDependencies,
	factory Factory) {

	deps.settings = &fakesettings.FakeSettingsService{}
	deps.platform = fakeplatform.NewFakePlatform()
	deps.blobstore = &fakeblobstore.FakeBlobstore{}
	deps.taskService = &faketask.FakeService{}
	deps.notifier = fakenotif.NewFakeNotifier()
	deps.applier = fakeappl.NewFakeApplier()
	deps.compiler = fakecomp.NewFakeCompiler()
	deps.monitor = fakemon.NewFakeMonitor()
	deps.specService = fakeas.NewFakeV1Service()
	deps.dirProvider = boshdirs.NewDirectoriesProvider("/foo")
	deps.drainScriptProvider = boshdrain.NewDrainScriptProvider(nil, nil, deps.dirProvider)

	factory = NewFactory(
		deps.settings,
		deps.platform,
		deps.blobstore,
		deps.taskService,
		deps.notifier,
		deps.applier,
		deps.compiler,
		deps.monitor,
		deps.specService,
		deps.dirProvider,
		deps.drainScriptProvider,
	)
	return
}
開發者ID:viglesiasce,項目名稱:bosh,代碼行數:31,代碼來源:concrete_factory_test.go

示例6: TestHandlerProviderGetReturnsConcreteProvider

func TestHandlerProviderGetReturnsConcreteProvider(t *testing.T) {
	platform := fakeplatform.NewFakePlatform()
	blobstore := fakeblob.NewFakeBlobstore()
	jobSupervisor := fakejobsuper.NewFakeJobSupervisor()

	expectedPackageApplier := pa.NewConcretePackageApplier(
		bc.NewFileBundleCollection("/fake-base-dir/data", "/fake-base-dir", "packages", platform.GetFs()),
		blobstore,
		platform.GetCompressor(),
	)

	expectedJobApplier := ja.NewRenderedJobApplier(
		bc.NewFileBundleCollection("/fake-base-dir/data", "/fake-base-dir", "jobs", platform.GetFs()),
		blobstore,
		platform.GetCompressor(),
		jobSupervisor,
	)
	dirProvider := boshdirs.NewDirectoriesProvider("/fake-base-dir")
	expectedApplier := NewConcreteApplier(
		expectedJobApplier,
		expectedPackageApplier,
		platform,
		jobSupervisor,
		dirProvider,
	)

	provider := NewApplierProvider(platform, blobstore, jobSupervisor, dirProvider)
	applier := provider.Get()
	assert.Equal(t, expectedApplier, applier)
}
開發者ID:UhuruSoftware,項目名稱:bosh_old,代碼行數:30,代碼來源:applier_provider_test.go

示例7: buildLogsAction

func buildLogsAction() (*fakecmd.FakeCompressor, *fakeblobstore.FakeBlobstore, logsAction) {
	compressor := fakecmd.NewFakeCompressor()
	blobstore := &fakeblobstore.FakeBlobstore{}
	dirProvider := boshdirs.NewDirectoriesProvider("/fake/dir")
	action := newLogs(compressor, blobstore, dirProvider)
	return compressor, blobstore, action
}
開發者ID:viglesiasce,項目名稱:bosh,代碼行數:7,代碼來源:logs_test.go

示例8: getExternalBlobstoreDependencies

func getExternalBlobstoreDependencies() (fs *fakesys.FakeFileSystem, runner *fakesys.FakeCmdRunner, uuidGen *fakeuuid.FakeGenerator, configPath string) {
	fs = &fakesys.FakeFileSystem{}
	runner = &fakesys.FakeCmdRunner{}
	uuidGen = &fakeuuid.FakeGenerator{}
	dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
	configPath = filepath.Join(dirProvider.EtcDir(), "blobstore-fake-provider.json")
	return
}
開發者ID:velankanisys,項目名稱:bosh,代碼行數:8,代碼來源:external_test.go

示例9: getBootstrapDependencies

func getBootstrapDependencies() (inf *fakeinf.FakeInfrastructure, platform *fakeplatform.FakePlatform, dirProvider boshdir.DirectoriesProvider) {
	inf = &fakeinf.FakeInfrastructure{}
	inf.GetEphemeralDiskPathFound = true
	inf.GetEphemeralDiskPathRealPath = "/dev/sdz"
	platform = fakeplatform.NewFakePlatform()
	dirProvider = boshdir.NewDirectoriesProvider("/var/vcap")
	return
}
開發者ID:nkuacac,項目名稱:bosh,代碼行數:8,代碼來源:bootstrap_test.go

示例10: init

func init() {
	Describe("dummyInfrastructure", func() {
		It("get settings", func() {
			fs := fakefs.NewFakeFileSystem()
			dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
			platform := fakeplatform.NewFakePlatform()
			fakeDevicePathResolver := fakedpresolv.NewFakeDevicePathResolver(1*time.Millisecond, platform.GetFs())

			settingsPath := filepath.Join(dirProvider.BoshDir(), "dummy-cpi-agent-env.json")

			expectedSettings := boshsettings.Settings{
				AgentID: "123-456-789",
				Blobstore: boshsettings.Blobstore{
					Type: boshsettings.BlobstoreTypeDummy,
				},
				Mbus: "nats://127.0.0.1:4222",
			}
			existingSettingsBytes, _ := json.Marshal(expectedSettings)
			fs.WriteFile(settingsPath, existingSettingsBytes)

			dummy := NewDummyInfrastructure(fs, dirProvider, platform, fakeDevicePathResolver)

			settings, err := dummy.GetSettings()
			Expect(err).ToNot(HaveOccurred())
			assert.Equal(GinkgoT(), settings, boshsettings.Settings{
				AgentID:   "123-456-789",
				Blobstore: boshsettings.Blobstore{Type: boshsettings.BlobstoreTypeDummy},
				Mbus:      "nats://127.0.0.1:4222",
			})
		})

		It("get settings errs when settings file does not exist", func() {
			fs := fakefs.NewFakeFileSystem()
			dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
			platform := fakeplatform.NewFakePlatform()
			fakeDevicePathResolver := fakedpresolv.NewFakeDevicePathResolver(1*time.Millisecond, platform.GetFs())

			dummy := NewDummyInfrastructure(fs, dirProvider, platform, fakeDevicePathResolver)

			_, err := dummy.GetSettings()
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("Read settings file"))
		})
	})
}
開發者ID:punalpatel,項目名稱:bosh,代碼行數:45,代碼來源:dummy_infrastructure_test.go

示例11: buildProvider

func buildProvider(mbusUrl string) (deps providerDeps, provider MbusHandlerProvider) {
	deps.settings = &fakesettings.FakeSettingsService{MbusUrl: mbusUrl}
	deps.logger = boshlog.NewLogger(boshlog.LEVEL_NONE)
	provider = NewHandlerProvider(deps.settings, deps.logger)

	deps.platform = fakeplatform.NewFakePlatform()
	deps.dirProvider = boshdir.NewDirectoriesProvider("/var/vcap")
	return
}
開發者ID:velankanisys,項目名稱:bosh,代碼行數:9,代碼來源:handler_provider_test.go

示例12: buildProvider

func buildProvider(mbusUrl string) (provider mbusHandlerProvider, platform *fakeplatform.FakePlatform, dirProvider boshdir.DirectoriesProvider) {
	settings := &fakesettings.FakeSettingsService{MbusUrl: mbusUrl}
	logger := boshlog.NewLogger(boshlog.LEVEL_NONE)
	provider = NewHandlerProvider(settings, logger)

	platform = fakeplatform.NewFakePlatform()
	dirProvider = boshdir.NewDirectoriesProvider("/var/vcap")
	return
}
開發者ID:UhuruSoftware,項目名稱:bosh_old,代碼行數:9,代碼來源:handler_provider_test.go

示例13: TestGetSettingsErrsWhenSettingsFileDoesNotExist

func TestGetSettingsErrsWhenSettingsFileDoesNotExist(t *testing.T) {
	fs := fakefs.NewFakeFileSystem()
	dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")

	dummy := newDummyInfrastructure(fs, dirProvider)

	_, err := dummy.GetSettings()
	assert.Error(t, err)
	assert.Contains(t, err.Error(), "Read settings file")
}
開發者ID:UhuruSoftware,項目名稱:bosh_old,代碼行數:10,代碼來源:dummy_infrastructure_test.go

示例14: TestNewDrainScript

func TestNewDrainScript(t *testing.T) {
	runner := fakesys.NewFakeCmdRunner()
	fs := fakesys.NewFakeFileSystem()
	dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")

	scriptProvider := NewConcreteDrainScriptProvider(runner, fs, dirProvider)
	drainScript := scriptProvider.NewDrainScript("foo")

	assert.Equal(t, drainScript.Path(), "/var/vcap/jobs/foo/bin/drain")
}
開發者ID:UhuruSoftware,項目名稱:bosh_old,代碼行數:10,代碼來源:concrete_drain_script_provider_test.go

示例15: buildService

func buildService(NTPData string) (service Service) {
	fs := fakefs.NewFakeFileSystem()
	dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")

	if NTPData != "" {
		fs.WriteToFile("/var/vcap/bosh/log/ntpdate.out", NTPData)
	}

	service = NewConcreteService(fs, dirProvider)
	return
}
開發者ID:nkuacac,項目名稱:bosh,代碼行數:11,代碼來源:service_test.go


注:本文中的bosh/settings/directories.NewDirectoriesProvider函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。