Пример #1
0
func (f *factory) loadReleaseSetParser() birelsetmanifest.Parser {
	if f.releaseSetParser != nil {
		return f.releaseSetParser
	}

	f.releaseSetParser = birelsetmanifest.NewParser(f.fs, f.logger, f.loadReleaseSetValidator())
	return f.releaseSetParser
}
			}

			target := biinstall.NewTarget(filepath.Join("fake-install-dir", "fake-installation-id"))
			mockInstallerFactory.EXPECT().NewInstaller(target).Return(mockCpiInstaller).AnyTimes()

			expectCPIInstall = mockCpiInstaller.EXPECT().Install(installationManifest, gomock.Any()).Do(func(_ biinstallmanifest.Manifest, stage biui.Stage) {
				Expect(fakeStage.SubStages).To(ContainElement(stage))
			}).Return(fakeInstallation, nil).AnyTimes()
			mockCpiInstaller.EXPECT().Cleanup(fakeInstallation).AnyTimes()

			expectNewCloud = mockCloudFactory.EXPECT().NewCloud(fakeInstallation, directorID).Return(mockCloud, nil).AnyTimes()
		}

		var newDeploymentDeleter = func() bicmd.DeploymentDeleter {
			releaseSetValidator := birelsetmanifest.NewValidator(logger)
			releaseSetParser := birelsetmanifest.NewParser(fs, logger, releaseSetValidator)
			installationValidator := biinstallmanifest.NewValidator(logger)
			installationParser := biinstallmanifest.NewParser(fs, fakeUUIDGenerator, logger, installationValidator)
			fakeHTTPClient := fakebihttpclient.NewFakeHTTPClient()
			tarballCache := bitarball.NewCache("fake-base-path", fs, logger)
			fakeSHA1Calculator := fakebicrypto.NewFakeSha1Calculator()
			tarballProvider := bitarball.NewProvider(tarballCache, fs, fakeHTTPClient, fakeSHA1Calculator, 1, 0, logger)
			deploymentStateService := biconfig.NewFileSystemDeploymentStateService(fs, fakeUUIDGenerator, logger, biconfig.DeploymentStatePath(deploymentManifestPath))

			cpiInstaller := bicpirel.CpiInstaller{
				ReleaseManager:   releaseManager,
				InstallerFactory: mockInstallerFactory,
				Validator:        bicpirel.NewValidator(),
			}
			releaseFetcher := birel.NewFetcher(tarballProvider, mockReleaseExtractor, releaseManager)
			releaseSetAndInstallationManifestParser := bicmd.ReleaseSetAndInstallationManifestParser{
Пример #3
0
var _ = Describe("Parser", func() {
	comboManifestPath := "/path/to/manifest/fake-deployment-manifest"
	var (
		fakeFs        *fakesys.FakeFileSystem
		parser        manifest.Parser
		fakeValidator *fakes.FakeValidator
	)

	BeforeEach(func() {
		fakeFs = fakesys.NewFakeFileSystem()
		logger := boshlog.NewLogger(boshlog.LevelNone)
		fakeValidator = fakes.NewFakeValidator()
		fakeValidator.SetValidateBehavior([]fakes.ValidateOutput{
			{Err: nil},
		})
		parser = manifest.NewParser(fakeFs, logger, fakeValidator)
		fakeFs.WriteFileString(comboManifestPath, `
---
releases:
- name: fake-release-name-1
  url: file://~/absolute-path/fake-release-1.tgz
  sha1: fake-sha1
- name: fake-release-name-2
  url: file:///absolute-path/fake-release-2.tgz
  sha1: fake-sha2
- name: fake-release-name-3
  url: file://relative-path/fake-release-3.tgz
  sha1: fake-sha3
- name: fake-release-name-4
  url: http://fake-url/fake-release-4.tgz
  sha1: fake-sha4