Exemple #1
0
 public void test_Reaction_addReactant()
 {
     SpeciesReference sr = new  SpeciesReference(2,4);
       sr.setSpecies( "s");
       R.addReactant(sr);
       assertTrue( R.getNumReactants() == 1 );
       assertTrue( R.getNumProducts() == 0 );
       assertTrue( R.getNumModifiers() == 0 );
       sr = null;
 }
 public void test_Reaction_addProduct1()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = new  SpeciesReference(2,2);
       SpeciesReference p1 = new  SpeciesReference(2,2);
       p1.setSpecies( "k");
       p1.setId( "k1");
       int i = m.addProduct(p);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       p.setSpecies( "k");
       p.setId( "k1");
       i = m.addProduct(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumProducts() == 1 );
       i = m.addProduct(p1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumProducts() == 1 );
       p = null;
       p1 = null;
       m = null;
 }
 public void test_internal_consistency_check_99921()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       SpeciesReference sr = new SpeciesReference(2,4);
       d.setLevelAndVersion(2,1,false);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId("c");
       Species s = m.createSpecies();
       s.setId("s");
       Reaction r = m.createReaction();
       r.setId("r");
       s.setCompartment("c");
       sr.setSpecies("s");
       sr.setName("mmm");
       r.addReactant(sr);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
Exemple #4
0
 public void test_Reaction_getReactantById()
 {
     SpeciesReference sr1 = new  SpeciesReference(2,4);
       sr1.setSpecies( "R1");
       SpeciesReference sr2 = new  SpeciesReference(2,4);
       sr2.setSpecies( "R2");
       R.addReactant(sr1);
       R.addReactant(sr2);
       assertTrue( R.getNumReactants() == 2 );
       assertTrue( R.getNumProducts() == 0 );
       assertTrue( R.getNumModifiers() == 0 );
       assertNotEquals(R.getReactant( "R1"),sr1);
       assertNotEquals(R.getReactant( "R2"),sr2);
       assertEquals(R.getReactant( "R3"),null);
       sr1 = null;
       sr2 = null;
 }
Exemple #5
0
 public void test_Reaction_getReactant()
 {
     SpeciesReference sr1 = new  SpeciesReference(2,4);
       SpeciesReference sr2 = new  SpeciesReference(2,4);
       sr1.setSpecies( "R1");
       sr2.setSpecies( "R2");
       R.addReactant(sr1);
       R.addReactant(sr2);
       sr1 = null;
       sr2 = null;
       assertTrue( R.getNumReactants() == 2 );
       assertTrue( R.getNumProducts() == 0 );
       assertTrue( R.getNumModifiers() == 0 );
       sr1 = R.getReactant(0);
       sr2 = R.getReactant(1);
       assertTrue((  "R1" == sr1.getSpecies() ));
       assertTrue((  "R2" == sr2.getSpecies() ));
 }
 public void test_Reaction_addProduct3()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = new  SpeciesReference(1,2);
       p.setSpecies( "k");
       int i = m.addProduct(p);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumProducts() == 0 );
       p = null;
       m = null;
 }
 public void test_L3_SpeciesReference_hasRequiredAttributes()
 {
     SpeciesReference sr = new  SpeciesReference(3,1);
       assertEquals( false, sr.hasRequiredAttributes() );
       sr.setSpecies( "id");
       assertEquals( false, sr.hasRequiredAttributes() );
       sr.setConstant(false);
       assertEquals( true, sr.hasRequiredAttributes() );
       sr = null;
 }
 public void test_Reaction_addReactant2()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = new  SpeciesReference(2,1);
       p.setSpecies( "k");
       int i = m.addReactant(p);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumReactants() == 0 );
       p = null;
       m = null;
 }
 public void test_SpeciesReference_Reactant_parent_add()
 {
     SpeciesReference sr = new SpeciesReference(2,4);
       Reaction r = new Reaction(2,4);
       sr.setSpecies("s");
       r.addReactant(sr);
       sr = null;
       ListOf lo = r.getListOfReactants();
       assertTrue( lo == r.getReactant(0).getParentSBMLObject() );
       assertTrue( r == lo.getParentSBMLObject() );
 }
 public void test_SpeciesReference()
 {
     SpeciesReference sr = new SpeciesReference(2,4);
       assertEquals( false, (sr.hasRequiredAttributes()) );
       sr.setSpecies("sr");
       assertEquals( true, sr.hasRequiredAttributes() );
       sr = null;
 }
 public void test_SpeciesReference_setSpecies3()
 {
     SpeciesReference c = new  SpeciesReference(2,2);
       int i = c.setSpecies( "mole");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue((  "mole" == c.getSpecies() ));
       assertEquals( true, c.isSetSpecies() );
       c = null;
 }
 public void test_SpeciesReference_setSpecies2()
 {
     SpeciesReference c = new  SpeciesReference(2,2);
       int i = c.setSpecies( "1cell");
       assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
       assertEquals( false, c.isSetSpecies() );
       c = null;
 }
Exemple #13
0
 public void test_SpeciesReference_Reactant_ancestor_add()
 {
     SpeciesReference sr = new SpeciesReference(2,4);
       Reaction r = new Reaction(2,4);
       sr.setSpecies("s");
       r.addReactant(sr);
       sr = null;
       ListOf lo = r.getListOfReactants();
       SpeciesReference obj = r.getReactant(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_REACTION) == r );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
 }