Tabnine Logo
org.intermine.metadata
Code IndexAdd Tabnine to your IDE (free)

How to use org.intermine.metadata

Best Java code snippets using org.intermine.metadata (Showing top 20 results out of 315)

origin: org.intermine/intermine-model

/**
 * Return a Set of ClassDescriptors for all classes that directly extend or implement this class
 * or interface.
 *
 * @return set of subclass ClassDescriptors
 * @throws IllegalStateException if the set of subclasses has not been set
 */
public Set<ClassDescriptor> getSubDescriptors() {
  checkModel();
  return model.getDirectSubs(this);
}
origin: intermine/intermine

public void testSetClassDescriptorNull() throws Exception {
  FieldDescriptor fd = new TestFieldDescriptor("name");
  try {
    fd.setClassDescriptor(null);
    fail("Expected NullPointerException");
  } catch (NullPointerException e) {
  }
}
origin: intermine/intermine

public void testSetClassDescriptorValid() throws Exception {
  FieldDescriptor fd = new TestFieldDescriptor("name");
  ClassDescriptor cld = makeClass("Class1");
  try {
    fd.setClassDescriptor(cld);
  } catch (IllegalStateException e) {
    fail("Unable to set ClassDescriptor");
  }
}
origin: intermine/intermine

public void testRelationTypeManyToOne() throws Exception {
  CollectionDescriptor col = new CollectionDescriptor("col1", "package.name.Class1", null);
  ReferenceDescriptor ref  = new ReferenceDescriptor("ref1", "package.name.Class1", "col1");
  Set<CollectionDescriptor> cols = Collections.singleton(col);
  Set<ReferenceDescriptor> refs = Collections.singleton(ref);
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false,
      ClassDescriptorFactory.NO_ATTRS, refs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.N_ONE_RELATION, ref.relationType());
}
origin: intermine/intermine

public void testRelationTypeOneToMany() throws Exception {
  CollectionDescriptor col = new CollectionDescriptor("col1", "package.name.Class1", "ref1");
  ReferenceDescriptor ref  = new ReferenceDescriptor("ref1", "package.name.Class1", null);
  Set<CollectionDescriptor> cols = Collections.singleton(col);
  Set<ReferenceDescriptor> refs = Collections.singleton(ref);
  ClassDescriptor cld = new ClassDescriptor("package.name.Class1", null, false, noAttrs, refs, cols);
  new Model("model1", "package.name", Collections.singleton(cld));
  assertEquals(FieldDescriptor.ONE_N_RELATION, col.relationType());
}
origin: intermine/intermine

public void testFieldDescriptorByName() throws Exception {
  ClassDescriptor cld = new ClassDescriptor(
      "package.name.Class1", null, false,
      getAttributes(), getReferences(), getCollections());
  cld.setAllFieldDescriptors();
  assertNotNull(cld.getFieldDescriptorByName("atd1"));
  assertNotNull(cld.getFieldDescriptorByName("atd2"));
  assertNotNull(cld.getFieldDescriptorByName("rfd1"));
  assertNotNull(cld.getFieldDescriptorByName("rfd2"));
  assertNotNull(cld.getFieldDescriptorByName("cld1"));
  assertNotNull(cld.getFieldDescriptorByName("cld2"));
}
origin: intermine/intermine

public void testConstructorNullType() throws Exception {
  try {
    new AttributeDescriptor("name", null);
    fail("Expected: IllegalArgumentException");
  } catch (IllegalArgumentException e) {
  }
}
origin: intermine/intermine

public void testEquals() throws Exception {
  AttributeDescriptor attr1 = new AttributeDescriptor("name1", "int");
  AttributeDescriptor attr2 = new AttributeDescriptor("name1", "int");
  AttributeDescriptor attr3 = new AttributeDescriptor("name2", "int");
  AttributeDescriptor attr4 = new AttributeDescriptor("name1", "float");
  assertEquals(attr1, attr2);
  assertEquals(attr1.hashCode(), attr2.hashCode());
  assertFalse(attr1.equals(attr3));
  assertFalse(attr1.equals(attr4));
}
origin: intermine/intermine

public void testEquals() throws Exception {
  ReferenceDescriptor ref1 = new ReferenceDescriptor("rfd1", "Class2", "rfd1");
  ReferenceDescriptor ref2 = new ReferenceDescriptor("rfd1", "Class2", "rfd1");
  ReferenceDescriptor ref3 = new ReferenceDescriptor("rfd2", "Class2", "rfd1");
  ReferenceDescriptor ref5 = new ReferenceDescriptor("rfd1", "Class3", "rfd1");
  ReferenceDescriptor ref6 = new ReferenceDescriptor("rfd1", "Class2", "rfd2");
  assertEquals(ref1, ref2);
  assertEquals(ref1.hashCode(), ref2.hashCode());
  assertFalse(ref1.equals(ref3));
  assertFalse(ref1.equals(ref5));
  assertFalse(ref1.equals(ref6));
}
origin: intermine/intermine

  public void testToString() throws Exception {
    CollectionDescriptor col = new CollectionDescriptor("ref", "package.name.Class1", null);
    String expected = "<collection name=\"ref\" referenced-type=\"Class1\"/>";
    assertEquals(col.toString(), expected);
    col = new CollectionDescriptor("ref", "package.name.Class1", "reverseRef");
    expected = "<collection name=\"ref\" referenced-type=\"Class1\" reverse-reference=\"reverseRef\"/>";
    assertEquals(col.toString(), expected);
  }
}
origin: intermine/intermine

