Exemple #1
0
  @Test
  public void testQueryByDataIdentifier() throws IOException, ClassNotFoundException {

    org.seadva.registry.database.model.obj.vaRegistry.Collection collection =
        new org.seadva.registry.database.model.obj.vaRegistry.Collection();
    String altId = "fakedoi:" + UUID.randomUUID().toString();
    collection.setId(UUID.randomUUID().toString());
    collection.setName("test");
    collection.setVersionNum("1");
    collection.setIsObsolete(0);
    collection.setEntityName("test");
    collection.setEntityCreatedTime(new Date());
    collection.setEntityLastUpdatedTime(new Date());
    collection.setState(client.getStateByName("PublishedObject"));

    DataIdentifier dataIdentifier = new DataIdentifier();
    DataIdentifierPK dataIdentifierPK = new DataIdentifierPK();
    dataIdentifierPK.setDataIdentifierType(client.getDataIdentifierType("doi"));
    dataIdentifier.setId(dataIdentifierPK);
    dataIdentifier.setDataIdentifierValue(altId);
    collection.addDataIdentifier(dataIdentifier);

    client.postCollection(collection);

    List<BaseEntity> entityList =
        client.queryByProperty(null, altId, QueryAttributeType.DATA_IDENTIFIER);
    assertTrue(entityList.size() > 0);
  }
Exemple #2
0
  @Test
  public void testQueryByProperty() throws IOException {

    org.seadva.registry.database.model.obj.vaRegistry.Collection collection =
        new org.seadva.registry.database.model.obj.vaRegistry.Collection();
    collection.setId(UUID.randomUUID().toString());
    collection.setName("test");
    collection.setVersionNum("1");
    collection.setIsObsolete(0);
    collection.setEntityName("test");
    collection.setEntityCreatedTime(new Date());
    collection.setEntityLastUpdatedTime(new Date());
    collection.setState(client.getStateByName("PublishedObject"));

    Property property = new Property();
    property.setMetadata(client.getMetadataByType("abstract"));
    property.setValuestr("value_1.0");
    collection.addProperty(property);

    client.postCollection(collection);

    List<BaseEntity> entityList =
        client.queryByProperty("abstract", "value_1.0", QueryAttributeType.PROPERTY);
    assertTrue(entityList.size() > 0);
  }
Exemple #3
0
  @Test
  public void testPostAgent() throws IOException {
    Agent agent = new Agent();
    agent.setId(UUID.randomUUID().toString());
    agent.setEntityName("test user");
    agent.setEntityLastUpdatedTime(new Date());
    agent.setEntityCreatedTime(new Date());
    agent.setFirstName("test");
    agent.setLastName("test");

    client.postAgent(agent, "Curator");
  }