示例#1
0
def is_operation_supported(gc):
    # Is operation supported
    operation = 'uk.gov.gchq.gaffer.operation.impl.add.AddElements'
    result = gc.is_operation_supported(
        g.IsOperationSupported(operation=operation)
    )

    print(
        '\nOperation supported ("uk.gov.gchq.gaffer.operation.impl.add.AddElements"):')
    print(result)
    print()
    def test_is_operation_supported(self):
        gc = gaffer_connector.GafferConnector(
            'http://localhost:8080/rest/latest')

        response_text = gc.is_operation_supported(
            g.IsOperationSupported(
                operation='uk.gov.gchq.gaffer.operation.impl.get.GetAllElements'
            ))

        expected_response_text = '''
        {
          "name": "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements",
          "summary": "Gets all elements compatible with a provided View",
          "fields": [
            {
              "name": "view",
              "className": "uk.gov.gchq.gaffer.data.elementdefinition.view.View",
              "required": false
            },
            {
              "name": "options",
              "className": "java.util.Map<java.lang.String,java.lang.String>",
              "required": false
            },
            {
              "name": "directedType",
              "summary": "Is the Edge directed?",
              "className": "java.lang.String",
              "options": [
                "DIRECTED",
                "UNDIRECTED",
                "EITHER"
              ],
              "required": false
            },
            {
              "name": "views",
              "className": "java.util.List<uk.gov.gchq.gaffer.data.elementdefinition.view.View>",
              "required": false
            }
          ],
          "next": [
            "uk.gov.gchq.gaffer.operation.impl.add.AddElements",
            "uk.gov.gchq.gaffer.operation.impl.get.GetElements",
            "uk.gov.gchq.gaffer.operation.impl.get.GetAdjacentIds",
            "uk.gov.gchq.gaffer.operation.impl.export.set.ExportToSet",
            "uk.gov.gchq.gaffer.operation.impl.output.ToArray",
            "uk.gov.gchq.gaffer.operation.impl.output.ToEntitySeeds",
            "uk.gov.gchq.gaffer.operation.impl.output.ToList",
            "uk.gov.gchq.gaffer.operation.impl.output.ToMap",
            "uk.gov.gchq.gaffer.operation.impl.output.ToCsv",
            "uk.gov.gchq.gaffer.operation.impl.output.ToSet",
            "uk.gov.gchq.gaffer.operation.impl.output.ToStream",
            "uk.gov.gchq.gaffer.operation.impl.output.ToVertices",
            "uk.gov.gchq.gaffer.named.operation.NamedOperation",
            "uk.gov.gchq.gaffer.operation.impl.compare.Max",
            "uk.gov.gchq.gaffer.operation.impl.compare.Min",
            "uk.gov.gchq.gaffer.operation.impl.compare.Sort",
            "uk.gov.gchq.gaffer.operation.impl.GetWalks",
            "uk.gov.gchq.gaffer.operation.impl.generate.GenerateElements",
            "uk.gov.gchq.gaffer.operation.impl.generate.GenerateObjects",
            "uk.gov.gchq.gaffer.operation.impl.Validate",
            "uk.gov.gchq.gaffer.operation.impl.Count",
            "uk.gov.gchq.gaffer.operation.impl.CountGroups",
            "uk.gov.gchq.gaffer.operation.impl.Limit",
            "uk.gov.gchq.gaffer.operation.impl.DiscardOutput",
            "uk.gov.gchq.gaffer.operation.impl.Map",
            "uk.gov.gchq.gaffer.operation.impl.If",
            "uk.gov.gchq.gaffer.operation.impl.While",
            "uk.gov.gchq.gaffer.operation.impl.ForEach",
            "uk.gov.gchq.gaffer.operation.impl.output.ToSingletonList",
            "uk.gov.gchq.gaffer.operation.impl.Reduce",
            "uk.gov.gchq.gaffer.operation.impl.join.Join",
            "uk.gov.gchq.gaffer.operation.impl.SetVariable",
            "uk.gov.gchq.gaffer.operation.impl.function.Filter",
            "uk.gov.gchq.gaffer.operation.impl.function.Transform",
            "uk.gov.gchq.gaffer.operation.impl.function.Aggregate",
            "uk.gov.gchq.gaffer.mapstore.operation.CountAllElementsDefaultView",
            "uk.gov.gchq.gaffer.operation.export.graph.ExportToOtherAuthorisedGraph",
            "uk.gov.gchq.gaffer.operation.export.graph.ExportToOtherGraph",
            "uk.gov.gchq.gaffer.operation.impl.export.resultcache.ExportToGafferResultCache"
          ],
          "exampleJson": {
            "class": "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
          },
          "outputClassName": "uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable<uk.gov.gchq.gaffer.data.element.Element>"
        }
            '''

        self.assertEqual(json.loads(expected_response_text),
                         json.loads(response_text))