public void testConstructNameNull() {
  try {
    new ClassDescriptor("", null, false, noAttrs, noRefs, noColls);
    fail("Expected: IllegalArgumentException");
  } catch (IllegalArgumentException e) {
  }
}
origin: intermine/intermine

public void testCapitalise() throws Exception {
  assertEquals("A", StringUtil.capitalise("a"));
  assertEquals("A", StringUtil.capitalise("A"));
  assertEquals("Aaaa", StringUtil.capitalise("aaaa"));
  assertEquals("AaaaBbbb", StringUtil.capitalise("aaaaBbbb"));
  assertEquals("", StringUtil.capitalise(""));
  assertNull(StringUtil.capitalise(null));
}
origin: intermine/intermine

public void testReverseCapitalisation() throws Exception {
  assertEquals("a", StringUtil.reverseCapitalisation("A"));
  assertEquals("A", StringUtil.reverseCapitalisation("a"));
  assertEquals("aa", StringUtil.reverseCapitalisation("Aa"));
  assertEquals("AA", StringUtil.reverseCapitalisation("aA"));
  assertEquals("", StringUtil.reverseCapitalisation(""));
  assertNull(StringUtil.reverseCapitalisation(null));
}
origin: intermine/intermine

public void testConstructorNull() throws Exception {
  try {
    new PrimaryKey("key", null, null);
    fail("Expected NullPointerException");
  } catch (NullPointerException e) {
  }
}
origin: intermine/intermine

public void testCountOccurancesNullStr() throws Exception {
  try {
    StringUtil.countOccurances(null, "A test string");
    fail("Expected: NullPointerException");
  }
  catch (NullPointerException e) {
  }
}
origin: intermine/intermine

public void testIndefiniteArticle() throws Exception {
  assertEquals("a", StringUtil.indefiniteArticle("monkey"));
  assertEquals("an", StringUtil.indefiniteArticle("emu"));
  assertEquals("a", StringUtil.indefiniteArticle("TLA"));
  assertEquals("an", StringUtil.indefiniteArticle("O"));
  assertEquals("an", StringUtil.indefiniteArticle("IMP"));
}
origin: intermine/intermine

public void testConstructorEmptyType() throws Exception {
  try {
    new AttributeDescriptor("name", "");
    fail("Expected: IllegalArgumentException");
  } catch (IllegalArgumentException e) {
  }
}
origin: intermine/intermine

public void testSetClassDescriptorTwice() throws Exception {
  FieldDescriptor fd = new TestFieldDescriptor("name");
  ClassDescriptor cld = makeClass("Class1");
  fd.setClassDescriptor(cld);
  try {
    fd.setClassDescriptor(cld);
    fail("Expected IllegalStateException");
  } catch (IllegalStateException e) {
  }
}
origin: intermine/intermine

public void testConstructorNullName() throws Exception {
  try {
    new AttributeDescriptor(null, "int");
    fail("Expected IllegalArgumentException");
  } catch (IllegalArgumentException e) {
  }
}
origin: intermine/intermine

public void testConstructorEmptyName() throws Exception {
  try {
    new AttributeDescriptor("", "int");
    fail("Expected IllegalArgumentException");
  } catch (IllegalArgumentException e) {
  }
}
org.intermine.metadata

Most used classes

  • ClassDescriptor
    Describe a business model class. Gives access to attribute, reference and collection descriptors. In
  • Model
    Represents a named business model, makes available metadata for each class within model.
  • TypeUtil
    Provides utility methods for working with Java types and reflection
  • AttributeDescriptor
    Describes an attribute of a class - i.e. a field that is neither an object reference or a collection
  • FieldDescriptor
    Abstract representation of a field within a class - could be an attribute, an object reference or a
  • Util,
  • ReferenceDescriptor,
  • CollectionDescriptor,
  • ConstraintOp,
  • InterMineModelParser,
  • PrimaryKey,
  • PrimaryKeyUtil,
  • MetaDataException,
  • TypeUtil$FieldInfo,
  • DescriptorUtils,
  • ModelFactory,
  • ModelParser,
  • NonOverrideableProperties,
  • SAXParser
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now