Package gov.nasa.arc.mct.abbreviation

Examples of gov.nasa.arc.mct.abbreviation.Abbreviations


      }
    });
  }
 
  private static AbbreviationSettings getAbbreviationSettings(String label) {
    Abbreviations abbrevs = manager.getAbbreviations(label);
    LabelAbbreviations currentAbbrevs = new LabelAbbreviations();
    AbbreviationSettings settings = new AbbreviationSettings(label, abbrevs, currentAbbrevs);
    return settings;
   
   
View Full Code Here


  @Test
  public void testActivateGoodFile() {
    properties.put("abbreviations-file", "/default-abbreviations.properties");
    abbrev.activate(context);

    Abbreviations abbreviations = abbrev.getAbbreviations("Fiber Optic MDM System");
    assertEquals(abbreviations.getPhrases().size(), 3);
    assertEquals(abbreviations.getPhrases().get(0), "Fiber Optic");
    assertEquals(abbreviations.getPhrases().get(1), "MDM");
    assertEquals(abbreviations.getPhrases().get(2), "System");
  }
View Full Code Here

 
  @Test
  public void testActivateNoFileProperty() {
    abbrev.activate(context);

    Abbreviations abbreviations = abbrev.getAbbreviations("Fiber Optic MDM System");
    assertEquals(abbreviations.getPhrases().size(), 4);
    assertEquals(abbreviations.getPhrases().get(0), "Fiber");
    assertEquals(abbreviations.getPhrases().get(1), "Optic");
    assertEquals(abbreviations.getPhrases().get(2), "MDM");
    assertEquals(abbreviations.getPhrases().get(3), "System");
  }
View Full Code Here

  @Test
  public void testActivateNonexistentAbbreviationsFile() {
    properties.put("abbreviations-file", "/file-does-not-exist.properties");
    abbrev.activate(context);

    Abbreviations abbreviations = abbrev.getAbbreviations("Fiber Optic MDM System");
    assertEquals(abbreviations.getPhrases().size(), 4);
    assertEquals(abbreviations.getPhrases().get(0), "Fiber");
    assertEquals(abbreviations.getPhrases().get(1), "Optic");
    assertEquals(abbreviations.getPhrases().get(2), "MDM");
    assertEquals(abbreviations.getPhrases().get(3), "System");
  }
View Full Code Here

  }
 
  @Test(dataProvider="getAbbreviationsTests")
  public void testGetAbbreviations(String s, String[] expectedPhrases) {
    AbbreviationsManager manager = new AbbreviationsManager(defaultProperties);
    Abbreviations abbrev = manager.getAbbreviations(s);
   
    assertEquals(abbrev.getValue(), s);
    assertEquals(abbrev.getPhrases().size(), expectedPhrases.length);
    for (int i=0; i<abbrev.getPhrases().size(); ++i) {
      String phrase = abbrev.getPhrases().get(i);
      assertEquals(phrase, expectedPhrases[i]);
     
      List<String> alternatives = abbrev.getAbbreviations(phrase);
      List<String> expectedAlternatives = manager.getAlternatives(abbrev.getPhrases().get(i));
      assertTrue(alternatives.size() >= 1);
      assertEquals(alternatives.size(), expectedAlternatives.size());
      assertEquals(alternatives.get(0), abbrev.getPhrases().get(i));
    }
  }
View Full Code Here

      return null;
    } else {
      ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
      String fullLabel = tableModel.getFullRowName(table.getSelectedRows()[0]);
      LabelAbbreviations currentAbbrevs = tableModel.getRowLabelAbbreviations(table.getSelectedRows()[0]);
      Abbreviations availableAbbrevs = ServiceAccess.getService(AbbreviationService.class).getAbbreviations(fullLabel);
      return new AbbreviationSettings(fullLabel, availableAbbrevs, currentAbbrevs);
    }
  }
View Full Code Here

      return null;
    } else {
      ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
      String fullLabel = tableModel.getFullColumnName(table.getSelectedColumns()[0]);
      LabelAbbreviations currentAbbrevs = tableModel.getColumnLabelAbbreviations(table.getSelectedColumns()[0]);
      Abbreviations availableAbbrevs = ServiceAccess.getService(AbbreviationService.class).getAbbreviations(fullLabel);
      return new AbbreviationSettings(fullLabel, availableAbbrevs, currentAbbrevs);
    }
  }
View Full Code Here

    } else {
      ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
      AbstractComponent component = (AbstractComponent) model.getStoredValueAt(table.getSelectedRows()[0], table.getSelectedColumns()[0]);
      String fullLabel = tableModel.getFullCellName(table.getSelectedRows()[0], table.getSelectedColumns()[0]);
      LabelAbbreviations currentAbbrevs = tableModel.getCellLabelAbbreviations(tableModel.getKey(component));
      Abbreviations availableAbbrevs = ServiceAccess.getService(AbbreviationService.class).getAbbreviations(fullLabel);
      return new AbbreviationSettings(fullLabel, availableAbbrevs, currentAbbrevs);
    }
  }
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.abbreviation.Abbreviations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.