// 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());
  }
  @Test
  public void testFlattenSelection() throws Exception {
    beforeFlattenSelection();
    final MockAttributeDefinition tokenB = new MockAttributeDefinition("Token0", type);
    final MockAttributeDefinition superTokenB = new MockAttributeDefinition("Token-1", superType);
    final MockAttributeDefinition subTokenB = new MockAttributeDefinition("Token-2", subType);

    final MockAttributeDefinition superToken = new MockAttributeDefinition("Token1", superType);
    final MockAttributeDefinition token = new MockAttributeDefinition("Token2", type);
    final MockAttributeDefinition subToken = new MockAttributeDefinition("Token3", subType);
    final MockAttributeDefinition wrongToken = new MockAttributeDefinition("Tooken4", wrongType);
    final MockAttributeDefinition basedToken = new MockAttributeDefinition("Tooken6", type, tokenB);
    final MockAttributeDefinition basedWrongToken =
        new MockAttributeDefinition("Tooken7", wrongType, tokenB);
    final MockAttributeDefinition wrongBasedToken =
        new MockAttributeDefinition("Tooken8", type, wrongToken);
    final MockAttributeDefinition superBasedToken =
        new MockAttributeDefinition("Tooken9", subType, superTokenB);
    final MockAttributeDefinition subBasedToken =
        new MockAttributeDefinition("Tooken10", subType, subTokenB);
    final List<IAttributeDefinition> orig = new LinkedList<IAttributeDefinition>();
    orig.add(superToken);
    orig.add(token);
    orig.add(subToken);
    orig.add(wrongToken);
    orig.add(basedToken);
    orig.add(basedWrongToken);
    orig.add(wrongBasedToken);
    orig.add(superBasedToken);
    orig.add(subBasedToken);

    AttributeSelection res = flattenSelection(type, orig);

    AttributeSelection expected = new AttributeSelection();
    expected.addAll(orig);
    expected.add(expected.indexOf(superToken), type.getAttributeDefinition(superToken.getName()));
    expected.remove(superToken);
    expected.remove(wrongToken);
    expected.remove(basedWrongToken);
    expected.add(
        expected.indexOf(superBasedToken), type.getAttributeDefinition(superBasedToken.getName()));
    expected.remove(superBasedToken);
    expected.remove(subBasedToken);
    expected.add(subTokenB);

    assertEqualsAsSet(null, expected, res);
  }
  // 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());
  }