Codota Logo
WorkItemBuilder
Code IndexAdd Codota to your IDE (free)

How to use
WorkItemBuilder
in
org.batfish.common.util

Best Java code snippets using org.batfish.common.util.WorkItemBuilder (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: batfish/batfish

List<WorkItem> getAutoWorkQueue(String networkName, String testrigName) {
 List<WorkItem> autoWorkQueue = new LinkedList<>();
 WorkItem parseWork = WorkItemBuilder.getWorkItemParse(networkName, testrigName);
 autoWorkQueue.add(parseWork);
 Set<String> analysisNames = listAnalyses(networkName, AnalysisType.ALL);
 for (String analysis : analysisNames) {
  WorkItem analyzeWork =
    WorkItemBuilder.getWorkItemRunAnalysis(
      analysis, networkName, testrigName, null, false, false);
  autoWorkQueue.add(analyzeWork);
 }
 return autoWorkQueue;
}
origin: batfish/batfish

private boolean answerFile(
  Path questionFile, boolean isDifferential, boolean isDelta, FileWriter outWriter) {
 if (!Files.exists(questionFile)) {
  throw new BatfishException("Question file not found: " + questionFile);
 }
 String questionName = DEFAULT_QUESTION_PREFIX + "_" + UUID.randomUUID();
 // upload the question
 boolean resultUpload =
   _workHelper.uploadQuestion(
     _currContainerName,
     isDelta ? _currDeltaTestrig : _currTestrig,
     questionName,
     questionFile.toAbsolutePath().toString());
 if (!resultUpload) {
  return false;
 }
 _logger.debug("Uploaded question. Answering now.\n");
 // answer the question
 WorkItem wItemAs =
   WorkItemBuilder.getWorkItemAnswerQuestion(
     questionName,
     _currContainerName,
     _currTestrig,
     _currDeltaTestrig,
     isDifferential,
     isDelta);
 return execute(wItemAs, outWriter);
}
origin: batfish/batfish

private boolean generateDataplane(
  @Nullable FileWriter outWriter, List<String> options, List<String> parameters) {
 if (!isValidArgument(options, parameters, 0, 0, 0, Command.GEN_DP)) {
  return false;
 }
 if (!isSetTestrig() || !isSetContainer(true)) {
  return false;
 }
 // generate the data plane
 WorkItem wItemGenDp =
   WorkItemBuilder.getWorkItemGenerateDataPlane(_currContainerName, _currTestrig);
 return execute(wItemGenDp, outWriter);
}
origin: batfish/batfish

if (WorkItemBuilder.isParsingWorkItem(workItem)) {
 workType = WorkType.PARSING;
if (WorkItemBuilder.isDataplaningWorkItem(workItem)) {
 if (workType != WorkType.UNKNOWN) {
  throw new BatfishException("Cannot do composite work. Separate PARSING and DATAPLANING.");
if (WorkItemBuilder.isAnsweringWorkItem(workItem)) {
 if (workType != WorkType.UNKNOWN) {
  throw new BatfishException("Cannot do composite work. Separate ANSWER from other work.");
     getQuestion(
       workItem.getContainerName(),
       WorkItemBuilder.getQuestionName(workItem),
       WorkItemBuilder.getAnalysisName(workItem)));
 workType =
   question.getIndependent()
if (WorkItemBuilder.isAnalyzingWorkItem(workItem)) {
 if (workType != WorkType.UNKNOWN) {
  throw new BatfishException("Cannot do composite work. Separate ANALYZE from other work.");
 String aName = WorkItemBuilder.getAnalysisName(workItem);
 if (aName == null) {
  throw new BatfishException("Analysis name not provided for ANALYZE work");
    workItem.getTestrigName(),
    workItem.getRequestParams().get(BfConsts.ARG_DELTA_TESTRIG),
    WorkItemBuilder.isDifferential(workItem),
origin: batfish/batfish

private boolean runAnalysis(
  @Nullable FileWriter outWriter,
  List<String> options,
  List<String> parameters,
  boolean delta,
  boolean differential) {
 Command command =
   differential
     ? Command.RUN_ANALYSIS_DIFFERENTIAL
     : delta ? Command.RUN_ANALYSIS_REFERENCE : Command.RUN_ANALYSIS;
 if (!isValidArgument(options, parameters, 0, 1, 1, command)) {
  return false;
 }
 if (!isSetContainer(true) || !isSetTestrig()) {
  return false;
 }
 String analysisName = parameters.get(0);
 // answer the question
 WorkItem wItemAs =
   WorkItemBuilder.getWorkItemRunAnalysis(
     analysisName, _currContainerName, _currTestrig, _currDeltaTestrig, delta, differential);
 return execute(wItemAs, outWriter);
}
origin: batfish/batfish

WorkItem wItemParse = WorkItemBuilder.getWorkItemParse(_currContainerName, testrigName);
origin: batfish/batfish

private boolean generateReferenceDataplane(
  @Nullable FileWriter outWriter, List<String> options, List<String> parameters) {
 if (!isValidArgument(options, parameters, 0, 0, 0, Command.GEN_REFERENCE_DP)) {
  return false;
 }
 if (!isDeltaReady() || !isSetTestrig() || !isSetContainer(true)) {
  return false;
 }
 WorkItem wItemGenDdp =
   WorkItemBuilder.getWorkItemGenerateDeltaDataPlane(
     _currContainerName, _currTestrig, _currDeltaTestrig);
 return execute(wItemGenDdp, outWriter);
}
origin: batfish/batfish

@Test
public void testGetAutoWorkQueueSuggestedAnalysis() {
 String containerName = "myContainer";
 String testrigName = "myTestrig";
 _manager.initNetwork(containerName, null);
 // user policy
 _manager.configureAnalysis(
   containerName, true, "suggestedanalysis", Maps.newHashMap(), Lists.newArrayList(), true);
 WorkItem parseWorkItem = WorkItemBuilder.getWorkItemParse(containerName, testrigName);
 WorkItem analysisWorkItem =
   WorkItemBuilder.getWorkItemRunAnalysis(
     "suggestedanalysis", containerName, testrigName, null, false, false);
 List<WorkItem> workQueue = _manager.getAutoWorkQueue(containerName, testrigName);
 assertThat(workQueue, hasSize(2));
 // checking that the first work item is for parse
 assertThat(workQueue.get(0).matches(parseWorkItem), equalTo(true));
 // checking run analysis workitem
 assertThat(
   "Work Queue not correct for suggested analyses",
   workQueue.get(1).matches(analysisWorkItem),
   equalTo(true));
}
origin: batfish/batfish

WorkItemBuilder.getWorkItemAnswerQuestion(
  questionName,
  _currContainerName,
origin: batfish/batfish

private QueuedWork generateAndQueueDataplaneWork(String container, String testrig)
  throws Exception {
 WorkItem newWItem = WorkItemBuilder.getWorkItemGenerateDataPlane(container, testrig);
 WorkDetails details = new WorkDetails(testrig, null, false, WorkType.DATAPLANING);
 QueuedWork newWork = new QueuedWork(newWItem, details);
 boolean queued = queueUnassignedWork(newWork);
 if (!queued) {
  throw new BatfishException("Failed to auto-queue dataplane work");
 }
 return newWork;
}
origin: batfish/batfish

@Test
public void testGetAutoWorkQueueUserAnalysis() {
 String containerName = "myContainer";
 String testrigName = "myTestrig";
 _manager.initNetwork(containerName, null);
 // user policy
 _manager.configureAnalysis(
   containerName, true, "useranalysis", Maps.newHashMap(), Lists.newArrayList(), false);
 WorkItem parseWorkItem = WorkItemBuilder.getWorkItemParse(containerName, testrigName);
 WorkItem analysisWorkItem =
   WorkItemBuilder.getWorkItemRunAnalysis(
     "useranalysis", containerName, testrigName, null, false, false);
 List<WorkItem> workQueue = _manager.getAutoWorkQueue(containerName, testrigName);
 assertThat(workQueue, hasSize(2));
 // checking that the first work item is for parse
 assertThat(workQueue.get(0).matches(parseWorkItem), equalTo(true));
 // checking run analysis workitem
 assertThat(
   "Work Queue not correct for user analyses",
   workQueue.get(1).matches(analysisWorkItem),
   equalTo(true));
}
origin: batfish/batfish

public static WorkItem getWorkItemAnswerQuestion(
  String questionName,
  String containerName,
  String testrigName,
  String deltaTestrig,
  String analysisName,
  boolean isDifferential,
  boolean isDelta) {
 WorkItem wItem = new WorkItem(containerName, testrigName);
 wItem.addRequestParam(BfConsts.COMMAND_ANSWER, "");
 wItem.addRequestParam(BfConsts.ARG_QUESTION_NAME, questionName);
 if (isDifferential) {
  wItem.addRequestParam(BfConsts.ARG_DIFFERENTIAL, "");
 }
 if (deltaTestrig != null) {
  wItem.addRequestParam(BfConsts.ARG_DELTA_TESTRIG, deltaTestrig);
 }
 if (isDelta) {
  wItem.addRequestParam(BfConsts.ARG_DIFF_ACTIVE, "");
 }
 if (analysisName != null) {
  wItem.addRequestParam(BfConsts.ARG_ANALYSIS_NAME, analysisName);
 }
 return wItem;
}
org.batfish.common.utilWorkItemBuilder

Most used methods

  • getWorkItemParse
  • getWorkItemRunAnalysis
  • getWorkItemAnswerQuestion
  • getWorkItemGenerateDataPlane
  • getAnalysisName
  • getQuestionName
  • getWorkItemGenerateDeltaDataPlane
  • isAnalyzingWorkItem
  • isAnsweringWorkItem
  • isDataplaningWorkItem
  • isDifferential
  • isParsingWorkItem
  • isDifferential,
  • isParsingWorkItem

Popular in Java

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • getApplicationContext (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • JFileChooser (javax.swing)
  • JLabel (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now