示例#1
0
文件: TestNLS.java 项目: saces/jgit
  public void testThreadTranslationBundleInheritance() throws InterruptedException {

    class T extends Thread {
      GermanTranslatedBundle bundle;

      @Override
      public void run() {
        bundle = GermanTranslatedBundle.get();
      }
    }

    NLS.setLocale(NLS.ROOT_LOCALE);
    GermanTranslatedBundle mainThreadsBundle = GermanTranslatedBundle.get();
    T t = new T();
    t.start();
    t.join();
    assertSame(mainThreadsBundle, t.bundle);

    NLS.setLocale(Locale.GERMAN);
    mainThreadsBundle = GermanTranslatedBundle.get();
    t = new T();
    t.start();
    t.join();
    assertSame(mainThreadsBundle, t.bundle);
  }
示例#2
0
文件: TestNLS.java 项目: saces/jgit
  public void testNLSLocale() {
    NLS.setLocale(NLS.ROOT_LOCALE);
    GermanTranslatedBundle bundle = GermanTranslatedBundle.get();
    assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale());

    NLS.setLocale(Locale.GERMAN);
    bundle = GermanTranslatedBundle.get();
    assertEquals(Locale.GERMAN, bundle.getEffectiveLocale());
  }
示例#3
0
文件: TestNLS.java 项目: saces/jgit
  public void testJVMDefaultLocale() {
    Locale.setDefault(NLS.ROOT_LOCALE);
    NLS.useJVMDefaultLocale();
    GermanTranslatedBundle bundle = GermanTranslatedBundle.get();
    assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale());

    Locale.setDefault(Locale.GERMAN);
    NLS.useJVMDefaultLocale();
    bundle = GermanTranslatedBundle.get();
    assertEquals(Locale.GERMAN, bundle.getEffectiveLocale());
  }
示例#4
0
文件: TestNLS.java 项目: saces/jgit
 @Override
 public void run() {
   try {
     NLS.setLocale(locale);
     barrier.await(); // wait for the other thread to set its locale
     bundle = GermanTranslatedBundle.get();
   } catch (InterruptedException e) {
     this.e = e;
   } catch (BrokenBarrierException e) {
     this.e = e;
   }
 }
示例#5
0
文件: TestNLS.java 项目: saces/jgit
 @Override
 public void run() {
   bundle = GermanTranslatedBundle.get();
 }