ResourceBuilder { public static String buildTableResource(String projectName, String tableName) { StringBuilder sb = new StringBuilder(); sb.append(PROJECTS).append('/').append(encodeObjectName(projectName)); sb.append(TABLES).append('/').append(encodeObjectName(tableName)); return sb.toString(); }  static String buildProjectsResource(); static String buildProjectResource(String projectName); static String buildTablesResource(String projectName); static String buildTableResource(String projectName, String tableName); static String buildFunctionsResource(String projectName); static String buildFunctionResource(String projectName, String functionName); static String buildXFlowsResource(String projectName); static String buildXFlowResource(String projectName, String xFlowName); static String buildInstancesResource(String projectName); static String buildCachedInstancesResource(String projectName); static String buildInstanceResource(String projectName, String instanceId); static String buildResourcesResource(String projectName); static String buildResourceResource(String projectName, String resourceName); static String buildVolumesResource(String projectName); static String buildVolumeResource(String projectName, String volumeName); static String buildStreamsResource(String projectName); static String buildStreamResource(String projectName, String streamName); static String buildTopologiesResource(String projectName); static String buildTopologyResource(String projectName, String topologyName); static String buildStreamJobsResource(String projectName); static String buildStreamJobResource(String projectName, String streamJobName); static String buildServersResource(String projectName); static String buildServerResource(String projectName, String serverName); static String buildVolumePartitionResource(String projectName, String volumeName,
                                                    String partitionName); static String encodeObjectName(String name); static String encode(String str); static String buildEventsResource(String projectName); static String buildEventResource(String projectName, String eventName); static String buildOfflineModelResource(String projectName); static String buildOfflineModelResource(String projectName,
                                                 String modelName); static String buildMatrixResource(String projectName); static String buildMatrixResource(String projectName, String maxtrixName); static String buildUsersResource(String projectName); static String buildUserResource(String projectName, String user); static String buildRolesResource(String projectName); static String buildRoleResource(String projectName, String roleName); static String buildSessionsResource(String projectName); static final String PROJECTS; static final String TABLES; static final String REGISTRATION; static final String FUNCTIONS; static final String EVENTS; static final String RESOURCES; static final String INSTANCES; static final String CACHED_INSTANCES; static final String VOLUMES; }
@Test public void testBuildTableResource() { Assert.assertEquals("/projects/projectName/tables/table_name_01", ResourceBuilder.buildTableResource("projectName", "table_name_01")); Assert.assertEquals("/projects/projectName/tables/table_%3F_01", ResourceBuilder.buildTableResource("projectName", "table_?_01")); Assert.assertEquals("/projects/projectName/tables/table_%26_01", ResourceBuilder.buildTableResource("projectName", "table_&_01")); Assert.assertEquals("/projects/projectName/tables/table_%25_01", ResourceBuilder.buildTableResource("projectName", "table_%_01")); Assert.assertEquals("/projects/projectName/tables/table_%23_01", ResourceBuilder.buildTableResource("projectName", "table_#_01")); Assert.assertEquals("/projects/projectName/tables/table_%20_%0901", ResourceBuilder.buildTableResource("projectName", "table_ _\t01")); }