Esempio n. 1
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()
        {
            _master = mock( typeof( Master ), new LockedOnMasterAnswer() );
              _lockManager = new ForsetiLockManager( Config.defaults(), Clocks.systemClock(), ResourceTypes.values() );
              _requestContextFactory = mock( typeof( RequestContextFactory ) );
              _databaseAvailabilityGuard = new DatabaseAvailabilityGuard( GraphDatabaseSettings.DEFAULT_DATABASE_NAME, Clocks.systemClock(), mock(typeof(Log)) );

              when( _requestContextFactory.newRequestContext( Mockito.anyInt() ) ).thenReturn(RequestContext.anonymous(1));
        }
Esempio n. 2
0
 public override int CreateToken(string name)
 {
     try
     {
         using (Response <int> response = Create(_master, _requestContextFactory.newRequestContext(), name))
         {
             return(response.ResponseConflict());
         }
     }
     catch (ComException e)
     {
         throw new TransientTransactionFailureException("Cannot create identifier for token '" + name + "' on the master " + _master + ". " + "The master is either down, or we have network connectivity problems", e);
     }
 }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long commit(org.neo4j.kernel.impl.api.TransactionToApply batch, org.neo4j.kernel.impl.transaction.tracing.CommitEvent commitEvent, org.neo4j.storageengine.api.TransactionApplicationMode mode) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        public override long Commit(TransactionToApply batch, CommitEvent commitEvent, TransactionApplicationMode mode)
        {
            if (batch.Next() != null)
            {
                throw new System.ArgumentException("Only supports single-commit on slave --> master");
            }

            try
            {
                TransactionRepresentation representation = batch.TransactionRepresentation();
                RequestContext            context        = _requestContextFactory.newRequestContext(representation.LockSessionId);
                using (Response <long> response = _master.commit(context, representation))
                {
                    return(response.ResponseConflict());
                }
            }
            catch (ComException e)
            {
                throw new TransientTransactionFailureException("Cannot commit this transaction on the master. " + "The master is either down, or we have network connectivity problems.", e);
            }
        }