dcapwell commented on code in PR #2660:
URL: https://github.com/apache/cassandra/pull/2660#discussion_r1313465795


##########
src/java/org/apache/cassandra/config/SharedContext.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.config;
+
+import java.util.Random;
+import java.util.function.Supplier;
+
+import org.apache.cassandra.concurrent.ExecutorFactory;
+import org.apache.cassandra.concurrent.ScheduledExecutorPlus;
+import org.apache.cassandra.concurrent.ScheduledExecutors;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.gms.FailureDetector;
+import org.apache.cassandra.gms.Gossiper;
+import org.apache.cassandra.gms.IFailureDetector;
+import org.apache.cassandra.gms.IGossiper;
+import org.apache.cassandra.locator.IEndpointSnitch;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.MessageDelivery;
+import org.apache.cassandra.net.MessagingService;
+import org.apache.cassandra.repair.IValidationManager;
+import org.apache.cassandra.repair.StreamExecutor;
+import org.apache.cassandra.repair.TableRepairManager;
+import org.apache.cassandra.repair.ValidationManager;
+import org.apache.cassandra.service.ActiveRepairService;
+import org.apache.cassandra.streaming.StreamPlan;
+import org.apache.cassandra.utils.Clock;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.MBeanWrapper;
+
+public interface SharedContext
+{
+    InetAddressAndPort broadcastAddressAndPort(); // would be possible, but 
needs each executor to update before calling run
+    Supplier<Random> random();
+    Clock clock(); // can mock global
+    ExecutorFactory executorFactory(); // can mock global
+    MBeanWrapper mbean(); // can mock global
+    ScheduledExecutorPlus optionalTasks(); // would need reflection to 
override...
+
+    interface MessagingContext extends SharedContext
+    {
+        MessageDelivery messaging();  // might be possible (need to refactor), 
but needs each executor to update before calling run
+        IFailureDetector failureDetector(); // can mock global
+        IEndpointSnitch snitch(); // can mock global
+        IGossiper gossiper(); // need to refactor in order to mock out
+    }
+
+    interface RepairContext extends MessagingContext
+    {
+        ActiveRepairService repair(); // might be possible (need to refactor), 
but needs each executor to update before calling run
+        IValidationManager validationManager();
+        TableRepairManager repairManager(ColumnFamilyStore store);
+        StreamExecutor streamExecutor();

Review Comment:
   this is a hack to block streaming from starting, so tests can mock it... I 
didn't want to change streaming to work in simulation in this patch as its 
non-trivial given it network sockets + channels... `Netty` does support mock 
channels, but that just expands this scope



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to