Esempio n. 1
0
 @Test
 public void multipleExternalConnectionTest() {
   cleanHelperMDKs();
   addMadkitArgs(
       BooleanOption.network.toString(),
       LevelOption.networkLogLevel.toString(),
       "FINE",
       LevelOption.madkitLogLevel.toString(),
       Level.ALL.toString());
   launchTest(
       new AbstractAgent() {
         @Override
         protected void activate() {
           KernelAction.LAUNCH_NETWORK.getActionFor(this).actionPerformed(null);
           Madkit m =
               new Madkit(
                   BooleanOption.network.toString(),
                   LevelOption.agentLogLevel.toString(),
                   "ALL",
                   Option.launchAgents.toString(),
                   LeaveGroupInEndNormalAgent.class.getName()
                       + ";"
                       + ForEverAgent.class.getName());
           //						BooleanOption.createLogFiles.toString()};
           helperInstances.add(m);
           pause(2000);
           System.err.println(getOrganizationSnapShot(false));
           List<AgentAddress> l = getAgentsWithRole(COMMUNITY, GROUP, ROLE);
           System.err.println("others =" + l.size());
           assertEquals(1, l.size());
         }
       });
 }
Esempio n. 2
0
  /*
   * Test toString of a normal Level.
   */
  public void testToString_Normal() {
    assertEquals("ALL", Level.ALL.toString());

    MockLevel l = new MockLevel("name", 2);
    assertEquals("name", l.toString());

    MockLevel emptyLevel = new MockLevel("", 3);
    assertEquals("", emptyLevel.toString());
  }
Esempio n. 3
0
 private void handleDefaults() {
   this.getConfig().addDefault("broadcastLevel", Level.ALL.toString());
 }
public class ReportPreferencePage extends FieldEditorPreferencePage
    implements IWorkbenchPreferencePage {

  private String[][] logLvlValues =
      new String[][] {
        new String[] {Messages.getString("ReportLogLevel.0"), Level.INFO.toString()},
        new String[] {Messages.getString("ReportLogLevel.1"), Level.WARNING.toString()},
        new String[] {Messages.getString("ReportLogLevel.2"), Level.FINEST.toString()},
        new String[] {Messages.getString("ReportLogLevel.3"), Level.SEVERE.toString()},
        new String[] {Messages.getString("ReportLogLevel.4"), Level.ALL.toString()}
      };
  private DirectoryFieldEditor localTemplateEditor;

  public ReportPreferencePage() {
    super(GRID);
    setDescription(Messages.getString("ReportPreferencePage.0")); // $NON-NLS-1$
  }

  /* (non-Javadoc)
   * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
   */
  @Override
  public void init(IWorkbench arg0) {
    setPreferenceStore(Activator.getDefault().getPreferenceStore());
  }

  /* (non-Javadoc)
   * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
   */
  @Override
  protected void createFieldEditors() {

    BooleanFieldEditor reportLoggingEditor =
        new BooleanFieldEditor(
            PreferenceConstants.REPORT_LOGGING_ENABLED,
            Messages.getString("ReportPreferencePage.1"),
            getFieldEditorParent());
    addField(reportLoggingEditor);

    ComboFieldEditor logLvlFieldEditor =
        new ComboFieldEditor(
            PreferenceConstants.REPORT_LOGGING_LVL,
            Messages.getString("ReportPreferencePage.2"),
            logLvlValues,
            getFieldEditorParent());
    addField(logLvlFieldEditor);

    DirectoryFieldEditor logFileNameEditor =
        new DirectoryFieldEditor(
            PreferenceConstants.REPORT_LOG_FILE,
            Messages.getString("ReportPreferencePage.3"),
            getFieldEditorParent());
    addField(logFileNameEditor);

    localTemplateEditor =
        new DirectoryFieldEditor(
            PreferenceConstants.REPORT_LOCAL_TEMPLATE_DIRECTORY,
            Messages.getString("ReportPreferencePage.8"),
            getFieldEditorParent());
    addField(localTemplateEditor);

    BooleanFieldEditor useCacheEditor =
        new BooleanFieldEditor(
            PreferenceConstants.REPORT_USE_CACHE,
            Messages.getString("ReportPreferencePage.7"),
            getFieldEditorParent());
    addField(useCacheEditor);
  }

  @Override
  public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getProperty().equals(FieldEditor.VALUE)) {
      checkState();
    }

    if (event.getSource() == localTemplateEditor) {
      Activator.getDefault()
          .getIReportTemplateDirectoryService()
          .setDirectory((String) event.getNewValue());
    }
  }

  @Override
  protected void checkState() {
    super.checkState();
    if (!isValid()) {
      return;
    }
  }
}