Changeset 640


Ignore:
Timestamp:
Apr 16, 2012, 2:59:48 PM (5 years ago)
Author:
david.vanenckevort@…
Message:
  • Documented purpose of the conceptIndex tag key/value pair.
  • Added test for successful createTag()
  • Removed commented out code in TagStorageServiceImplUnitTest?() and removed unused imports.
Location:
trunk/code/conceptwiki/storage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/code/conceptwiki/storage/storage-api/src/test/java/nl/nbic/conceptwiki/storage/api/AbstractTagStorageServiceUnitTest.java

    r537 r640  
    33import static nl.nbic.conceptwiki.common.util.CommonTestObjects.NONEXISTENT_UUID;
    44
     5import java.util.Set;
    56import javax.inject.Inject;
    67import javax.validation.ConstraintViolationException;
     8import junit.framework.Assert;
     9import nl.nbic.conceptwiki.common.api.Concept;
     10import nl.nbic.conceptwiki.common.util.CommonTestObjects;
    711
    812import org.junit.Test;
     
    3539    }
    3640   
    37     // TODO convert to abstract test?
    3841    @Test
    3942    public void testCreateTagForNonexistentUuid() {
    4043        tagStorageService.createTag(NONEXISTENT_UUID);
    4144    }
     45   
     46    @Test
     47    public void testCreateTag() {
     48        final Concept createConcept = conceptStorageService.createConcept(CommonTestObjects.CONCEPT_A, CommonTestObjects.TEST_BRANCH_A_ID);
     49        Assert.assertNotNull(createConcept);
     50       
     51        tagStorageService.createTag(createConcept.getUuid());
     52        final Set<Concept> searchTags = tagStorageService.searchTags(CommonTestObjects.PREF_LABEL_A_TEXT, CommonTestObjects.TEST_SCOPE_FULL);
     53        Assert.assertNotNull(searchTags);
     54        Assert.assertFalse(searchTags.isEmpty());
     55        Assert.assertTrue(searchTags.contains(createConcept));
     56    }
    4257}
  • trunk/code/conceptwiki/storage/storage-neo4j/src/main/java/nl/nbic/conceptwiki/storage/neo4j/impl/TagStorageServiceImpl.java

    r457 r640  
    8787            } else {
    8888                node.createRelationshipTo(tagStructureNode, RelationType.IS_A);
     89                /*
     90                 * Add an key / value pair to identify this node as a tag. This key / value pair will be used as a limiting
     91                 * condition when do a search for a specific tag on the full text index.
     92                 */
    8993                conceptStorageService.getConceptIndex().add(node, INDEX_FIELD_TAG, true);
    9094            }
  • trunk/code/conceptwiki/storage/storage-neo4j/src/test/java/nl/nbic/conceptwiki/storage/neo4j/TagStorageServiceImplUnitTest.java

    r537 r640  
    11package nl.nbic.conceptwiki.storage.neo4j;
    22
    3 import javax.inject.Inject;
    43
    54import nl.nbic.conceptwiki.storage.api.AbstractTagStorageServiceUnitTest;
    65
    7 import org.junit.After;
    8 import org.junit.Before;
    96import org.junit.runner.RunWith;
    10 import org.neo4j.graphdb.Transaction;
    117import org.springframework.test.context.ContextConfiguration;
    128import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
     
    2016@RunWith(SpringJUnit4ClassRunner.class)
    2117@ContextConfiguration("/nl/nbic/conceptwiki/storage/storage-neo4j-test-context.xml")
    22 @TransactionConfiguration(transactionManager="storage", defaultRollback=true)
     18@TransactionConfiguration(transactionManager = "storage", defaultRollback = true)
    2319@Transactional("storage")
    2420public class TagStorageServiceImplUnitTest extends AbstractTagStorageServiceUnitTest {
    25 //    /**
    26 //     * Graph access utility.
    27 //     */
    28 //    @Inject
    29 //    private GraphTemplate graphTemplate;
    30 //    /**
    31 //     * Holds the programmatic transactions to limit the scope of dependencies for handling
    32 //     * annotation based transactions in the abstract tests.
    33 //     */
    34 //    private Transaction transaction;
    35 //   
    36 //    @Before
    37 //    public void setUp() {
    38 //        transaction = graphTemplate.getGraphDb().beginTx();
    39 //    }
    40 //   
    41 //    @After
    42 //    public void tearDown() {
    43 //        transaction.failure();
    44 //        transaction.finish();
    45 //    }
    4621}
Note: See TracChangeset for help on using the changeset viewer.