Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private int getLabelId(String labelName) throws org.neo4j.internal.kernel.api.exceptions.ProcedureException
        private int GetLabelId(string labelName)
        {
            int labelId = _ktx.tokenRead().nodeLabel(labelName);

            if (labelId == [email protected]_Fields.NO_TOKEN)
            {
                throw new ProcedureException(Org.Neo4j.Kernel.Api.Exceptions.Status_Schema.LabelAccessFailed, "No such label %s", labelName);
            }
            return(labelId);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws org.neo4j.internal.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            when(_transaction.tokenRead()).thenReturn(_tokenRead);
            when(_bridge.get()).thenReturn(_stmt);
            when(_tokenRead.propertyKeyName(anyInt())).thenAnswer(invocationOnMock =>
            {
                int id = invocationOnMock.getArgument(0);
                return(_ops.propertyKeyTokenHolder().getTokenById(id).name());
            });
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _transaction   = mock(typeof(KernelTransaction));
            _tokenRead     = mock(typeof(TokenRead));
            _schemaRead    = mock(typeof(SchemaRead));
            _procedure     = new IndexProcedures(_transaction, null);
            _descriptor    = SchemaDescriptorFactory.forLabel(123, 456);
            _anyDescriptor = SchemaDescriptorFactory.forLabel(0, 0);
            _anyIndex      = forSchema(_anyDescriptor);
            when(_transaction.tokenRead()).thenReturn(_tokenRead);
            when(_transaction.schemaRead()).thenReturn(_schemaRead);
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _procs.registerComponent(typeof(KernelTransaction), ctx => ctx.get(KERNEL_TRANSACTION), false);
            _procs.registerComponent(typeof(DependencyResolver), ctx => ctx.get(_dependencyResolver), false);
            _procs.registerComponent(typeof(GraphDatabaseAPI), ctx => ctx.get(_graphdatabaseapi), false);
            _procs.registerComponent(typeof(SecurityContext), ctx => ctx.get(SECURITY_CONTEXT), true);

            _procs.registerComponent(typeof(Log), ctx => ctx.get(_log), false);
            _procs.registerType(typeof(Node), NTNode);
            _procs.registerType(typeof(Relationship), NTRelationship);
            _procs.registerType(typeof(Path), NTPath);

            (new SpecialBuiltInProcedures("1.3.37", Edition.enterprise.ToString())).accept(_procs);
            _procs.registerProcedure(typeof(BuiltInProcedures));
            _procs.registerProcedure(typeof(BuiltInDbmsProcedures));

            when(_tx.acquireStatement()).thenReturn(_statement);
            when(_tx.tokenRead()).thenReturn(_tokens);
            when(_tx.dataRead()).thenReturn(_read);
            when(_tx.schemaRead()).thenReturn(_schemaRead);
            when(_schemaRead.snapshot()).thenReturn(_schemaReadCore);

            when(_tokens.propertyKeyGetAllTokens()).thenAnswer(AsTokens(_propKeys));
            when(_tokens.labelsGetAllTokens()).thenAnswer(AsTokens(_labels));
            when(_tokens.relationshipTypesGetAllTokens()).thenAnswer(AsTokens(_relTypes));
            when(_schemaReadCore.indexesGetAll()).thenAnswer(i => Iterators.concat(_indexes.GetEnumerator(), _uniqueIndexes.GetEnumerator()));
            when(_schemaReadCore.index(any(typeof(SchemaDescriptor)))).thenAnswer((Answer <IndexReference>)invocationOnMock =>
            {
                SchemaDescriptor schema = invocationOnMock.getArgument(0);
                int label = Schema.keyId();
                int prop  = Schema.PropertyId;
                return(GetIndexReference(label, prop));
            });
            when(_schemaReadCore.constraintsGetAll()).thenAnswer(i => _constraints.GetEnumerator());

            when(_tokens.propertyKeyName(anyInt())).thenAnswer(invocation => _propKeys[invocation.getArgument(0)]);
            when(_tokens.nodeLabelName(anyInt())).thenAnswer(invocation => _labels[invocation.getArgument(0)]);
            when(_tokens.relationshipTypeName(anyInt())).thenAnswer(invocation => _relTypes[invocation.getArgument(0)]);

            when(_indexingService.getIndexId(any(typeof(SchemaDescriptor)))).thenReturn(42L);

            when(_schemaReadCore.constraintsGetForRelationshipType(anyInt())).thenReturn(emptyIterator());
            when(_schemaReadCore.indexesGetForLabel(anyInt())).thenReturn(emptyIterator());
            when(_schemaReadCore.indexesGetForRelationshipType(anyInt())).thenReturn(emptyIterator());
            when(_schemaReadCore.constraintsGetForLabel(anyInt())).thenReturn(emptyIterator());
            when(_read.countsForNode(anyInt())).thenReturn(1L);
            when(_read.countsForRelationship(anyInt(), anyInt(), anyInt())).thenReturn(1L);
            when(_schemaReadCore.indexGetState(any(typeof(IndexReference)))).thenReturn(InternalIndexState.ONLINE);
        }
Пример #5
0
        public virtual Stream <RetrieveResult> RetrieveAllAnonymized(string graphToken, IDictionary <string, object> config)
        {
            if (string.ReferenceEquals(graphToken, null) || graphToken.Equals(""))
            {
                throw new InvalidArgumentsException("Graph token must be a non-empty string");
            }

            return(Stream.of(MetaSection.Retrieve(graphToken, DataCollector.kernel, DataCollector.queryCollector.numSilentQueryDrops()), GraphCountsSection.Retrieve(DataCollector.kernel, Anonymizer.IDS), QueriesSection.retrieve(DataCollector.queryCollector.Data, new IdAnonymizer(Transaction.tokenRead()), RetrieveConfig.Of(config).MaxInvocations)).flatMap(x => x));
        }
Пример #6
0
 public override TokenRead TokenRead()
 {
     return(Internal.tokenRead());
 }