@Test
  public void testLoadXml() throws Exception {

    OozieJobExecutorJobEntry jobEntry = new OozieJobExecutorJobEntry();
    OozieJobExecutorConfig jobConfig = new OozieJobExecutorConfig();

    jobConfig.setOozieWorkflow("hdfs://localhost:9000/user/test-user/oozie/workflow.xml");
    jobConfig.setOozieWorkflowConfig("file:///User/test-user/oozie/job.properties");
    jobConfig.setOozieUrl("http://localhost:11000/oozie");

    jobEntry.setJobConfig(jobConfig);

    JobEntryCopy jec = new JobEntryCopy(jobEntry);
    jec.setLocation(0, 0);
    String xml = jec.getXML();

    Document d = XMLHandler.loadXMLString(xml);

    OozieJobExecutorJobEntry jobEntry2 = new OozieJobExecutorJobEntry();
    jobEntry2.loadXML(d.getDocumentElement(), null, null, null);

    OozieJobExecutorConfig jobConfig2 = jobEntry2.getJobConfig();
    assertEquals(jobConfig.getOozieWorkflow(), jobConfig2.getOozieWorkflow());
    assertEquals(jobConfig.getOozieWorkflowConfig(), jobConfig2.getOozieWorkflowConfig());
    assertEquals(jobConfig.getOozieUrl(), jobConfig2.getOozieUrl());
  }
Beispiel #2
0
  public void drawJobEntryIcon(int x, int y, JobEntryCopy jobEntryCopy) {
    if (jobEntryCopy == null) return; // Don't draw anything

    BufferedImage image = null;

    if (jobEntryCopy.isSpecial()) {
      if (jobEntryCopy.isStart()) {
        image = imageStart;
      }
      if (jobEntryCopy.isDummy()) {
        image = imageDummy;
      }
    } else {
      String configId = jobEntryCopy.getEntry().getPluginId();
      if (configId != null) {
        image = entryImages.get(configId);
      }
    }
    if (image == null) {
      return;
    }

    drawPixelatedImage(image, x + xOffset, y + xOffset);
    // gc.drawImage(image, x+xOffset, y+yOffset, observer);
  }
 private void patchJobEntries(JobMeta jobMeta) {
   for (JobEntryCopy copy : jobMeta.getJobCopies()) {
     if (copy.isTransformation()) {
       JobEntryTrans entry = (JobEntryTrans) copy.getEntry();
       if (entry.getSpecificationMethod()
           == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME) {
         if (transDirOverride != null) {
           entry.setDirectory(transDirOverride);
           continue;
         }
         String entryPath = resolvePath(baseDirectory.getPath(), entry.getDirectory());
         entry.setDirectory(entryPath);
       }
     }
     if (copy.isJob()) {
       JobEntryJob entry = (JobEntryJob) copy.getEntry();
       if (entry.getSpecificationMethod()
           == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME) {
         if (jobDirOverride != null) {
           entry.setDirectory(jobDirOverride);
           continue;
         }
         String entryPath = resolvePath(baseDirectory.getPath(), entry.getDirectory());
         entry.setDirectory(entryPath);
       }
     }
   }
 }
 private JobMeta processLinkedJobs(JobMeta jobMeta) {
   for (int i = 0; i < jobMeta.nrJobEntries(); i++) {
     JobEntryCopy jec = jobMeta.getJobEntry(i);
     if (jec.getEntry() instanceof JobEntryJob) {
       JobEntryJob jej = (JobEntryJob) jec.getEntry();
       jej.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
       String filename = jej.getFilename();
       String jobname =
           filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.'));
       String directory = filename.substring(0, filename.lastIndexOf("/"));
       jej.setJobName(jobname);
       jej.setDirectory(directory);
       jobMeta.setJobEntry(i, jec);
     }
   }
   return jobMeta;
 }
  public void getInfo() {
    try {
      configuration.setExecutingLocally(wExecLocal.getSelection());
      configuration.setExecutingRemotely(wExecRemote.getSelection());

      // Remote data
      //
      if (wExecRemote.getSelection()) {
        String serverName = wRemoteHost.getText();
        configuration.setRemoteServer(abstractMeta.findSlaveServer(serverName));
      }
      configuration.setPassingExport(wPassExport.getSelection());
      getConfiguration().setExpandingRemoteJob(wExpandRemote.getSelection());

      // various settings
      //
      configuration.setReplayDate(null);
      configuration.setSafeModeEnabled(wSafeMode.getSelection());
      configuration.setClearingLog(wClearLog.getSelection());
      configuration.setLogLevel(LogLevel.values()[wLogLevel.getSelectionIndex()]);

      String startCopyName = null;
      int startCopyNr = 0;
      if (!Const.isEmpty(wStartCopy.getText())) {
        if (wStartCopy.getSelectionIndex() >= 0) {
          JobEntryCopy copy =
              ((JobMeta) abstractMeta).getJobCopies().get(wStartCopy.getSelectionIndex());
          startCopyName = copy.getName();
          startCopyNr = copy.getNr();
        }
      }
      getConfiguration().setStartCopyName(startCopyName);
      getConfiguration().setStartCopyNr(startCopyNr);

      // The lower part of the dialog...
      getInfoParameters();
      getInfoVariables();

      // Metrics
      configuration.setGatheringMetrics(wGatherMetrics.getSelection());
    } catch (Exception e) {
      new ErrorDialog(shell, "Error in settings", "There is an error in the dialog settings", e);
    }
  }
  public void getUsedArguments(
      JobMeta jobMeta, String[] commandLineArguments, IMetaStore metaStore) {

    for (JobEntryCopy jobEntryCopy : jobMeta.jobcopies) {
      if (jobEntryCopy.isTransformation()) {
        JobEntryTrans jobEntryTrans = (JobEntryTrans) jobEntryCopy.getEntry();
        try {
          TransMeta transMeta = jobEntryTrans.getTransMeta(repository, metaStore, jobMeta);
          Map<String, String> map = transMeta.getUsedArguments(commandLineArguments);
          for (String key : map.keySet()) {
            String value = map.get(key);
            if (!arguments.containsKey(key)) {
              arguments.put(key, value);
            }
          }
        } catch (KettleException ke) {
          log.logBasic(ke.getMessage(), ke);
        }
      }
    }
  }
 private String getJobEntryCopyName(JobEntryCopy copy) {
   return copy.getName() + (copy.getNr() > 0 ? copy.getNr() : "");
 }