// asof
  @Test
  @Ignore
  public void testAsof() throws Exception {
    Asset storyAsset = createDisposableStory();
    storyAsset.setAttributeValue(nameDef, "Test Asof");
    storyAsset.setAttributeValue(scopeDef, APIClientLegacyIntegrationTestSuiteIT.get_projectId());
    services.save(storyAsset);

    IAssetType storyType = metaModel.getAssetType("Story");
    Query query = new Query(storyType, true);
    IAttributeDefinition nameAttribute = storyType.getAttributeDefinition("Name");
    IAttributeDefinition createDateAttribute = storyType.getAttributeDefinition("CreateDate");

    query.getSelection().add(nameAttribute);
    query.getSelection().add(createDateAttribute);
    AttributeSelection selection = new AttributeSelection();
    selection.add(nameAttribute);
    query.setFind(new QueryFind("Test Asof", selection));
    Date date = (Date) Calendar.getInstance().getTime();
    query.setAsOf(date);
    QueryResult result = services.retrieve(query);

    //	Assert.assertNotNull(result);

    Assert.assertEquals(
        "Test Asof", result.getAssets()[0].getAttribute(nameAttribute).getValue().toString());
  }
  // Sort query
  @Test
  public void testSortStories() throws Exception {

    // add 3 stories
    Asset storyAsset = createDisposableStory();
    storyAsset.setAttributeValue(nameDef, "MM-Story");
    storyAsset.setAttributeValue(scopeDef, APIClientLegacyIntegrationTestSuiteIT.get_projectId());
    services.save(storyAsset);
    storyAsset = createDisposableStory();
    storyAsset.setAttributeValue(nameDef, "AA-Story");
    storyAsset.setAttributeValue(scopeDef, APIClientLegacyIntegrationTestSuiteIT.get_projectId());
    services.save(storyAsset);
    storyAsset = createDisposableStory();
    storyAsset.setAttributeValue(nameDef, "HH-Story");
    storyAsset.setAttributeValue(scopeDef, APIClientLegacyIntegrationTestSuiteIT.get_projectId());
    services.save(storyAsset);

    IAssetType storyType = metaModel.getAssetType("Story");
    Query query = new Query(storyType);
    IAttributeDefinition nameAttribute = storyType.getAttributeDefinition("Name");
    query.getSelection().add(nameAttribute);
    query.getOrderBy().minorSort(nameAttribute, Order.Ascending);

    QueryResult result = services.retrieve(query);

    Asset first_story = result.getAssets()[0];

    Assert.assertEquals("AA-Story", first_story.getAttribute(nameAttribute).getValue().toString());
  }
  @BeforeClass
  public static void beforeClass() {

    metaModel = APIClientLegacyIntegrationTestSuiteIT.get_metaModel();
    services = APIClientLegacyIntegrationTestSuiteIT.get_services();
    storyType = metaModel.getAssetType("Story");

    nameDef = storyType.getAttributeDefinition("Name");
    scopeDef = storyType.getAttributeDefinition("Scope");
    momentDef = storyType.getAttributeDefinition("Moment");
    attributesToQuery = new LinkedList<IAttributeDefinition>();
    attributesToQuery.add(nameDef);
    attributesToQuery.add(scopeDef);
    attributesToQuery.add(momentDef);
  }
  // Filter query // Find query
  @Test
  @Ignore
  public void testFindInAQuery() throws Exception {

    Asset newStoryUrgent =
        createDisposableStory(); // services.createNew(storyType,
                                 // APIClientIntegrationTestSuiteIT.get_projectId());
    IAttributeDefinition nameAttribute = storyType.getAttributeDefinition("Name");
    newStoryUrgent.setAttributeValue(
        nameAttribute, "FindAndQueryTest: Find in a Query - Urgent story");
    services.save(newStoryUrgent);

    Asset newStory =
        createDisposableStory(); // services.createNew(storyType,
                                 // APIClientIntegrationTestSuiteIT.get_projectId());
    nameAttribute = storyType.getAttributeDefinition("Name");
    newStory.setAttributeValue(nameAttribute, "FindAndQueryTest: Find in a Query - Common story");
    services.save(newStory);
    //		query
    IAssetType requestType = metaModel.getAssetType("Story");
    Query query = new Query(requestType);
    IAttributeDefinition nameAttributeToQuery = requestType.getAttributeDefinition("Name");
    query.getSelection().add(nameAttributeToQuery);

    //		find
    IAttributeDefinition nameAttributeToFindQuery = requestType.getAttributeDefinition("Name");
    AttributeSelection selection = new AttributeSelection();
    selection.add(nameAttributeToFindQuery);
    query.setFind(new QueryFind("Urgent", selection));
    QueryResult result = services.retrieve(query);
    Asset urgentStory = result.getAssets()[0];

    Assert.assertEquals(
        "FindAndQueryTest: Find in a Query - Urgent story",
        urgentStory.getAttribute(nameAttribute).getValue().toString());
  }