  @Test
  public void testGenerateLogicalId_nested() throws Exception {

    String[] logicalIdKeys = new String[] { "name", "type", "dataSource" };
    idGenerator = new MetaverseLogicalIdGenerator( logicalIdKeys );

    String expected = "{\"dataSource\":{\"name\":\"Sampledata\",\"type\":\"Database Connection\"}," +
      "\"name\":\"SALES_DATA\",\"type\":\"Database Table\"}";

    when( node.getProperty( "name" ) ).thenReturn( "SALES_DATA" );
    when( node.getProperty( "type" ) ).thenReturn( "Database Table" );
    when( node.getProperty( "dataSource" ) ).thenReturn( "{\"name\":\"Sampledata\",\"type\":\"Database Connection\"}" );
    when( node.getPropertyKeys() ).thenReturn( new HashSet<String>() {{
      add( "dataSource" );
      add( "name" );
      add( "type" );
    }} );

    String logicalId = idGenerator.generateId( node );
    assertEquals( expected, logicalId );

    // make sure a call was made to add the logical id as a property
    verify( node ).setProperty( DictionaryConst.PROPERTY_LOGICAL_ID, logicalId );
  }