@Test
public void shouldGenerateViewDdlForJoinTables() throws Exception {

    createDataservice(DATASERVICE_NAME);
    URI dataservicesUri = _uriBuilder.workspaceDataservicesUri();
    URI uri = UriBuilder.fromUri(dataservicesUri).path(V1Constants.SERVICE_VIEW_DDL_FOR_JOIN_TABLES).build();
    // Required parms (dataserviceName, tablePath, rhTablePath, joinType).
    // Valid entries - should generate DDL
    KomodoDataserviceUpdateAttributes updateAttr = new KomodoDataserviceUpdateAttributes();
    updateAttr.setDataserviceName(DATASERVICE_NAME);
    updateAttr.setTablePath("tko:komodo/tko:workspace/"+USER_NAME+"/Portfolio/PersonalValuations/Sheet1");
    updateAttr.setRhTablePath("tko:komodo/tko:workspace/"+USER_NAME+"/Portfolio/PersonalValuations/Sheet1");
    updateAttr.setJoinType("INNER");
    ClientRequest request = request(uri, MediaType.APPLICATION_JSON_TYPE);
    addJsonConsumeContentType(request);
    addBody(request, updateAttr);
    ClientResponse<String> response = request.post(String.class);
    final String entity = response.getEntity();
    
    RestDataserviceViewInfo viewInfo = KomodoJsonMarshaller.unmarshall(entity, RestDataserviceViewInfo.class);
    assertEquals(RestDataserviceViewInfo.DDL_INFO, viewInfo.getInfoType());
    assertEquals("CREATE VIEW MyDataServiceView (RowId integer PRIMARY KEY,  A_ROW_ID INTEGER, A_ACCOUNT_ID INTEGER, A_PRODUCT_TYPE STRING, A_PRODUCT_VALUE STRING,  " +
                 "B_ROW_ID INTEGER, B_ACCOUNT_ID INTEGER, B_PRODUCT_TYPE STRING, B_PRODUCT_VALUE STRING) AS \n" + 
                 "SELECT ROW_NUMBER() OVER (ORDER BY A.ROW_ID), A.ROW_ID, A.ACCOUNT_ID, A.PRODUCT_TYPE, A.PRODUCT_VALUE, B.ROW_ID, B.ACCOUNT_ID, B.PRODUCT_TYPE, B.PRODUCT_VALUE \n" + 
                 "FROM \nPortfolio.Sheet1 AS A \nINNER JOIN \nPortfolio.Sheet1 AS B ;", viewInfo.getViewDdl());
    assertEquals(false, viewInfo.isViewEditable());
}