private void updateBackendService(
      boolean useAutoDownload, boolean useAutoDelete, String directoryPath) {
    // get backend service
    IBackendService backendService = null;
    backendService = getBackendService();
    if (backendService == null) {
      return;
    }

    try {

      backendService.setCoreDumpLocation(directoryPath);
      backendService.setAutoDownload(useAutoDownload);
      backendService.setAutoDelete(useAutoDelete);

      IPreferenceStore store = getPreferenceStore();
      store.setValue(SystemProperties.BACKEND_AUTO_DELETE_ENABLED, useAutoDelete);
      store.setValue(SystemProperties.BACKEND_AUTO_DOWNLOAD_ENABLED, useAutoDownload);
      if (directoryPath != null) {
        store.setValue(SystemProperties.BACKEND_DOWNLOAD_PATH, directoryPath);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /** {@inheritDoc} */
  @Override
  public String execute() throws ExecutionException {
    IBackendService backendService = getBackendService();

    String message = null;
    if (backendService == null) {
      throw new ExecutionException("Cannot find IBackendService!");
    } else {
      boolean status = backendService.getAutoDelete();
      message = (status ? "enabled." : "disabled.");
    }
    return message;
  }
コード例 #3
0
  /** {@inheritDoc} */
  public void start(BundleContext context) throws Exception {
    Activator.setBundleContext(context);
    TestCase testCaseService;
    TestSuite testSuiteService = new TestSuite();

    testCaseService = new FlashToolBackendConfigurationServiceTest();
    context.registerService(TestCase.class.getName(), testCaseService, null);
    testSuiteService.addTest(testCaseService);

    testCaseService = new FlashToolBackendServiceTest();
    context.registerService(TestCase.class.getName(), testCaseService, null);
    testSuiteService.addTest(testCaseService);

    Hashtable<String, String> properties = new Hashtable<String, String>();
    properties.put("bundle.name", "com.stericsson.sdk.backend");
    context.registerService(TestSuite.class.getName(), testSuiteService, properties);

    ServiceReference serviceReference =
        context.getServiceReference(IBackendService.class.getName());
    setBackendService((IBackendService) context.getService(serviceReference));
    backendService.setAcceptClients(false);
    backendService.setAcceptEquipments(false);

    testSuiteService = new TestSuite();

    for (String actualClassName : testCasesClassesNames) {

      Class<?> actualClazz;
      try {
        actualClazz = Class.forName(actualClassName);
        testCaseService = (TestCase) actualClazz.newInstance();
        context.registerService(TestCase.class.getName(), testCaseService, null);

        testSuiteService.addTest(testCaseService);
      } catch (Throwable t) {
        logger.error(t.getMessage());
      }
    }

    properties = new Hashtable<String, String>();
    properties.put("bundle.name", "com.stericsson.sdk.backend.remote");
    context.registerService(TestSuite.class.getName(), testSuiteService, properties);
  }