diff --git a/CHANGELOG b/CHANGELOG index d9f196003ed28438e2fded7d718afdee0c5e5a17..c0aedb3bea0c6d69da97a1871df71aac404d2dd4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ -minerva (11alpha) stable; urgency=medium +minerva (10.0.1) unstable; urgency=medium - * Export to image without selecting region + * Bug fix: export to image + * Bug fix: trigger reaction and physical stimulation reactions are no longer allowed (CellDesigner data model issue) minerva (10) stable; urgency=medium diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/PhysicalStimulationReaction.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/PhysicalStimulationReaction.java deleted file mode 100644 index 2de617ad83e0f73dc2ff265aaab059dbaefd884b..0000000000000000000000000000000000000000 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/PhysicalStimulationReaction.java +++ /dev/null @@ -1,68 +0,0 @@ -package lcsb.mapviewer.model.map.reaction.type; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.reaction.Reaction; - -/** - * This class defines a standard CellDesigner physical stimulation reaction. It - * must have at least one reactant and one product. - * - * @author Piotr Gawron - * - */ -@Entity -@DiscriminatorValue("PHYSICAL_STIMULATION_REACTION") -public class PhysicalStimulationReaction extends Reaction implements SimpleReactionInterface { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Default constructor. - */ - public PhysicalStimulationReaction() { - super(); - } - - /** - * Constructor that copies data from the parameter given in the argument. - * - * @param result - * parent reaction from which we copy data - */ - public PhysicalStimulationReaction(Reaction result) { - super(result); - if (result.getProducts().size() < 1) { - throw new InvalidArgumentException("Reaction cannot be transformed to " + getStringType() + ": number of products must be greater than 0"); - } - if (result.getReactants().size() < 1) { - throw new InvalidArgumentException("Reaction cannot be transformed to " + getStringType() + ": number of reactants must be greater than 0"); - } - } - - @Override - public String getStringType() { - return "Physical stimulation"; - } - - @Override - public ReactionRect getReactionRect() { - return ReactionRect.RECT_EMPTY; - } - - @Override - public PhysicalStimulationReaction copy() { - if (this.getClass() == PhysicalStimulationReaction.class) { - return new PhysicalStimulationReaction(this); - } else { - throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); - } - } - -} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/TriggerReaction.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/TriggerReaction.java deleted file mode 100644 index f3e2b83952cfe7b8b84d063761c5b9961065eb0d..0000000000000000000000000000000000000000 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/TriggerReaction.java +++ /dev/null @@ -1,68 +0,0 @@ -package lcsb.mapviewer.model.map.reaction.type; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.reaction.Reaction; - -/** - * This class defines a standard CellDesigner trigger reaction. It must have at - * least one reactant and one product. - * - * @author Piotr Gawron - * - */ -@Entity -@DiscriminatorValue("TRIGGER_REACTION") -public class TriggerReaction extends Reaction implements SimpleReactionInterface { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Default constructor. - */ - public TriggerReaction() { - super(); - } - - /** - * Constructor that copies data from the parameter given in the argument. - * - * @param result - * parent reaction from which we copy data - */ - public TriggerReaction(Reaction result) { - super(result); - if (result.getProducts().size() < 1) { - throw new InvalidArgumentException("Reaction cannot be transformed to " + getStringType() + ": number of products must be greater than 0"); - } - if (result.getReactants().size() < 1) { - throw new InvalidArgumentException("Reaction cannot be transformed to " + getStringType() + ": number of reactants must be greater than 0"); - } - } - - @Override - public String getStringType() { - return "Trigger"; - } - - @Override - public ReactionRect getReactionRect() { - return ReactionRect.RECT_EMPTY; - } - - @Override - public TriggerReaction copy() { - if (this.getClass() == TriggerReaction.class) { - return new TriggerReaction(this); - } else { - throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); - } - } - -} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionComparatorTest.java index c93c52c6c9fceea90b5b27e4bf488436c440213f..7e8fc6042ca893c833da491c4e85ad14eed6ffc6 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionComparatorTest.java @@ -1,300 +1,300 @@ -package lcsb.mapviewer.model.map.reaction; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.awt.geom.Point2D; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.model.graphics.PolylineData; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.MiriamRelationType; -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.modifier.Catalysis; -import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.reaction.type.TriggerReaction; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Unknown; - -public class ReactionComparatorTest { - - ReactionComparator comparator = new ReactionComparator(); - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testEquals() { - try { - Reaction reaction1 = createReaction(); - Reaction reaction2 = createReaction(); - assertEquals(0, comparator.compare(reaction1, reaction2)); - assertEquals(0, comparator.compare(reaction2, reaction1)); - assertEquals(0, comparator.compare(reaction1, reaction1)); - assertEquals(0, comparator.compare(null, null)); - - } catch (Exception e) { - e.printStackTrace(); - fail("Unknown exception"); - } - } - - @Test - public void testDifferent3() { - try { - Reaction reaction1 = createReaction(); - Reaction reaction2 = createReaction(); - - reaction1.setNotes("a"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setIdReaction("a"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setKineticLaw(true); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setSymbol("a"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setFormula("a"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setSubsystem("a"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setGeneProteinReaction("a"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setMechanicalConfidenceScore(1); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setLowerBound(1.2); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.setUpperBound(4.3); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.addSynonym("syn"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.addNode(new AndOperator()); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - } catch (Exception e) { - e.printStackTrace(); - fail("Unknown exception"); - } - } - - @Test - public void testDifferent4() { - try { - Reaction reaction1 = createReaction(); - Reaction reaction2 = createReaction(); - - reaction1.addNode(new AndOperator()); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - } catch (Exception e) { - e.printStackTrace(); - fail("Unknown exception"); - } - } - - @Test - public void testDifferent2() { - try { - Reaction reaction1 = createReaction(); - assertTrue(comparator.compare(reaction1, null) != 0); - assertTrue(comparator.compare(null, reaction1) != 0); - - } catch (Exception e) { - e.printStackTrace(); - fail("Unknown exception"); - } - } - - @Test - public void testDifferent() { - try { - - assertTrue(comparator.compare(new TransportReaction(), new TriggerReaction()) != 0); - - Reaction reaction1 = createReaction(); - Reaction reaction2 = createReaction(); - - reaction1.setReversible(true); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.addModifier(new Modifier()); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.getModifiers().get(0).getAlias().setAliasId("dfshkj"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.addReactant(new Reactant()); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.getReactants().get(0).getAlias().setAliasId("dfshkj"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.addProduct(new Product()); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.getProducts().get(0).getAlias().setAliasId("dfshkj"); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.getOperators().get(0).getLine().addPoint(new Point2D.Double(2, 2)); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - reaction1 = createReaction(); - reaction2 = createReaction(); - - reaction1.getMiriamData().add(new MiriamData(MiriamRelationType.BQ_BIOL_ENCODES, MiriamType.UNKNOWN, "c")); - assertTrue(comparator.compare(reaction1, reaction2) != 0); - assertTrue(comparator.compare(reaction2, reaction1) != 0); - - } catch (Exception e) { - e.printStackTrace(); - fail("Unknown exception"); - } - } - - private Reaction createReaction() { - Reaction reaction = new Reaction(); - Protein protein = new Protein(); - protein.setName("ASD"); - SpeciesAlias alias = new SpeciesAlias(protein); - Reactant reactant = new Reactant(alias, protein); - - Protein protein2 = new Protein(); - protein2.setName("ASD2"); - SpeciesAlias alias2 = new SpeciesAlias(protein2); - Reactant reactant2 = new Reactant(alias2, protein2); - - SimpleMolecule molecule = new SimpleMolecule(); - molecule.setName("mol"); - SpeciesAlias moelculeAlias = new SpeciesAlias(molecule); - Product product = new Product(moelculeAlias, molecule); - - Unknown unknown = new Unknown(); - unknown.setName("unk"); - SpeciesAlias unknownAlias = new SpeciesAlias(unknown); - Modifier modifier = new Catalysis(unknownAlias, unknown); - - AndOperator operator = new AndOperator(); - operator.setLine(new PolylineData(new Point2D.Double(2, 2), new Point2D.Double(4, 4))); - operator.addInput(reactant); - operator.addInput(reactant2); - - reaction.addModifier(modifier); - reaction.addReactant(reactant); - reaction.addReactant(reactant2); - reaction.addProduct(product); - reaction.addNode(operator); - return reaction; - } - - @Test - public void testDifferentNewFields() throws Exception { - try { - Reaction reaction1 = createReaction(); - Reaction reaction2 = createReaction(); - reaction2.setAbbreviation("ABRR"); - - assertTrue(comparator.compare(reaction1, reaction2) != 0); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} +package lcsb.mapviewer.model.map.reaction; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.awt.geom.Point2D; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.model.graphics.PolylineData; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.MiriamRelationType; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; +import lcsb.mapviewer.model.map.modifier.Catalysis; +import lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction; +import lcsb.mapviewer.model.map.reaction.type.TransportReaction; +import lcsb.mapviewer.model.map.species.Protein; +import lcsb.mapviewer.model.map.species.SimpleMolecule; +import lcsb.mapviewer.model.map.species.Unknown; + +public class ReactionComparatorTest { + + ReactionComparator comparator = new ReactionComparator(); + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testEquals() { + try { + Reaction reaction1 = createReaction(); + Reaction reaction2 = createReaction(); + assertEquals(0, comparator.compare(reaction1, reaction2)); + assertEquals(0, comparator.compare(reaction2, reaction1)); + assertEquals(0, comparator.compare(reaction1, reaction1)); + assertEquals(0, comparator.compare(null, null)); + + } catch (Exception e) { + e.printStackTrace(); + fail("Unknown exception"); + } + } + + @Test + public void testDifferent3() { + try { + Reaction reaction1 = createReaction(); + Reaction reaction2 = createReaction(); + + reaction1.setNotes("a"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setIdReaction("a"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setKineticLaw(true); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setSymbol("a"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setFormula("a"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setSubsystem("a"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setGeneProteinReaction("a"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setMechanicalConfidenceScore(1); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setLowerBound(1.2); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.setUpperBound(4.3); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.addSynonym("syn"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.addNode(new AndOperator()); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + } catch (Exception e) { + e.printStackTrace(); + fail("Unknown exception"); + } + } + + @Test + public void testDifferent4() { + try { + Reaction reaction1 = createReaction(); + Reaction reaction2 = createReaction(); + + reaction1.addNode(new AndOperator()); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + } catch (Exception e) { + e.printStackTrace(); + fail("Unknown exception"); + } + } + + @Test + public void testDifferent2() { + try { + Reaction reaction1 = createReaction(); + assertTrue(comparator.compare(reaction1, null) != 0); + assertTrue(comparator.compare(null, reaction1) != 0); + + } catch (Exception e) { + e.printStackTrace(); + fail("Unknown exception"); + } + } + + @Test + public void testDifferent() { + try { + + assertTrue(comparator.compare(new TransportReaction(), new StateTransitionReaction()) != 0); + + Reaction reaction1 = createReaction(); + Reaction reaction2 = createReaction(); + + reaction1.setReversible(true); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.addModifier(new Modifier()); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.getModifiers().get(0).getAlias().setAliasId("dfshkj"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.addReactant(new Reactant()); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.getReactants().get(0).getAlias().setAliasId("dfshkj"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.addProduct(new Product()); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.getProducts().get(0).getAlias().setAliasId("dfshkj"); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.getOperators().get(0).getLine().addPoint(new Point2D.Double(2, 2)); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + reaction1 = createReaction(); + reaction2 = createReaction(); + + reaction1.getMiriamData().add(new MiriamData(MiriamRelationType.BQ_BIOL_ENCODES, MiriamType.UNKNOWN, "c")); + assertTrue(comparator.compare(reaction1, reaction2) != 0); + assertTrue(comparator.compare(reaction2, reaction1) != 0); + + } catch (Exception e) { + e.printStackTrace(); + fail("Unknown exception"); + } + } + + private Reaction createReaction() { + Reaction reaction = new Reaction(); + Protein protein = new Protein(); + protein.setName("ASD"); + SpeciesAlias alias = new SpeciesAlias(protein); + Reactant reactant = new Reactant(alias, protein); + + Protein protein2 = new Protein(); + protein2.setName("ASD2"); + SpeciesAlias alias2 = new SpeciesAlias(protein2); + Reactant reactant2 = new Reactant(alias2, protein2); + + SimpleMolecule molecule = new SimpleMolecule(); + molecule.setName("mol"); + SpeciesAlias moelculeAlias = new SpeciesAlias(molecule); + Product product = new Product(moelculeAlias, molecule); + + Unknown unknown = new Unknown(); + unknown.setName("unk"); + SpeciesAlias unknownAlias = new SpeciesAlias(unknown); + Modifier modifier = new Catalysis(unknownAlias, unknown); + + AndOperator operator = new AndOperator(); + operator.setLine(new PolylineData(new Point2D.Double(2, 2), new Point2D.Double(4, 4))); + operator.addInput(reactant); + operator.addInput(reactant2); + + reaction.addModifier(modifier); + reaction.addReactant(reactant); + reaction.addReactant(reactant2); + reaction.addProduct(product); + reaction.addNode(operator); + return reaction; + } + + @Test + public void testDifferentNewFields() throws Exception { + try { + Reaction reaction1 = createReaction(); + Reaction reaction2 = createReaction(); + reaction2.setAbbreviation("ABRR"); + + assertTrue(comparator.compare(reaction1, reaction2) != 0); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/AllReactionTypeTests.java b/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/AllReactionTypeTests.java index 65378cef4adcdbee7707aa77e73736fd3d27f1b5..814c337da84987b319d81f56d972b0152feb120e 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/AllReactionTypeTests.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/AllReactionTypeTests.java @@ -1,33 +1,32 @@ -package lcsb.mapviewer.model.map.reaction.type; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({ BooleanLogicGateReactionTest.class, // - DissociationReactionTest.class, // - HeterodimerAssociationReactionTest.class, // - KnownTransitionOmittedReactionTest.class, // - NegativeInfluenceReactionTest.class, // - PhysicalStimulationReactionTest.class, // - PositiveInfluenceReactionTest.class, // - ReactionRectTest.class, // - ReducedModulationReactionTest.class, // - ReducedPhysicalStimulationReactionTest.class, // - ReducedTriggerReactionTest.class, // - StateTransitionReactionTest.class, // - TranscriptionReactionTest.class, // - TranslationReactionTest.class, TransportReactionTest.class, // - TriggerReactionTest.class, // - TruncationReactionTest.class, // - UnknownNegativeInfluenceReactionTest.class, // - UnknownPositiveInfluenceReactionTest.class, // - UnknownReducedModulationReactionTest.class, // - UnknownReducedPhysicalStimulationReactionTest.class, // - UnknownReducedTriggerReactionTest.class, // - UnknownTransitionReactionTest.class, // -}) -public class AllReactionTypeTests { - -} +package lcsb.mapviewer.model.map.reaction.type; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ BooleanLogicGateReactionTest.class, // + DissociationReactionTest.class, // + HeterodimerAssociationReactionTest.class, // + KnownTransitionOmittedReactionTest.class, // + NegativeInfluenceReactionTest.class, // + PositiveInfluenceReactionTest.class, // + ReactionRectTest.class, // + ReducedModulationReactionTest.class, // + ReducedPhysicalStimulationReactionTest.class, // + ReducedTriggerReactionTest.class, // + StateTransitionReactionTest.class, // + TranscriptionReactionTest.class, // + TranslationReactionTest.class, // + TransportReactionTest.class, // + TruncationReactionTest.class, // + UnknownNegativeInfluenceReactionTest.class, // + UnknownPositiveInfluenceReactionTest.class, // + UnknownReducedModulationReactionTest.class, // + UnknownReducedPhysicalStimulationReactionTest.class, // + UnknownReducedTriggerReactionTest.class, // + UnknownTransitionReactionTest.class, // +}) +public class AllReactionTypeTests { + +} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/PhysicalStimulationReactionTest.java b/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/PhysicalStimulationReactionTest.java deleted file mode 100644 index 9b0b015a796fc5d5e697f236a5847255d13969e1..0000000000000000000000000000000000000000 --- a/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/PhysicalStimulationReactionTest.java +++ /dev/null @@ -1,126 +0,0 @@ -package lcsb.mapviewer.model.map.reaction.type; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import org.apache.commons.lang3.SerializationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.reaction.Product; -import lcsb.mapviewer.model.map.reaction.Reactant; -import lcsb.mapviewer.model.map.reaction.Reaction; - -public class PhysicalStimulationReactionTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new PhysicalStimulationReaction()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructorWithInvalidArg() { - try { - Reaction reaction = new Reaction(); - new PhysicalStimulationReaction(reaction); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructorWithInvalidArg2() { - try { - Reaction reaction = new Reaction(); - reaction.addProduct(new Product()); - new PhysicalStimulationReaction(reaction); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructor() { - try { - Reaction reaction = new Reaction(); - reaction.addProduct(new Product()); - reaction.addReactant(new Reactant()); - PhysicalStimulationReaction validReaction = new PhysicalStimulationReaction(reaction); - assertNotNull(validReaction); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCopy() { - try { - PhysicalStimulationReaction original = new PhysicalStimulationReaction(); - original.addProduct(new Product()); - original.addReactant(new Reactant()); - original.addReactant(new Reactant()); - PhysicalStimulationReaction product = original.copy(); - assertNotNull(product); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testInvalidCopy() { - try { - new PhysicalStimulationReaction() { - - /** - * - */ - private static final long serialVersionUID = 1L; - }.copy(); - fail("Exception expected"); - } catch (NotImplementedException e) { - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetters() { - try { - PhysicalStimulationReaction original = new PhysicalStimulationReaction(); - assertNotNull(original.getReactionRect()); - assertNotNull(original.getStringType()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/TriggerReactionTest.java b/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/TriggerReactionTest.java deleted file mode 100644 index 87deb1a50e799766676847330d889d58023ad4a2..0000000000000000000000000000000000000000 --- a/model/src/test/java/lcsb/mapviewer/model/map/reaction/type/TriggerReactionTest.java +++ /dev/null @@ -1,126 +0,0 @@ -package lcsb.mapviewer.model.map.reaction.type; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import org.apache.commons.lang3.SerializationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.reaction.Product; -import lcsb.mapviewer.model.map.reaction.Reactant; -import lcsb.mapviewer.model.map.reaction.Reaction; - -public class TriggerReactionTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new TriggerReaction()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructorWithInvalidArg() { - try { - Reaction reaction = new Reaction(); - new TriggerReaction(reaction); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructorWithInvalidArg2() { - try { - Reaction reaction = new Reaction(); - reaction.addProduct(new Product()); - new TriggerReaction(reaction); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructor() { - try { - Reaction reaction = new Reaction(); - reaction.addProduct(new Product()); - reaction.addReactant(new Reactant()); - TriggerReaction validReaction = new TriggerReaction(reaction); - assertNotNull(validReaction); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - - @Test - public void testCopy() { - try { - TriggerReaction original = new TriggerReaction(); - original.addProduct(new Product()); - original.addReactant(new Reactant()); - original.addReactant(new Reactant()); - TriggerReaction product = original.copy(); - assertNotNull(product); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testInvalidCopy() { - try { - new TriggerReaction() { - - /** - * - */ - private static final long serialVersionUID = 1L; - }.copy(); - fail("Exception expected"); - } catch (NotImplementedException e) { - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetters() { - try { - TriggerReaction original = new TriggerReaction(); - assertNotNull(original.getReactionRect()); - assertNotNull(original.getStringType()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } -} diff --git a/persist/src/db/11/fix_db_20160907.sql b/persist/src/db/10.0.1/fix_db_20160907.sql similarity index 100% rename from persist/src/db/11/fix_db_20160907.sql rename to persist/src/db/10.0.1/fix_db_20160907.sql diff --git a/persist/src/db/10.0.1/fix_db_20160909.sql b/persist/src/db/10.0.1/fix_db_20160909.sql new file mode 100644 index 0000000000000000000000000000000000000000..9fb11c2f43a3a690d3f8d8760359531a93d10b00 --- /dev/null +++ b/persist/src/db/10.0.1/fix_db_20160909.sql @@ -0,0 +1,4 @@ +-- fix on issue #8 +update reaction_table set reaction_type_db='REDUCED_TRIGGER_REACTION' where reaction_type_db = 'TRIGGER_REACTION'; +update reaction_table set reaction_type_db='REDUCED_PHYSICAL_STIMULATION' where reaction_type_db = 'PHYSICAL_STIMULATION_REACTION'; + diff --git a/persist/src/main/resources/applicationContext-persist.xml b/persist/src/main/resources/applicationContext-persist.xml index d551dccd27377605ab35db17e27a9b3bd768bf7d..868a5f46896a9b02d3f58a1e17b35e7c49a25910 100644 --- a/persist/src/main/resources/applicationContext-persist.xml +++ b/persist/src/main/resources/applicationContext-persist.xml @@ -76,7 +76,6 @@ <value>lcsb.mapviewer.model.map.reaction.type.HeterodimerAssociationReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.KnownTransitionOmittedReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.NegativeInfluenceReaction</value> - <value>lcsb.mapviewer.model.map.reaction.type.PhysicalStimulationReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.PositiveInfluenceReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.ReducedModulationReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.ReducedPhysicalStimulationReaction</value> @@ -85,7 +84,6 @@ <value>lcsb.mapviewer.model.map.reaction.type.TranscriptionReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.TranslationReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.TransportReaction</value> - <value>lcsb.mapviewer.model.map.reaction.type.TriggerReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.TruncationReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.UnknownNegativeInfluenceReaction</value> <value>lcsb.mapviewer.model.map.reaction.type.UnknownPositiveInfluenceReaction</value>