Ejemplo n.º 1
0
        public void SetUp()
        {
            fakeDependenciesLayerConfiguration =
                MakeLayerConfiguration(
                    "core/application/dependencies", EXTRACTION_PATH_ROOT.Resolve("libs"));
            fakeSnapshotDependenciesLayerConfiguration =
                MakeLayerConfiguration(
                    "core/application/snapshot-dependencies", EXTRACTION_PATH_ROOT.Resolve("libs"));
            fakeResourcesLayerConfiguration =
                MakeLayerConfiguration(
                    "core/application/resources", EXTRACTION_PATH_ROOT.Resolve("resources"));
            fakeClassesLayerConfiguration =
                MakeLayerConfiguration("core/application/classes", EXTRACTION_PATH_ROOT.Resolve("classes"));
            fakeExtraFilesLayerConfiguration =
                LayerConfiguration.CreateBuilder()
                .AddEntry(
                    Paths.Get(TestResources.GetResource("core/fileA").ToURI()),
                    EXTRA_FILES_LAYER_EXTRACTION_PATH.Resolve("fileA"))
                .AddEntry(
                    Paths.Get(TestResources.GetResource("core/fileB").ToURI()),
                    EXTRA_FILES_LAYER_EXTRACTION_PATH.Resolve("fileB"))
                .Build();
            emptyLayerConfiguration = LayerConfiguration.CreateBuilder().Build();

            cache = LayersCache.WithDirectory(temporaryFolder.NewFolder().ToPath());

            Mock.Get(mockBuildConfiguration).Setup(m => m.GetEventHandlers()).Returns(mockEventHandlers);

            Mock.Get(mockBuildConfiguration).Setup(m => m.GetApplicationLayersCache()).Returns(cache);
        }
Ejemplo n.º 2
0
        public void TestResolve_relativeUnixPath()
        {
            AbsoluteUnixPath absoluteUnixPath1 = AbsoluteUnixPath.Get("/");

            Assert.AreEqual(absoluteUnixPath1, absoluteUnixPath1.Resolve(""));
            Assert.AreEqual("/file", absoluteUnixPath1.Resolve("file").ToString());
            Assert.AreEqual("/relative/path", absoluteUnixPath1.Resolve("relative/path").ToString());

            AbsoluteUnixPath absoluteUnixPath2 = AbsoluteUnixPath.Get("/some/path");

            Assert.AreEqual(absoluteUnixPath2, absoluteUnixPath2.Resolve(""));
            Assert.AreEqual("/some/path/file", absoluteUnixPath2.Resolve("file").ToString());
            Assert.AreEqual(
                "/some/path/relative/path", absoluteUnixPath2.Resolve("relative/path").ToString());
        }
Ejemplo n.º 3
0
 /**
  * Lists the files in the {@code resourcePath} resources directory and creates a {@link
  * LayerConfiguration} with entries from those files.
  */
 private static ILayerConfiguration MakeLayerConfiguration(
     string resourcePath, AbsoluteUnixPath extractionPath)
 {
     IEnumerable <SystemPath> fileStream =
         Files.List(Paths.Get(TestResources.GetResource(resourcePath).ToURI()));
     {
         LayerConfiguration.Builder layerConfigurationBuilder = LayerConfiguration.CreateBuilder();
         layerConfigurationBuilder.SetName(Path.GetFileName(resourcePath));
         foreach (SystemPath i in fileStream)
         {
             ((Func <SystemPath, LayerConfiguration.Builder>)(sourceFile =>
                                                              layerConfigurationBuilder.AddEntry(
                                                                  sourceFile, extractionPath.Resolve(sourceFile.GetFileName()))))(i);
         }
         return(layerConfigurationBuilder.Build());
     }
 }