public static bool ToStoreThrowsForNonQuery() { bool passed = true; try { int[] data = new[] { 1, 2, 3 }; var q1 = data.AsQueryable().Select(x => 100 + x).ToStore<int>(AzureUtils.ToAzureUri(Config.accountName, Config.storageKey, Config.containerName, "dummy")).ToArray(); //Should throw as we got into DryadLinq via AsQueryable() rather than via context. passed &= false; } catch (ArgumentException) { //expected } return passed; }
public static bool ToStoreThrowsForNonQuery(DryadLinqContext context) { string testName = "ToStoreThrowsForNonQuery"; TestLog.TestStart(testName); bool passed = true; try { int[] data = new[] { 1, 2, 3 }; var q1 = data.AsQueryable().Select(x => 100 + x).ToStore<int>(AzureUtils.ToAzureUri(Config.accountName, Config.storageKey, Config.containerName, "dummy")).ToArray(); //Should throw as we got into DryadLinq via AsQueryable() rather than via context. passed &= false; } catch (Exception Ex) { //expected } TestLog.LogResult(new TestResult(testName, context, passed)); return passed; }
public static bool Bug14870_LongIndexTakeWhile(DryadLinqContext context) { string testName = "Bug14870_LongIndexTakeWhile"; TestLog.TestStart(testName); bool passed = true; try { IEnumerable<int>[] result = new IEnumerable<int>[2]; // cluster { context.LocalDebug = false; // ToDo - move to data generator int[][] data = new[] { new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, new int[] { }, new int[] { } }; IQueryable<int> pt1 = DataGenerator.GetSimpleFileSets(context); var output = pt1.LongTakeWhile((x, i) => i < 8).ToArray(); passed &= (output.Length == 8); // "Only eight items should be returned." } } catch (Exception Ex) { TestLog.Message("Error: " + Ex.Message); passed &= false; } TestLog.LogResult(new TestResult(testName, context, passed)); return passed; }
public static bool Bug_16341_VariousTestsForSubmit() { var context = new DryadLinqContext(Config.cluster); context.LocalExecution = false; bool passed = true; try { int[] data = new[] { 1, 2, 3 }; var badQ1 = data.AsQueryable().Select(x => 100 + x); var badQ2 = data.AsQueryable().Select(x => 100 + x); IQueryable<LineRecord> input = context.FromStore<LineRecord>(AzureUtils.ToAzureUri(Config.accountName, Config.containerName, "unittest/inputdata/SimpleFile.txt")); IQueryable<IEnumerable<int>> simple = input.Apply(x => DataGenerator.CreateSimpleFileSets()); IQueryable<int> goodQ1 = simple.Select(x => x.First()); IQueryable<LineRecord> input_copy = context.FromStore<LineRecord>(AzureUtils.ToAzureUri(Config.accountName, Config.containerName, "unittest/inputdata/SimpleFile.txt")); IQueryable<IEnumerable<int>> simple_copy = input_copy.Apply(x => DataGenerator.CreateSimpleFileSets()); IQueryable<int> goodQ2 = simple_copy.Select(x => x.First()); try { badQ1.Submit(); passed &= false; // "should throw as input isn't a L2H query" } catch (ArgumentException) { } try { DryadLinqQueryable.Submit((IQueryable)null); //this-Query overload passed &= false; // "should throw ArgNull as input is null" } catch (ArgumentException) { //although we pass null, it goes to params[] overload which creates an actual array[1] containing one null //hence we throw ArgumentException rather than ArgumentNullException. } try { DryadLinqQueryable.Submit((IQueryable[])null); //multi-query overload passed &= false; // "should throw ArgNull as input is null" } catch (ArgumentNullException) { } try { DryadLinqQueryable.Submit(goodQ1, null); //multi-query overload passed &= false; // "should throw ArgEx as one of the inputs is null" } catch (ArgumentException) { } try { DryadLinqQueryable.Submit(goodQ1, badQ1); //multi-query overload passed &= false; // "should throw ArgEx as one of the inputs is not a L2H" } catch (ArgumentException) { } //---------- // same tests again for SubmitAndWait try { badQ1.SubmitAndWait(); passed &= false; // "should throw as input isn't a L2H query" } catch (ArgumentException) { } try { DryadLinqQueryable.SubmitAndWait((IQueryable)null); //this-Query overload passed &= false; // "should throw ArgNull as input is null" } catch (ArgumentException) { //although we pass null, it goes to params[] overload which creates an actual array[1] containing one null //hence we throw ArgumentException rather than ArgumentNullException. } try { DryadLinqQueryable.SubmitAndWait((IQueryable[])null); //multi-query overload passed &= false; // "should throw ArgNull as input is null" } catch (ArgumentNullException) { } try { DryadLinqQueryable.SubmitAndWait(goodQ1, null); //multi-query overload passed &= false; // "should throw ArgEx as one of the inputs is null" } catch (ArgumentException) { } try { DryadLinqQueryable.SubmitAndWait(goodQ1, badQ1); //multi-query overload passed &= false; // "should throw ArgEx as one of the inputs is not a L2H" } catch (ArgumentException) { } } catch (DryadLinqException) { } return passed; }
public static bool Bug_16341_VariousTestsForSubmit(DryadLinqContext context) { string testName = "Bug_16341_VariousTestsForSubmit"; TestLog.TestStart(testName); bool passed = true; try { int[] data = new[] { 1, 2, 3 }; var badQ1 = data.AsQueryable().Select(x => 100 + x); var badQ2 = data.AsQueryable().Select(x => 100 + x); IQueryable<int> goodQ1 = DataGenerator.GetSimpleFileSets(context); try { badQ1.Submit(); passed &= false; // "should throw as input isn't a L2H query" } catch (ArgumentException) { } try { DryadLinqQueryable.Submit((IQueryable)null); //this-Query overload passed &= false; // "should throw ArgNull as input is null" } catch (ArgumentException) { //although we pass null, it goes to params[] overload which creates an actual array[1] containing one null //hence we throw ArgumentException rather than ArgumentNullException. } try { DryadLinqQueryable.Submit((IQueryable[])null); //multi-query overload passed &= false; // "should throw ArgNull as input is null" } catch (ArgumentNullException) { } try { DryadLinqQueryable.Submit(goodQ1, null); //multi-query overload passed &= false; // "should throw ArgEx as one of the inputs is null" } catch (ArgumentException) { } try { DryadLinqQueryable.Submit(goodQ1, badQ1); //multi-query overload passed &= false; // "should throw ArgEx as one of the inputs is not a L2H" } catch (ArgumentException) { } //---------- // same tests again for SubmitAndWait try { badQ1.SubmitAndWait(); passed &= false; // "should throw as input isn't a L2H query" } catch (ArgumentException) { } try { DryadLinqQueryable.SubmitAndWait((IQueryable)null); //this-Query overload passed &= false; // "should throw ArgNull as input is null" } catch (ArgumentException) { //although we pass null, it goes to params[] overload which creates an actual array[1] containing one null //hence we throw ArgumentException rather than ArgumentNullException. } try { DryadLinqQueryable.SubmitAndWait((IQueryable[])null); //multi-query overload passed &= false; // "should throw ArgNull as input is null" } catch (ArgumentNullException) { } try { DryadLinqQueryable.SubmitAndWait(goodQ1, null); //multi-query overload passed &= false; // "should throw ArgEx as one of the inputs is null" } catch (ArgumentException) { } try { DryadLinqQueryable.SubmitAndWait(goodQ1, badQ1); //multi-query overload passed &= false; // "should throw ArgEx as one of the inputs is not a L2H" } catch (ArgumentException) { } } catch (Exception) { } TestLog.LogResult(new TestResult(testName, context, passed)); return passed; }