Exemplo n.º 1
0
        public PSTable(Table table)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }

            if (table.Properties == null)
            {
                table.Properties = new TableProperties();
            }

            this.table = table;
        }
Exemplo n.º 2
0
        public PSDataset(Table dataset)
        {
            if (dataset == null)
            {
                throw new ArgumentNullException("dataset");
            }

            if (dataset.Properties == null)
            {
                dataset.Properties = new TableProperties();
            }

            this.dataset = dataset;
        }
Exemplo n.º 3
0
        // ToDo: enable the tests when we can set readonly provisioning state in test
        //[Fact]
        //[Trait(Category.AcceptanceType, Category.CheckIn)]
        public void CanCreateDataset()
        {
            // Arrange
            Table expected = new Table()
            {
                Name = datasetName,
                Properties = new TableProperties()
            };

            dataFactoriesClientMock.Setup(c => c.ReadJsonFileContent(It.IsAny<string>()))
                .Returns(rawJsonContent)
                .Verifiable();

            dataFactoriesClientMock.Setup(
                c =>
                    c.CreatePSDataset(
                        It.Is<CreatePSDatasetParameters>(
                            parameters =>
                                parameters.Name == datasetName &&
                                parameters.ResourceGroupName == ResourceGroupName &&
                                parameters.DataFactoryName == DataFactoryName)))
                .CallBase()
                .Verifiable();

            dataFactoriesClientMock.Setup(
                c =>
                    c.CreateOrUpdateDataset(ResourceGroupName, DataFactoryName, datasetName, rawJsonContent))
                .Returns(expected)
                .Verifiable();
            
            // Action
            cmdlet.File = filePath;
            cmdlet.Force = true;
            cmdlet.ExecuteCmdlet();

            // Assert
            dataFactoriesClientMock.VerifyAll();

            commandRuntimeMock.Verify(
                f =>
                    f.WriteObject(
                        It.Is<PSDataset>(
                            tbl =>
                                ResourceGroupName == tbl.ResourceGroupName &&
                                DataFactoryName == tbl.DataFactoryName &&
                                expected.Name == tbl.DatasetName)),
                Times.Once());
        }
Exemplo n.º 4
0
        private static string GetFolderPath(Table dataArtifact)
        {
            AzureBlobLocation blobLocation;
            if (dataArtifact == null || dataArtifact.Properties == null)
            {
                return null;
            }

            blobLocation = dataArtifact.Properties.Location as AzureBlobLocation;
            if (blobLocation == null)
            {
                return null;
            }

            return blobLocation.FolderPath;
        }
Exemplo n.º 5
0
 public PSTable()
 {
     table = new Table() {Properties = new TableProperties()};
 }
Exemplo n.º 6
0
        public void CanThrowIfDatasetProvisioningFailed()
        {
            // Arrange
            Table expected = new Table()
            {
                Name = datasetName,
                Properties = new TableProperties()
            };

            dataFactoriesClientMock.Setup(c => c.ReadJsonFileContent(It.IsAny<string>()))
                .Returns(rawJsonContent)
                .Verifiable();

            dataFactoriesClientMock.Setup(
                c =>
                    c.CreatePSDataset(
                        It.Is<CreatePSDatasetParameters>(
                            parameters =>
                                parameters.Name == datasetName &&
                                parameters.ResourceGroupName == ResourceGroupName &&
                                parameters.DataFactoryName == DataFactoryName)))
                .CallBase()
                .Verifiable();

            dataFactoriesClientMock.Setup(
                c =>
                    c.CreateOrUpdateDataset(ResourceGroupName, DataFactoryName, datasetName, rawJsonContent))
                .Returns(expected)
                .Verifiable();

            // Action
            cmdlet.File = filePath;
            cmdlet.Force = true;
            
            // Assert
            Assert.Throws<ProvisioningFailedException>(() => cmdlet.ExecuteCmdlet());
        }
Exemplo n.º 7
0
        // Get Folder Path for table
        private static string GetFolderPath(Table table)
        {
            if (table == null || table.Properties == null)
            {
                return null;
            }

            AzureBlobLocation blobLocation = table.Properties.Location as AzureBlobLocation;
            if (blobLocation == null)
            {
                return null;
            }

            return blobLocation.FolderPath + blobLocation.FileName;
        }
Exemplo n.º 8
0
 public PSDataset()
 {
     this.dataset = new Table() {Properties = new TableProperties()};
 }