Exemplo n.º 1
0
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql_object_with_referenced_variable_with_multiple_values_in_all_entities()
        {
            var fakeVariableValues = CreateFakeMultipleVariableValues();
            var fakeVariables      = VariableHelper.CreateEvaluatedVariables("oval:modulo:obj:5050", fakeVariableValues);
            var fakeObject         = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5050");

            var itemsToCollect = new SqlItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            Assert.AreEqual(16, itemsToCollect.Count());
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(0), "postgres", "8", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(1), "postgres", "8", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(2), "postgres", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(3), "postgres", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(4), "postgres", "2", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(5), "postgres", "2", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(6), "postgres", "2", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(7), "postgres", "2", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);

            AssertSqlItem((sql_item)itemsToCollect.ElementAt(8), "db2", "8", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(9), "db2", "8", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(10), "db2", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(11), "db2", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(12), "db2", "2", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(13), "db2", "2", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(14), "db2", "2", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(15), "db2", "2", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
        }
Exemplo n.º 2
0
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql_object_with_referenced_variable_on_version_entity()
        {
            var fakeVariables = VariableHelper.CreateVariableWithOneValue("5020", "5020", "9");
            var fakeObject    = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5020");

            var itemsToCollect = new SqlItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            AssertSqlItem((sql_item)itemsToCollect.Single());
        }
Exemplo n.º 3
0
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql_object()
        {
            var fakeObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5000");

            var itemsToCollect = new SqlItemTypeGenerator().GetItemsToCollect(fakeObject, VariableHelper.CreateEmptyEvaluatedVariables());

            Assert.IsNotNull(itemsToCollect);
            ItemTypeChecker.DoBasicAssertForItems(itemsToCollect.ToArray(), 1, typeof(sql_item));
            AssertSqlItem((sql_item)itemsToCollect.Single());
        }
Exemplo n.º 4
0
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql_object_with_referenced_variable_with_multiple_values_on_engine_entity()
        {
            var fakeVariables = VariableHelper.CreateVariableWithMultiplesValue("5010", "5010", new string[] { "oracle", "sqlserver" });
            var fakeObject    = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5010");

            var itemsToCollect = new SqlItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            Assert.AreEqual(2, itemsToCollect.Count());
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(0), "oracle");
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(1), "sqlserver");
        }
Exemplo n.º 5
0
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql_object_with_referenced_variable_in_all_entities()
        {
            var fakeVariableValues = CreateFakeVariableValues();
            var fakeVariables      = VariableHelper.CreateEvaluatedVariables("oval:modulo:obj:5050", fakeVariableValues);
            var fakeObject         = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5050");

            var itemsToCollect = new SqlItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            Assert.AreEqual(1, itemsToCollect.Count());
            AssertSqlItem((sql_item)itemsToCollect.Single(), "postgres", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
        }
Exemplo n.º 6
0
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql_object_with_referenced_variable_with_multiple_values_on_sql_entity()
        {
            var fakeConnectionStrings = new string[] { FAKE_SQL_QUERY, FAKE_SQL_QUERY2 };
            var fakeVariables         = VariableHelper.CreateVariableWithMultiplesValue("5040", "5040", fakeConnectionStrings);
            var fakeObject            = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5040");

            var itemsToCollect = new SqlItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            Assert.AreEqual(2, itemsToCollect.Count());
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(0), "oracle", "9", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSqlItem((sql_item)itemsToCollect.ElementAt(1), "oracle", "9", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
        }