Changeset 730

Show
Ignore:
Timestamp:
15-05-12 11:38:51 (2 years ago)
Author:
hailiang.mei@…
Message:

add/refactor branchId in history tables.

Location:
trunk/code/conceptwiki
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • trunk/code/conceptwiki/common/common-api/src/main/java/nl/nbic/conceptwiki/common/api/TripleChangeset.java

    r726 r730  
    3030     */ 
    3131    @NotNull 
    32     TripleActionType getActionType(); 
    33      
    34     /** 
    35      * Retrieve the branch where this triple belongs to. 
    36      * @return a positive integer, representing the {@code Branch} identifier. 
    37      */ 
    38     @Min(0) 
    39     int getBranchId(); 
     32    TripleActionType getActionType();     
    4033} 
  • trunk/code/conceptwiki/common/common-api/src/main/java/nl/nbic/conceptwiki/common/impl/TripleChangesetImpl.java

    r729 r730  
    1616    private static final long serialVersionUID = 5750886306916943345L; 
    1717    /** 
    18      * The branch where this action is performed at the changed triple. 
    19      */ 
    20     protected int branchId; 
    21     /** 
    2218     * The action performed at the changed triple. 
    2319     */ 
     
    3026    /** 
    3127     * Default constructor. 
    32      * @param branchId the branch where this action takes place. 
    3328     * @param action an add or remove action 
    3429     * @param triple a POJO triple that is either created or removed. 
    3530     */ 
    36     public TripleChangesetImpl(final int branchId, final TripleActionType action, final Triple triple) { 
    37         this.branchId = branchId; 
     31    public TripleChangesetImpl(final TripleActionType action, final Triple triple) { 
    3832        this.action = action; 
    3933        this.triple = triple; 
     
    6458        return action; 
    6559    } 
    66  
    67     @Override 
    68     public int getBranchId() { 
    69         return branchId; 
    70     } 
    7160} 
  • trunk/code/conceptwiki/common/common-util/src/main/java/nl/nbic/conceptwiki/common/util/impl/ValidationUtilityImpl.java

    r726 r730  
    4949     */ 
    5050    private static final Pattern ILLEGAL_WHITESPACE_PATTERN = Pattern.compile("(\t|\n|\r)"); 
     51    /** 
     52     * The maximum value of branch ID. 
     53     */ 
     54    private static final int MAX_BRANCH_ID = 5; 
    5155 
    5256    /** 
     
    225229        // TODO extend with semantic types validation. 
    226230    } 
     231 
     232    @Override 
     233    public void validateBranchId(int branchId) { 
     234        Preconditions.checkArgument((branchId > 0 && branchId <= MAX_BRANCH_ID), 
     235                "branchId should be within the range of defined branches.");        
     236    } 
    227237} 
  • trunk/code/conceptwiki/common/common-util/src/main/java/nl/nbic/conceptwiki/common/util/ValidationUtility.java

    r726 r730  
    9696     */ 
    9797    void validateTriple(@NotNull Concept subject, @NotNull Concept predicate, @NotNull Concept object); 
     98     
     99    /** 
     100     * Validates the given {@code Integer} by checking whether it is considered a valid {@code Branch} ID. 
     101     * 
     102     * @param branchId a {@code Integer} which should comply to the existed list of branches. 
     103     */ 
     104    void validateBranchId(@NotNull int branchId); 
    98105} 
  • trunk/code/conceptwiki/service/service-api/src/main/java/nl/nbic/conceptwiki/service/api/HistoryService.java

    r729 r730  
    1212    /** 
    1313     * Stores a {@link Concept} revision in the underlying data storage. 
     14     * @param branchId the branch where this revision takes place. 
    1415     * @param uuid the uuid of the {@code Concept} that was updated. 
    1516     * @param changeset the wrapper object for the changes. 
    1617     */ 
    17     void storeRevision(final String uuid, final ConceptChangeset changeset);     
     18    void storeRevision(final int branchId, final String uuid, final ConceptChangeset changeset);     
    1819    /** 
    1920     * Stores a {@link Triple} revision in the underlying data storage. 
     21     * @param branchId the branch where this revision takes place. 
    2022     * @param uuid the uuid of the {@code Triple} that was added or removed. 
    2123     * @param changeset the wrapper object for the changes. 
    2224     */ 
    23     void storeRevision(final String uuid, final TripleChangeset changeset); 
     25    void storeRevision(final int branchId, final String uuid, final TripleChangeset changeset); 
    2426} 
  • trunk/code/conceptwiki/service/service-impl/src/main/java/nl/nbic/conceptwiki/service/impl/ConceptServiceImpl.java

    r726 r730  
    8686         
    8787        // create a new entry in the history table and record the changes 
    88         historyService.storeRevision(createdConcept.getUuid(), changeset); 
     88        historyService.storeRevision(branchId, createdConcept.getUuid(), changeset); 
    8989         
    9090        // let the search service index the newly created concept 
     
    166166        handleAdd(uuid, changeset.getAdd(), branchId); 
    167167         
    168         historyService.storeRevision(uuid, changeset); 
     168        historyService.storeRevision(branchId, uuid, changeset); 
    169169         
    170170        // update the indexed concept by  
  • trunk/code/conceptwiki/service/service-impl/src/main/java/nl/nbic/conceptwiki/service/impl/HistoryServiceImpl.java

    r729 r730  
    4848                + tablename 
    4949                + "(transaction_id INT NOT NULL," 
     50                + "branch INT NOT NULL," 
    5051                + "uuid UUID NOT NULL," 
    5152                + "changeset CLOB NOT NULL" 
     
    5657    @Override 
    5758    @Transactional("jdbc") 
    58     public void storeRevision(final String uuid, final ConceptChangeset changeset) { 
     59    public void storeRevision(final int branchId, final String uuid, final ConceptChangeset changeset) { 
    5960        validationUtility.validateUuid(uuid); 
     61        validationUtility.validateBranchId(branchId); 
    6062        validationUtility.validateChangeset(changeset); 
    6163        final String serializedChangeset = changesetSerializer.serialize(changeset); 
    62         final Object[] params = constructParams(1, uuid, serializedChangeset); 
    63         jdbcTemplate.update("INSERT INTO concept_revisions (transaction_id, uuid, changeset) VALUES(?, ?, ?)", params); 
     64        final Object[] params = constructParams(1, branchId, uuid, serializedChangeset); 
     65        jdbcTemplate.update("INSERT INTO concept_revisions (transaction_id, branch, uuid, changeset) VALUES(?, ?, ?, ?)", params); 
    6466    } 
    6567     
     
    6769    @Override 
    6870    @Transactional("jdbc") 
    69     public void storeRevision(final String uuid, final TripleChangeset changeset) { 
     71    public void storeRevision(final int branchId, final String uuid, final TripleChangeset changeset) { 
    7072        validationUtility.validateUuid(uuid); 
     73        validationUtility.validateBranchId(branchId); 
    7174        final String serializedChangeset = changesetSerializer.serialize(changeset); 
    72         final Object[] params = constructParams(1, uuid, serializedChangeset); 
    73         jdbcTemplate.update("INSERT INTO triple_revisions (transaction_id, uuid, changeset) VALUES(?, ?, ?)", params); 
     75        final Object[] params = constructParams(1, branchId, uuid, serializedChangeset); 
     76        jdbcTemplate.update("INSERT INTO triple_revisions (transaction_id, branch, uuid, changeset) VALUES(?, ?, ?, ?)", params); 
    7477         
    7578    } 
  • trunk/code/conceptwiki/service/service-impl/src/main/java/nl/nbic/conceptwiki/service/impl/TripleServiceImpl.java

    r729 r730  
    4949        validationUtility.validateConcept(object); 
    5050        validationUtility.validateTriple(subject, predicate, object); 
     51        validationUtility.validateBranchId(branchId); 
    5152         
    5253        final Triple createdTriple = tripleStorageService.createTriple(subject, predicate, object, branchId); 
    5354         
    54         final TripleChangeset changeset = new TripleChangesetImpl(branchId, TripleActionType.ADD, createdTriple); 
     55        final TripleChangeset changeset = new TripleChangesetImpl(TripleActionType.ADD, createdTriple); 
    5556         
    5657        // create a new entry in the history table and record the changes 
    57         historyService.storeRevision(createdTriple.getUuid(), changeset); 
     58        historyService.storeRevision(branchId, createdTriple.getUuid(), changeset); 
    5859         
    5960        return createdTriple; 
     
    6364    public Triple getTriple(final String uuid, final int branchId) { 
    6465        validationUtility.validateUuid(uuid); 
     66        validationUtility.validateBranchId(branchId); 
    6567        return tripleStorageService.getTriple(uuid, branchId); 
    6668    } 
     
    6971    public boolean deleteTriple(final String uuid, final String comment, final int branchId) { 
    7072        validationUtility.validateUuid(uuid); 
    71          
     73        validationUtility.validateBranchId(branchId); 
    7274        final boolean result = tripleStorageService.deleteTriple(uuid, comment, branchId); 
    7375         
    7476        // only store the revision history for a successful removal. 
    7577        if (result) { 
    76             final TripleChangeset changeset = new TripleChangesetImpl(branchId, TripleActionType.REMOVE, getTriple(uuid, branchId));   
     78            final TripleChangeset changeset = new TripleChangesetImpl(TripleActionType.REMOVE, getTriple(uuid, branchId));   
    7779            // create a new entry in the history table and record the changes 
    78             historyService.storeRevision(uuid, changeset); 
     80            historyService.storeRevision(branchId, uuid, changeset); 
    7981        } 
    8082         
     
    8587    public List<Triple> getTriplesBySubject(final Concept subject, final int branchId, final int limit) { 
    8688        validationUtility.validateConcept(subject); 
     89        validationUtility.validateBranchId(branchId); 
    8790        return tripleStorageService.getTriplesBySubject(subject, branchId, limit); 
    8891    } 
  • trunk/code/conceptwiki/service/service-impl/src/test/java/nl/nbic/conceptwiki/service/ConceptServiceImplUnitTest.java

    r726 r730  
    22 
    33import static nl.nbic.conceptwiki.common.util.CommonTestObjects.PREF_LABEL_A; 
     4import static nl.nbic.conceptwiki.common.util.CommonTestObjects.TEST_BRANCH_A_ID; 
    45import static org.junit.Assert.assertEquals; 
    56import static org.junit.Assert.assertFalse; 
     
    6768public class ConceptServiceImplUnitTest { 
    6869 
    69     public static final String DEFAULT_LABEL = "Malaria"; 
    70     public static final Language DEFAULT_LANGUAGE = new LanguageImpl("en"); 
     70    private static final String DEFAULT_LABEL = "Malaria"; 
     71    private static final Language DEFAULT_LANGUAGE = new LanguageImpl("en"); 
    7172    private static final int DEFAULT_LIMIT = 10; 
    72     /* 
    73      * The branch id used during the tests. 
    74      */ 
    75     private static final int DEFAULT_BRANCH = 1; 
     73     
    7674    /** 
    7775     * System under test. 
     
    324322 
    325323        // exercise 
    326         final Concept result = conceptService.createConcept(concept, DEFAULT_BRANCH); 
     324        final Concept result = conceptService.createConcept(concept, TEST_BRANCH_A_ID); 
    327325 
    328326        // verify 
     
    340338 
    341339        // exercise 
    342         conceptService.createConcept(concept, DEFAULT_BRANCH); 
     340        conceptService.createConcept(concept, TEST_BRANCH_A_ID); 
    343341    } 
    344342 
     
    347345        final Label label = new LabelImpl(LabelType.PREFERRED, DEFAULT_LABEL, DEFAULT_LANGUAGE); 
    348346        final Concept concept = new ConceptImpl.Builder().labels(Sets.newHashSet(label)).build(); 
    349         Mockito.doThrow(new RuntimeException()).when(mockHistoryService).storeRevision(Mockito.anyString(), Mockito.any(ConceptChangeset.class)); 
    350  
    351         // exercise 
    352         conceptService.createConcept(concept, DEFAULT_BRANCH); 
     347        Mockito.doThrow(new RuntimeException()).when(mockHistoryService).storeRevision(Mockito.anyInt(), Mockito.anyString(), Mockito.any(ConceptChangeset.class)); 
     348 
     349        // exercise 
     350        conceptService.createConcept(concept, TEST_BRANCH_A_ID); 
    353351    } 
    354352 
     
    360358 
    361359        // exercise 
    362         conceptService.createConcept(concept, DEFAULT_BRANCH); 
     360        conceptService.createConcept(concept, TEST_BRANCH_A_ID); 
    363361    } 
    364362 
     
    373371 
    374372        Mockito.when(mockStorageService.isExistingConcept(Mockito.anyString())).thenReturn(true); 
    375         Mockito.when(mockStorageService.getConcept(uuid, DEFAULT_BRANCH)).thenReturn(new ConceptImpl.Builder().uuid(uuid).labels(ImmutableSet.of(PREF_LABEL_A)).build()); 
    376  
    377         conceptService.deleteConcept(uuid, "Deletion of a valid concept.", DEFAULT_BRANCH); 
     373        Mockito.when(mockStorageService.getConcept(uuid, TEST_BRANCH_A_ID)).thenReturn(new ConceptImpl.Builder().uuid(uuid).labels(ImmutableSet.of(PREF_LABEL_A)).build()); 
     374 
     375        conceptService.deleteConcept(uuid, "Deletion of a valid concept.", TEST_BRANCH_A_ID); 
    378376 
    379377        Mockito.verify(mockStorageService).markAsDeleted(Mockito.eq(uuid), Mockito.anyString(), Mockito.anyInt()); 
    380         Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(uuid), Mockito.any(ConceptChangeset.class)); 
     378        Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(TEST_BRANCH_A_ID), Mockito.eq(uuid), Mockito.any(ConceptChangeset.class)); 
    381379    } 
    382380 
     
    386384        final String uuid = UUID.randomUUID().toString(); 
    387385 
    388         conceptService.deleteConcept(uuid, "Deletion of a non-existant object.", DEFAULT_BRANCH); 
     386        conceptService.deleteConcept(uuid, "Deletion of a non-existant object.", TEST_BRANCH_A_ID); 
    389387    } 
    390388 
    391389    @Test(expected = IllegalArgumentException.class) 
    392390    public void testDeleteInvalidConcept() { 
    393         conceptService.deleteConcept("Invalid UUID", "Deletion of an invalid UUID", DEFAULT_BRANCH); 
     391        conceptService.deleteConcept("Invalid UUID", "Deletion of an invalid UUID", TEST_BRANCH_A_ID); 
    394392    } 
    395393 
     
    397395    public void testGetNonExistingConcept() { 
    398396        final String uuid = UUID.randomUUID().toString(); 
    399         Mockito.when(mockStorageService.getConcept(uuid, DEFAULT_BRANCH)).thenReturn(null); 
    400         final Concept result = conceptService.getConcept(uuid, DEFAULT_BRANCH); 
     397        Mockito.when(mockStorageService.getConcept(uuid, TEST_BRANCH_A_ID)).thenReturn(null); 
     398        final Concept result = conceptService.getConcept(uuid, TEST_BRANCH_A_ID); 
    401399 
    402400        assertNull(result); 
     
    408406        final Label label = new LabelImpl(LabelType.PREFERRED, DEFAULT_LABEL, DEFAULT_LANGUAGE); 
    409407        final Concept concept = new ConceptImpl.Builder().labels(Sets.newHashSet(label)).uuid(uuid).build(); 
    410         Mockito.when(mockStorageService.getConcept(uuid, DEFAULT_BRANCH)).thenReturn(concept); 
    411  
    412         final Concept result = conceptService.getConcept(uuid, DEFAULT_BRANCH); 
     408        Mockito.when(mockStorageService.getConcept(uuid, TEST_BRANCH_A_ID)).thenReturn(concept); 
     409 
     410        final Concept result = conceptService.getConcept(uuid, TEST_BRANCH_A_ID); 
    413411 
    414412        assertNotNull(result); 
     
    422420        final ConceptChangeset changeset = new ConceptChangesetImpl(); 
    423421 
    424         conceptService.updateConcept(uuid, changeset, DEFAULT_BRANCH); 
     422        conceptService.updateConcept(uuid, changeset, TEST_BRANCH_A_ID); 
    425423    } 
    426424 
     
    431429//        final Concept concept = new ConceptImpl.Builder().labels(Sets.newHashSet(label)).uuid(uuid).build(); 
    432430 
    433         conceptService.updateConcept(uuid, null, DEFAULT_BRANCH); 
     431        conceptService.updateConcept(uuid, null, TEST_BRANCH_A_ID); 
    434432    } 
    435433 
     
    446444        final Concept concept = new ConceptImpl.Builder().labels(Sets.newHashSet(label)).uuid(uuid).build(); 
    447445 
    448         Mockito.when(mockStorageService.getConcept(uuid, DEFAULT_BRANCH)).thenReturn(concept); 
    449  
    450         conceptService.updateConcept(uuid, changeset, DEFAULT_BRANCH); 
     446        Mockito.when(mockStorageService.getConcept(uuid, TEST_BRANCH_A_ID)).thenReturn(concept); 
     447 
     448        conceptService.updateConcept(uuid, changeset, TEST_BRANCH_A_ID); 
    451449 
    452450        Mockito.verify(validationUtility).validateChangeset(changeset); 
    453451        Mockito.verify(validationUtility).validateConceptUpdate(concept, changeset); 
    454         Mockito.verify(mockStorageService).addLabels(Mockito.eq(uuid), Mockito.eq(newLabels), Mockito.eq(DEFAULT_BRANCH)); 
    455         Mockito.verify(mockStorageService).removeLabels(Mockito.eq(uuid), Mockito.eq(oldLabels), Mockito.eq(DEFAULT_BRANCH)); 
    456         Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(uuid), Mockito.eq(changeset)); 
     452        Mockito.verify(mockStorageService).addLabels(Mockito.eq(uuid), Mockito.eq(newLabels), Mockito.eq(TEST_BRANCH_A_ID)); 
     453        Mockito.verify(mockStorageService).removeLabels(Mockito.eq(uuid), Mockito.eq(oldLabels), Mockito.eq(TEST_BRANCH_A_ID)); 
     454        Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(TEST_BRANCH_A_ID), Mockito.eq(uuid), Mockito.eq(changeset)); 
    457455    } 
    458456 
     
    470468        final Concept concept = new ConceptImpl.Builder().labels(Sets.newHashSet(label)).uuid(uuid).notes(oldOnes).build(); 
    471469 
    472         Mockito.when(mockStorageService.getConcept(uuid, DEFAULT_BRANCH)).thenReturn(concept); 
    473  
    474         conceptService.updateConcept(uuid, changeset, DEFAULT_BRANCH); 
     470        Mockito.when(mockStorageService.getConcept(uuid, TEST_BRANCH_A_ID)).thenReturn(concept); 
     471 
     472        conceptService.updateConcept(uuid, changeset, TEST_BRANCH_A_ID); 
    475473 
    476474        Mockito.verify(validationUtility).validateChangeset(changeset); 
    477475        Mockito.verify(validationUtility).validateConceptUpdate(concept, changeset); 
    478         Mockito.verify(mockStorageService).addNotes(Mockito.eq(uuid), Mockito.eq(newOnes), Mockito.eq(DEFAULT_BRANCH)); 
    479         Mockito.verify(mockStorageService).removeNotes(Mockito.eq(uuid), Mockito.eq(oldOnes), Mockito.eq(DEFAULT_BRANCH)); 
    480         Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(uuid), Mockito.eq(changeset)); 
     476        Mockito.verify(mockStorageService).addNotes(Mockito.eq(uuid), Mockito.eq(newOnes), Mockito.eq(TEST_BRANCH_A_ID)); 
     477        Mockito.verify(mockStorageService).removeNotes(Mockito.eq(uuid), Mockito.eq(oldOnes), Mockito.eq(TEST_BRANCH_A_ID)); 
     478        Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(TEST_BRANCH_A_ID), Mockito.eq(uuid), Mockito.eq(changeset)); 
    481479    } 
    482480 
     
    494492        final Concept concept = new ConceptImpl.Builder().labels(Sets.newHashSet(label)).uuid(uuid).notations(oldOnes).build(); 
    495493 
    496         Mockito.when(mockStorageService.getConcept(uuid, DEFAULT_BRANCH)).thenReturn(concept); 
    497  
    498         conceptService.updateConcept(uuid, changeset, DEFAULT_BRANCH); 
     494        Mockito.when(mockStorageService.getConcept(uuid, TEST_BRANCH_A_ID)).thenReturn(concept); 
     495 
     496        conceptService.updateConcept(uuid, changeset, TEST_BRANCH_A_ID); 
    499497 
    500498        Mockito.verify(validationUtility).validateChangeset(changeset); 
    501499        Mockito.verify(validationUtility).validateConceptUpdate(concept, changeset); 
    502         Mockito.verify(mockStorageService).addNotations(Mockito.eq(uuid), Mockito.eq(newOnes), Mockito.eq(DEFAULT_BRANCH)); 
    503         Mockito.verify(mockStorageService).removeNotations(Mockito.eq(uuid), Mockito.eq(oldOnes), Mockito.eq(DEFAULT_BRANCH)); 
    504         Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(uuid), Mockito.eq(changeset)); 
     500        Mockito.verify(mockStorageService).addNotations(Mockito.eq(uuid), Mockito.eq(newOnes), Mockito.eq(TEST_BRANCH_A_ID)); 
     501        Mockito.verify(mockStorageService).removeNotations(Mockito.eq(uuid), Mockito.eq(oldOnes), Mockito.eq(TEST_BRANCH_A_ID)); 
     502        Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(TEST_BRANCH_A_ID), Mockito.eq(uuid), Mockito.eq(changeset)); 
    505503    } 
    506504 
     
    518516        final Concept concept = new ConceptImpl.Builder().labels(Sets.newHashSet(label)).uuid(uuid).urls(oldOnes).build(); 
    519517 
    520         Mockito.when(mockStorageService.getConcept(uuid, DEFAULT_BRANCH)).thenReturn(concept); 
    521  
    522         conceptService.updateConcept(uuid, changeset, DEFAULT_BRANCH); 
     518        Mockito.when(mockStorageService.getConcept(uuid, TEST_BRANCH_A_ID)).thenReturn(concept); 
     519 
     520        conceptService.updateConcept(uuid, changeset, TEST_BRANCH_A_ID); 
    523521 
    524522        Mockito.verify(validationUtility).validateChangeset(changeset); 
    525523        Mockito.verify(validationUtility).validateConceptUpdate(concept, changeset); 
    526         Mockito.verify(mockStorageService).addUrls(Mockito.eq(uuid), Mockito.eq(newOnes), Mockito.eq(DEFAULT_BRANCH)); 
    527         Mockito.verify(mockStorageService).removeUrls(Mockito.eq(uuid), Mockito.eq(oldOnes), Mockito.eq(DEFAULT_BRANCH)); 
    528         Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(uuid), Mockito.eq(changeset)); 
     524        Mockito.verify(mockStorageService).addUrls(Mockito.eq(uuid), Mockito.eq(newOnes), Mockito.eq(TEST_BRANCH_A_ID)); 
     525        Mockito.verify(mockStorageService).removeUrls(Mockito.eq(uuid), Mockito.eq(oldOnes), Mockito.eq(TEST_BRANCH_A_ID)); 
     526        Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(TEST_BRANCH_A_ID), Mockito.eq(uuid), Mockito.eq(changeset)); 
    529527    } 
    530528 
     
    540538        final Concept concept = new ConceptImpl.Builder().labels(Sets.newHashSet(label)).uuid(uuid).tags(oldOnes).build(); 
    541539 
    542         Mockito.when(mockStorageService.getConcept(uuid, DEFAULT_BRANCH)).thenReturn(concept); 
    543  
    544         conceptService.updateConcept(uuid, changeset, DEFAULT_BRANCH); 
     540        Mockito.when(mockStorageService.getConcept(uuid, TEST_BRANCH_A_ID)).thenReturn(concept); 
     541 
     542        conceptService.updateConcept(uuid, changeset, TEST_BRANCH_A_ID); 
    545543 
    546544        Mockito.verify(validationUtility).validateChangeset(changeset); 
    547545        Mockito.verify(validationUtility).validateConceptUpdate(concept, changeset); 
    548         Mockito.verify(mockStorageService).addTags(Mockito.eq(uuid), Mockito.eq(newOnes), Mockito.eq(DEFAULT_BRANCH)); 
    549         Mockito.verify(mockStorageService).removeTags(Mockito.eq(uuid), Mockito.eq(oldOnes), Mockito.eq(DEFAULT_BRANCH)); 
    550         Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(uuid), Mockito.eq(changeset)); 
     546        Mockito.verify(mockStorageService).addTags(Mockito.eq(uuid), Mockito.eq(newOnes), Mockito.eq(TEST_BRANCH_A_ID)); 
     547        Mockito.verify(mockStorageService).removeTags(Mockito.eq(uuid), Mockito.eq(oldOnes), Mockito.eq(TEST_BRANCH_A_ID)); 
     548        Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(TEST_BRANCH_A_ID), Mockito.eq(uuid), Mockito.eq(changeset)); 
    551549    } 
    552550} 
  • trunk/code/conceptwiki/service/service-impl/src/test/java/nl/nbic/conceptwiki/service/HistoryServiceImplTest.java

    r726 r730  
    44 */ 
    55package nl.nbic.conceptwiki.service; 
     6 
     7import static nl.nbic.conceptwiki.common.util.CommonTestObjects.TEST_BRANCH_A_ID; 
    68 
    79import com.google.common.collect.Sets; 
     
    7577        final String uuid = UUID.randomUUID().toString(); 
    7678        final ConceptChangeset changeset = new ConceptChangesetImpl().withAdd(additions).withRemove(removals); 
    77         historServiceImpl.storeRevision(uuid, changeset); 
     79        historServiceImpl.storeRevision(TEST_BRANCH_A_ID, uuid, changeset); 
    7880    } 
    7981 
     
    8587        final String uuid = UUID.randomUUID().toString(); 
    8688        final ConceptChangeset changeset = new ConceptChangesetImpl(); 
    87         historServiceImpl.storeRevision(uuid, changeset); 
     89        historServiceImpl.storeRevision(TEST_BRANCH_A_ID, uuid, changeset); 
    8890    } 
    8991 
     
    9799        final ConceptChangeset changeset2 = new ConceptChangesetImpl().withRemove(removals); 
    98100 
    99         historServiceImpl.storeRevision(uuid, changeset1); 
    100         historServiceImpl.storeRevision(uuid, changeset2); 
     101        historServiceImpl.storeRevision(TEST_BRANCH_A_ID, uuid, changeset1); 
     102        historServiceImpl.storeRevision(TEST_BRANCH_A_ID, uuid, changeset2); 
    101103    } 
    102104}