public void CannotCreateNewPigJob_WithRestrictedCharacters_StartJob() { var pigJobDefinition = new PigJobCreateParameters { Query = "load table from 'A' %" }; INewAzureHDInsightPigJobDefinitionCommand newMapReduceJobDefinitionCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewPigJobDefinition(); newMapReduceJobDefinitionCommand.Query = pigJobDefinition.Query; newMapReduceJobDefinitionCommand.EndProcessing(); AzureHDInsightPigJobDefinition pigJobFromCommand = newMapReduceJobDefinitionCommand.Output.ElementAt(0); try { TestJobStart(pigJobFromCommand); Assert.Fail(); } catch (AggregateException aggregateException) { var invalidOperationException = aggregateException.GetBaseException() as InvalidOperationException; Assert.IsNotNull(invalidOperationException); Assert.AreEqual("Query text contains restricted character '%', please upload the query to a file in storage and re-submit the job using the -File parameter", invalidOperationException.Message); } }
public void CanCreateNewPigDefinition_WithResources() { var pigJobDefinition = new PigJobCreateParameters { Query = "load 'passwd' using PigStorage(':'); B = foreach A generate $0 as id;" }; pigJobDefinition.Files.Add("pidata.txt"); pigJobDefinition.Files.Add("pidate2.txt"); INewAzureHDInsightPigJobDefinitionCommand newPigJobDefinitionCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewPigJobDefinition(); newPigJobDefinitionCommand.Query = pigJobDefinition.Query; newPigJobDefinitionCommand.Files = pigJobDefinition.Files.ToArray(); newPigJobDefinitionCommand.EndProcessing(); AzureHDInsightPigJobDefinition pigJobFromCommand = newPigJobDefinitionCommand.Output.ElementAt(0); Assert.AreEqual(pigJobDefinition.Query, pigJobFromCommand.Query); foreach (string resource in pigJobDefinition.Files) { Assert.IsTrue( pigJobFromCommand.Files.Any(arg => string.Equals(resource, arg)), "Unable to find File '{0}' in value returned from command", resource); } }
public void CanCreateNewPigDefinition_WithArguments() { var pigJobDefinition = new PigJobCreateParameters { Query = "load 'passwd' using PigStorage(':'); B = foreach A generate $0 as id;" }; pigJobDefinition.Arguments.Add("map.input.tasks=1000"); pigJobDefinition.Arguments.Add("map.input.reducers=1000"); INewAzureHDInsightPigJobDefinitionCommand newPigJobDefinitionCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewPigJobDefinition(); newPigJobDefinitionCommand.Query = pigJobDefinition.Query; newPigJobDefinitionCommand.Arguments = pigJobDefinition.Arguments.ToArray(); newPigJobDefinitionCommand.EndProcessing(); AzureHDInsightPigJobDefinition pigJobFromCommand = newPigJobDefinitionCommand.Output.ElementAt(0); Assert.AreEqual(pigJobDefinition.Query, pigJobFromCommand.Query); foreach (string parameter in pigJobDefinition.Arguments) { Assert.IsTrue( pigJobFromCommand.Arguments.Any(arg => string.Equals(parameter, arg)), "Unable to find parameter '{0}' in value returned from command", parameter); } }
public void CannotCreateNewPigJob_WithRestrictedCharacters_StartJob() { var pigJobDefinition = new PigJobCreateParameters { Query = "load table from 'A' %" }; INewAzureHDInsightPigJobDefinitionCommand newMapReduceJobDefinitionCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewPigJobDefinition(); newMapReduceJobDefinitionCommand.Query = pigJobDefinition.Query; newMapReduceJobDefinitionCommand.EndProcessing(); AzureHDInsightPigJobDefinition pigJobFromCommand = newMapReduceJobDefinitionCommand.Output.ElementAt(0); try { TestJobStart(pigJobFromCommand); Assert.Fail(); } catch (AggregateException aggregateException) { var invalidOperationException = aggregateException.GetBaseException() as InvalidOperationException; Assert.IsNotNull(invalidOperationException); Assert.IsTrue(invalidOperationException.Message.Contains("Query contains restricted character :'%'"), "Exception not thrown for special character"); } }
public void CanCreateNewPigJob_StartJob() { var pigJobDefinition = new PigJobCreateParameters { Query = "load table from 'A'" }; INewAzureHDInsightPigJobDefinitionCommand newMapReduceJobDefinitionCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewPigJobDefinition(); newMapReduceJobDefinitionCommand.Query = pigJobDefinition.Query; newMapReduceJobDefinitionCommand.EndProcessing(); AzureHDInsightPigJobDefinition pigJobFromCommand = newMapReduceJobDefinitionCommand.Output.ElementAt(0); TestJobStart(pigJobFromCommand); }
public void CanCreateNewPigDefinition() { var pigJobDefinition = new PigJobCreateParameters { Query = "load 'passwd' using PigStorage(':'); B = foreach A generate $0 as id;" }; INewAzureHDInsightPigJobDefinitionCommand newPigJobDefinitionCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewPigJobDefinition(); newPigJobDefinitionCommand.Query = pigJobDefinition.Query; newPigJobDefinitionCommand.EndProcessing(); AzureHDInsightPigJobDefinition pigJobFromCommand = newPigJobDefinitionCommand.Output.ElementAt(0); Assert.AreEqual(pigJobDefinition.Query, pigJobFromCommand.Query); }
/// <summary> /// Initializes a new instance of the NewAzureHDInsightPigDefinitionCmdlet class. /// </summary> public NewAzureHDInsightPigDefinitionCmdlet() { this.command = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewPigJobDefinition(); }
/// <summary> /// Initializes a new instance of the NewAzureHDInsightPigDefinitionCmdlet class. /// </summary> public NewAzureHDInsightPigDefinitionCmdlet() { this.command = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateNewPigJobDefinition(); }