@Test public void testGetPropertyNameForBranchWithWorkUnitState() { WorkUnitState workUnitState = new WorkUnitState(); workUnitState.setProp(PROPERTY_FOO, PATH_FOO); Assert.assertEquals(ForkOperatorUtils.getPropertyNameForBranch(workUnitState, PROPERTY_FOO), PROPERTY_FOO); workUnitState.setProp(ConfigurationKeys.FORK_BRANCH_ID_KEY, -1); Assert.assertEquals(ForkOperatorUtils.getPropertyNameForBranch(workUnitState, PROPERTY_FOO), PROPERTY_FOO); workUnitState.setProp(ConfigurationKeys.FORK_BRANCH_ID_KEY, 0); Assert.assertEquals(ForkOperatorUtils.getPropertyNameForBranch(workUnitState, PROPERTY_FOO), PROPERTY_FOO + ".0"); }
public static String getPropertyNameForBranch(String key, int numBranches, int branchId) { Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative"); Preconditions.checkArgument(branchId >= 0, "The branchId is expected to be non-negative"); return numBranches > 1 ? key + "." + branchId : key; }
ForkOperatorUtils { public static String getPropertyNameForBranch(String key, int numBranches, int branchId) { Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative"); Preconditions.checkArgument(branchId >= 0, "The branchId is expected to be non-negative"); return numBranches > 1 ? key + "." + branchId : key; } }
ForkOperatorUtils { public static String getPropertyNameForBranch(String key, int numBranches, int branchId) { Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative"); Preconditions.checkArgument(branchId >= 0, "The branchId is expected to be non-negative"); return numBranches > 1 ? key + "." + branchId : key; }  }
ForkOperatorUtils { public static String getPropertyNameForBranch(String key, int numBranches, int branchId) { Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative"); Preconditions.checkArgument(branchId >= 0, "The branchId is expected to be non-negative"); return numBranches > 1 ? key + "." + branchId : key; }  static String getPropertyNameForBranch(String key, int numBranches, int branchId); static String getPropertyNameForBranch(String key, int branch); static String getPropertyNameForBranch(WorkUnitState workUnitState, String key); static String getPathForBranch(State state, String path, int numBranches, int branchId); static String getForkId(String taskId, int index); }
ForkOperatorUtils { public static String getPropertyNameForBranch(String key, int numBranches, int branchId) { Preconditions.checkArgument(numBranches >= 0, "The number of branches is expected to be non-negative"); Preconditions.checkArgument(branchId >= 0, "The branchId is expected to be non-negative"); return numBranches > 1 ? key + "." + branchId : key; }  static String getPropertyNameForBranch(String key, int numBranches, int branchId); static String getPropertyNameForBranch(String key, int branch); static String getPropertyNameForBranch(WorkUnitState workUnitState, String key); static String getPathForBranch(State state, String path, int numBranches, int branchId); static String getForkId(String taskId, int index);  }