//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldUseLastKnownOnlineClusterMemberAndSetTimeoutForCatchup() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldUseLastKnownOnlineClusterMemberAndSetTimeoutForCatchup() { // Given LearnerState state = LearnerState.Learner; LearnerContext ctx = mock(typeof(LearnerContext)); MessageHolder outgoing = mock(typeof(MessageHolder)); Org.Neo4j.cluster.InstanceId upToDateClusterMember = new Org.Neo4j.cluster.InstanceId(1); // What we know when(ctx.LastLearnedInstanceId).thenReturn(0L); when(ctx.GetPaxosInstance(new Org.Neo4j.cluster.protocol.atomicbroadcast.multipaxos.InstanceId(1L))).thenReturn(new PaxosInstance(null, new Org.Neo4j.cluster.protocol.atomicbroadcast.multipaxos.InstanceId(1L))); when(ctx.LastKnownAliveUpToDateInstance).thenReturn(upToDateClusterMember); when(ctx.GetUriForId(upToDateClusterMember)).thenReturn(new URI("c:/1")); // What we know the cluster knows when(ctx.LastKnownLearnedInstanceInCluster).thenReturn(1L); // When Message <LearnerMessage> message = Message.to(LearnerMessage.CatchUp, new URI("c:/2"), 2L).setHeader(Message.HEADER_FROM, "c:/2").setHeader(Message.HEADER_INSTANCE_ID, "2"); State newState = state.handle(ctx, message, outgoing); // Then assertThat(newState, equalTo(LearnerState.Learner)); verify(outgoing).offer(Message.to(LearnerMessage.LearnRequest, new URI("c:/1"), new LearnerMessage.LearnRequestState()).setHeader(Org.Neo4j.cluster.protocol.atomicbroadcast.multipaxos.InstanceId.INSTANCE, Convert.ToString(1L))); verify(ctx).setTimeout("learn", Message.timeout(LearnerMessage.LearnTimedout, message)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void learnerServingOldInstanceShouldNotLogErrorIfItDoesNotHaveIt() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void LearnerServingOldInstanceShouldNotLogErrorIfItDoesNotHaveIt() { // Given LearnerState state = LearnerState.Learner; LearnerContext ctx = mock(typeof(LearnerContext)); MessageHolder outgoing = mock(typeof(MessageHolder)); // The instance will be asked for paxos instance 4... InstanceId paxosInstanceIdIDontHave = new InstanceId(4); Message <LearnerMessage> messageRequestingId = Message.to(LearnerMessage.LearnRequest, URI.create("c:/1")).setHeader(Message.HEADER_FROM, "c:/2").setHeader(InstanceId.INSTANCE, "4"); // ...but it does not have it yet when(ctx.GetPaxosInstance(paxosInstanceIdIDontHave)).thenReturn(new PaxosInstance(mock(typeof(PaxosInstanceStore)), paxosInstanceIdIDontHave)); // When state.handle(ctx, messageRequestingId, outgoing); // Then // verify there is no logging of the failure verify(ctx, never()).notifyLearnMiss(paxosInstanceIdIDontHave); // but the learn failed went out anyway //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: verify(outgoing, times(1)).offer(org.mockito.ArgumentMatchers.argThat<org.neo4j.cluster.com.message.Message<? extends org.neo4j.cluster.com.message.MessageType>>(new org.neo4j.cluster.protocol.MessageArgumentMatcher() verify(outgoing, times(1)).offer(ArgumentMatchers.argThat <Message <MessageType> >(new MessageArgumentMatcher() .onMessageType(LearnerMessage.LearnFailed).to(URI.create("c:/2")))); }
public AssessorsController(LearnerContext context, ILookUpService lookUpService, UserManager <Users> userManager, INotyfService notyf) { _context = context; _lookUpService = lookUpService; _userManager = userManager; _notyf = notyf; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleLocalLearnMessagesWithoutInstanceIdInTheMessageHeaderWhenCatchingUp() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleLocalLearnMessagesWithoutInstanceIdInTheMessageHeaderWhenCatchingUp() { // Given LearnerState learner = LearnerState.Learner; Org.Neo4j.cluster.InstanceId instanceId = new Org.Neo4j.cluster.InstanceId(42); long payload = 12L; LearnerContext context = mock(typeof(LearnerContext)); when(context.MyId).thenReturn(instanceId); when(context.LastKnownLearnedInstanceInCluster).thenReturn(11L); when(context.LastLearnedInstanceId).thenReturn(payload); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") org.neo4j.cluster.com.message.Message<LearnerMessage> message = mock(org.neo4j.cluster.com.message.Message.class); Message <LearnerMessage> message = mock(typeof(Message)); when(message.MessageType).thenReturn(LearnerMessage.CatchUp); when(message.HasHeader(Message.HEADER_INSTANCE_ID)).thenReturn(false); when(message.GetHeader(Message.HEADER_INSTANCE_ID)).thenThrow(new System.ArgumentException()); when(message.Payload).thenReturn(payload); // When //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.cluster.statemachine.State<?,?> state = learner.handle(context, message, mock(org.neo4j.cluster.com.message.MessageHolder.class)); State <object, ?> state = learner.handle(context, message, mock(typeof(MessageHolder))); // Then assertSame(state, learner); verify(context, times(1)).setLastKnownLearnedInstanceInCluster(payload, instanceId); }
public CompaniesController(LearnerContext context, IWebHostEnvironment env, ILookUpService lookUpService, FoldersConfigation fconfig, IFileService fileService) { _context = context; _lookUpService = lookUpService; _fconfig = fconfig; _fileService = fileService; _env = env; }
public JobApplicationsController(LearnerContext context, ILookUpService lookUpService, ILogger <JobApplicationsController> logger, EmailConfiguration emailConfig, IEmailSender emailSender, INotyfService notyf) { _context = context; _lookUpService = lookUpService; _logger = logger; _emailConfig = emailConfig; _emailSender = emailSender; _notyf = notyf; }
public DataImportController(ILookUpService lookUpService, IFileService fileService, IDataImportService dataService, FoldersConfigation foldersConfigation, INotyfService notyf, UserManager <Users> userManager, LearnerContext learnerContext) { _userManager = userManager; _fileService = fileService; _foldersConfigation = foldersConfigation; _lookUpService = lookUpService; _notyf = notyf; _learnerContext = learnerContext; _dataService = dataService; }
internal ClusterContextImpl(InstanceId me, CommonContextState commonState, LogProvider logging, Timeouts timeouts, Executor executor, ObjectOutputStreamFactory objectOutputStreamFactory, ObjectInputStreamFactory objectInputStreamFactory, LearnerContext learnerContext, HeartbeatContext heartbeatContext, Config config) : base(me, commonState, logging, timeouts) { this._executor = executor; this._objectOutputStreamFactory = objectOutputStreamFactory; this._objectInputStreamFactory = objectInputStreamFactory; this._learnerContext = learnerContext; this._heartbeatContext = heartbeatContext; this._config = config; heartbeatContext.AddHeartbeatListener(new HeartbeatListener_AdapterAnonymousInnerClass(this)); }
private ClusterContextImpl(InstanceId me, CommonContextState commonState, LogProvider logging, Timeouts timeouts, IEnumerable <URI> joiningInstances, ClusterMessage.ConfigurationResponseState joinDeniedConfigurationResponseState, Executor executor, ObjectOutputStreamFactory objectOutputStreamFactory, ObjectInputStreamFactory objectInputStreamFactory, LearnerContext learnerContext, HeartbeatContext heartbeatContext, Config config) : base(me, commonState, logging, timeouts) { this._joiningInstances = joiningInstances; this._joinDeniedConfigurationResponseState = joinDeniedConfigurationResponseState; this._executor = executor; this._objectOutputStreamFactory = objectOutputStreamFactory; this._objectInputStreamFactory = objectInputStreamFactory; this._learnerContext = learnerContext; this._heartbeatContext = heartbeatContext; this._config = config; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void learnerShouldAskAllAliveInstancesAndTheseOnlyForMissingValue() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void LearnerShouldAskAllAliveInstancesAndTheseOnlyForMissingValue() { // Given IList <URI> allMembers = new List <URI>(3); URI instance1 = URI.create("c:/1"); // this one is failed URI instance2 = URI.create("c:/2"); // this one is ok and will respond URI instance3 = URI.create("c:/3"); // this one is the requesting instance URI instance4 = URI.create("c:/4"); // and this one is ok and will respond too allMembers.Add(instance1); allMembers.Add(instance2); allMembers.Add(instance3); allMembers.Add(instance4); ISet <Org.Neo4j.cluster.InstanceId> aliveInstanceIds = new HashSet <Org.Neo4j.cluster.InstanceId>(); Org.Neo4j.cluster.InstanceId id2 = new Org.Neo4j.cluster.InstanceId(2); Org.Neo4j.cluster.InstanceId id4 = new Org.Neo4j.cluster.InstanceId(4); aliveInstanceIds.Add(id2); aliveInstanceIds.Add(id4); LearnerState state = LearnerState.Learner; LearnerContext ctx = mock(typeof(LearnerContext)); MessageHolder outgoing = mock(typeof(MessageHolder)); InstanceId paxosInstanceIdIAskedFor = new InstanceId(4); when(ctx.LastDeliveredInstanceId).thenReturn(3L); when(ctx.LastKnownLearnedInstanceInCluster).thenReturn(5L); when(ctx.MemberURIs).thenReturn(allMembers); when(ctx.Alive).thenReturn(aliveInstanceIds); when(ctx.GetUriForId(id2)).thenReturn(instance2); when(ctx.GetUriForId(id4)).thenReturn(instance4); when(ctx.GetPaxosInstance(paxosInstanceIdIAskedFor)).thenReturn(new PaxosInstance(mock(typeof(PaxosInstanceStore)), paxosInstanceIdIAskedFor)); Message <LearnerMessage> theCause = Message.to(LearnerMessage.CatchUp, instance2); // could be anything, really // When state.handle(ctx, Message.timeout(LearnerMessage.LearnTimedout, theCause), outgoing); // Then //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: verify(outgoing, times(1)).offer(org.mockito.ArgumentMatchers.argThat<org.neo4j.cluster.com.message.Message<? extends org.neo4j.cluster.com.message.MessageType>>(new org.neo4j.cluster.protocol.MessageArgumentMatcher() verify(outgoing, times(1)).offer(ArgumentMatchers.argThat <Message <MessageType> >(new MessageArgumentMatcher() .onMessageType(LearnerMessage.LearnRequest).to(instance2))); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: verify(outgoing, times(1)).offer(org.mockito.ArgumentMatchers.argThat<org.neo4j.cluster.com.message.Message<? extends org.neo4j.cluster.com.message.MessageType>>(new org.neo4j.cluster.protocol.MessageArgumentMatcher() verify(outgoing, times(1)).offer(ArgumentMatchers.argThat <Message <MessageType> >(new MessageArgumentMatcher() .onMessageType(LearnerMessage.LearnRequest).to(instance4))); verifyNoMoreInteractions(outgoing); }
public DocumentsController(LearnerContext context, ILookUpService lookUpService, IFileService fileService, FoldersConfigation foldersConfigation, UserManager <Users> userManager, INotyfService notyf) { _context = context; _lookUpService = lookUpService; _fileService = fileService; _userManager = userManager; _foldersConfigation = foldersConfigation; _notyf = notyf; }
public PersonController(LearnerContext context, IWebHostEnvironment env, ILookUpService lookUpService,IFileService fileService, FoldersConfigation fconfig, UserManager<Users> userManager, INotyfService notyf ) { _context = context; _env = env; _lookUpService = lookUpService; _fileService = fileService; _fconfig = fconfig; _userManager = userManager; _notyf = notyf; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldOnlyAllowHigherLastLearnedInstanceId() public virtual void ShouldOnlyAllowHigherLastLearnedInstanceId() { // Given Config config = mock(typeof(Config)); when(config.Get(ClusterSettings.max_acceptors)).thenReturn(10); MultiPaxosContext mpCtx = new MultiPaxosContext(null, Iterables.empty(), mock(typeof(ClusterConfiguration)), null, NullLogProvider.Instance, null, null, null, null, null, config); LearnerContext state = mpCtx.LearnerContext; // When state.SetLastKnownLearnedInstanceInCluster(1, new InstanceId(2)); state.SetLastKnownLearnedInstanceInCluster(0, new InstanceId(3)); // Then assertThat(state.LastKnownLearnedInstanceInCluster, equalTo(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void settingLastLearnedInstanceToNegativeOneShouldAlwaysWin() public virtual void SettingLastLearnedInstanceToNegativeOneShouldAlwaysWin() { // Given Config config = mock(typeof(Config)); when(config.Get(ClusterSettings.max_acceptors)).thenReturn(10); MultiPaxosContext mpCtx = new MultiPaxosContext(null, Iterables.empty(), mock(typeof(ClusterConfiguration)), null, NullLogProvider.Instance, null, null, null, null, null, config); LearnerContext state = mpCtx.LearnerContext; // When state.SetLastKnownLearnedInstanceInCluster(1, new InstanceId(2)); state.SetLastKnownLearnedInstanceInCluster(-1, null); // Then assertThat(state.LastKnownLearnedInstanceInCluster, equalTo(-1L)); assertThat(state.LastKnownAliveUpToDateInstance, equalTo(new InstanceId(2))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void learnerReceivingLearnFailedShouldLogIt() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void LearnerReceivingLearnFailedShouldLogIt() { // Given LearnerState state = LearnerState.Learner; LearnerContext ctx = mock(typeof(LearnerContext)); MessageHolder outgoing = mock(typeof(MessageHolder)); InstanceId paxosInstanceIdIAskedFor = new InstanceId(4); Message <LearnerMessage> theLearnFailure = Message.to(LearnerMessage.LearnFailed, URI.create("c:/1")).setHeader(Message.HEADER_FROM, "c:/2").setHeader(InstanceId.INSTANCE, "4"); when(ctx.GetPaxosInstance(paxosInstanceIdIAskedFor)).thenReturn(new PaxosInstance(mock(typeof(PaxosInstanceStore)), paxosInstanceIdIAskedFor)); when(ctx.MemberURIs).thenReturn(Collections.singletonList(URI.create("c:/2"))); // When state.handle(ctx, theLearnFailure, outgoing); // Then // verify that the failure was logged verify(ctx, times(1)).notifyLearnMiss(paxosInstanceIdIAskedFor); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotCloseTheGapIfItsTheCoordinatorAndTheGapIsSmallerThanTheThreshold() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotCloseTheGapIfItsTheCoordinatorAndTheGapIsSmallerThanTheThreshold() { // Given // A coordinator that knows that the last Paxos instance delivered is 3 long lastDelivered = 3L; LearnerState learner = LearnerState.Learner; Org.Neo4j.cluster.InstanceId memberId = new Org.Neo4j.cluster.InstanceId(42); LearnerContext context = mock(typeof(LearnerContext)); when(context.IsMe(any())).thenReturn(true); when(context.Coordinator).thenReturn(memberId); // so it's the coordinator when(context.LastDeliveredInstanceId).thenReturn(lastDelivered); // and has this list of pending instances (up to id 14) IList <PaxosInstance> pendingInstances = new LinkedList <PaxosInstance>(); for (int i = 1; i < 12; i++) // start at 1 because instance 3 is already delivered { InstanceId instanceId = new InstanceId(lastDelivered + i); PaxosInstance value = new PaxosInstance(mock(typeof(PaxosInstanceStore)), instanceId); value.Closed("", ""); when(context.GetPaxosInstance(instanceId)).thenReturn(value); pendingInstances.Add(value); } when(context.GetLog(any())).thenReturn(mock(typeof(Log))); Message <LearnerMessage> incomingInstance = Message.to(LearnerMessage.Learn, URI.create("c:/1"), new LearnerMessage.LearnState(new object())).setHeader(Message.HEADER_FROM, "c:/2").setHeader(Message.HEADER_CONVERSATION_ID, "conversation-id").setHeader(InstanceId.INSTANCE, "" + (lastDelivered + LearnerContext_Fields.LEARN_GAP_THRESHOLD)); // When // it receives a message with Paxos instance id at the threshold learner.handle(context, incomingInstance, mock(typeof(MessageHolder))); // Then // it waits and doesn't deliver anything foreach (PaxosInstance pendingInstance in pendingInstances) { assertFalse(pendingInstance.IsState(PaxosInstance.State.Delivered)); } verify(context, times(0)).LastDeliveredInstanceId = anyLong(); }
public AccountController( UserManager <Users> userManager, SignInManager <Users> signInManager, IEmailSender emailSender, RoleManager <Roles> roleManager, ILookUpService lookUpService, EmailConfiguration emailConfig, ILogger <AccountController> logger, LearnerContext context, INotyfService notyf ) { _userManager = userManager; _signInManager = signInManager; _logger = logger; _emailSender = emailSender; _emailConfig = emailConfig; _roleManager = roleManager; _lookUpService = lookUpService; _context = context; _notyf = notyf; }
public InstitutionTypeController(LearnerContext context, ILookUpService lookUpService) { _context = context; _lookUpService = lookUpService; }
public AddressController(LearnerContext context, ILookUpService lookUpService) { _context = context; _lookUpService = lookUpService; }
public OfoUnitController(LearnerContext context, ILookUpService lookUpService) { _context = context; _lookUpService = lookUpService; }
public DashboardController(LearnerContext context) { _context = context; }
public FinancialyearController(LearnerContext context, ILookUpService lookUpService) { _context = context; _lookUpService = lookUpService; }
public ProvincesController(LearnerContext context, ILookUpService lookUpService) { _context = context; _lookUpService = lookUpService; }
public CitiesController(LearnerContext context, ILookUpService lookUpService, INotyfService notyf) { _context = context; _lookUpService = lookUpService; _notyf = notyf; }
public DataImportService(ILookUpService lookUpService, LearnerContext learnerContext, ILogger <DataImportService> logger) { _lookUpService = lookUpService; _learnerContext = learnerContext; _logger = logger; }
public DocumentTypesController(LearnerContext context, ILookUpService lookUpService) { _context = context; _lookUpService = lookUpService; }
public JobTypeController(LearnerContext context, ILookUpService lookUpService) { _context = context; _lookUpService = lookUpService; }
internal virtual void SetCircularDependencies(ClusterContext clusterContext, LearnerContext learnerContext) { this._clusterContext = clusterContext; this._learnerContext = learnerContext; }
public JobController(LearnerContext context, IWebHostEnvironment env, ILookUpService lookUpService) { _context = context; _env = env; _lookUpService = lookUpService; }
public SchoolController(LearnerContext context, ILookUpService lookUpService) { _context = context; _lookUpService = lookUpService; }