Program: 112951
Project: 112951
Buggy source:
@Test public void testServices() throws IOException, SchemaException {
  geoserverServiceClient=new GeoserverServiceClient(ServicesTestEnvironment.GEOWAVE_BASE_URL,ServicesTestEnvironment.GEOSERVER_USER,ServicesTestEnvironment.GEOSERVER_PASS);
  infoServiceClient=new InfoServiceClient(ServicesTestEnvironment.GEOWAVE_BASE_URL);
  ingestServiceClient=new IngestServiceClient(ServicesTestEnvironment.GEOWAVE_BASE_URL);
  boolean success=false;
  LOGGER.info("String_Node_Str");
  success=ingestServiceClient.localIngest(new File[]{new File(ASHLAND_GPX_FILE)},((TestDataStoreOptions)dataStoreOptions).getStoreType().name(),TestUtils.TEST_NAMESPACE,null,ASHLAND_INGEST_TYPE,null,false);
  assertTrue("String_Node_Str" + ASHLAND_GPX_FILE + "String_Node_Str",success);
  success=false;
  TestUtils.deleteAll(dataStoreOptions);
  LOGGER.info("String_Node_Str");
  success=ingestServiceClient.hdfsIngest(new File[]{new File(ASHLAND_GPX_FILE)},((TestDataStoreOptions)dataStoreOptions).getStoreType().name(),TestUtils.TEST_NAMESPACE,null,ASHLAND_INGEST_TYPE,null,false);
  assertTrue("String_Node_Str" + ASHLAND_GPX_FILE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  final JSONArray adapters=infoServiceClient.getAdapters(((TestDataStoreOptions)dataStoreOptions).getStoreType().name()).getJSONArray("String_Node_Str");
  for (int i=0; i < adapters.size(); i++) {
    if (adapters.getJSONObject(i).getString("String_Node_Str").equals(GpxUtils.GPX_WAYPOINT_FEATURE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + GpxUtils.GPX_WAYPOINT_FEATURE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  final JSONArray indices=infoServiceClient.getIndices(((TestDataStoreOptions)dataStoreOptions).getStoreType().name()).getJSONArray("String_Node_Str");
  for (int i=0; i < indices.size(); i++) {
    if (indices.getJSONObject(i).getString("String_Node_Str").equals(TestUtils.DEFAULT_SPATIAL_INDEX.getId().getString())) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + TestUtils.DEFAULT_SPATIAL_INDEX.getId().getString() + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_WORKSPACE + "String_Node_Str",geoserverServiceClient.createWorkspace(ServicesTestEnvironment.TEST_WORKSPACE));
  LOGGER.info("String_Node_Str");
  final JSONArray workspaces=geoserverServiceClient.getWorkspaces().getJSONArray("String_Node_Str");
  for (int i=0; i < workspaces.size(); i++) {
    if (workspaces.getJSONObject(i).getString("String_Node_Str").equals(ServicesTestEnvironment.TEST_WORKSPACE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_WORKSPACE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE + "String_Node_Str",geoserverServiceClient.publishStyle(new File[]{new File(ServicesTestEnvironment.TEST_SLD_NO_DIFFERENCE_FILE)}));
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE + "String_Node_Str",geoserverServiceClient.publishStyle(new File[]{new File(ServicesTestEnvironment.TEST_SLD_MINOR_SUBSAMPLE_FILE)}));
  LOGGER.info("String_Node_Str");
  final JSONArray styles=geoserverServiceClient.getStyles().getJSONArray("String_Node_Str");
  for (int i=0; i < styles.size(); i++) {
    if (styles.getJSONObject(i).getString("String_Node_Str").equals(ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE + "String_Node_Str",success);
  success=false;
  for (int i=0; i < styles.size(); i++) {
    if (styles.getJSONObject(i).getString("String_Node_Str").equals(ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  final String style=IOUtils.toString(geoserverServiceClient.getStyle(ServicesTestEnvironment.TEST_SLD_NO_DIFFERENCE_FILE));
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE + "String_Node_Str",(style != null) && !style.isEmpty());
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str",geoserverServiceClient.publishDatastore(dataStoreOptions.getType(),dataStoreOptions.getOptionsAsMap(),TestUtils.TEST_NAMESPACE,null,null,null,null,ServicesTestEnvironment.TEST_WORKSPACE));
  LOGGER.info("String_Node_Str");
  final JSONArray datastores=geoserverServiceClient.getDatastores(ServicesTestEnvironment.TEST_WORKSPACE).getJSONArray("String_Node_Str");
  JSONObject dsInfo=null;
  for (int i=0; i < datastores.size(); i++) {
    if (datastores.getJSONObject(i).getString("String_Node_Str").equals(TestUtils.TEST_NAMESPACE)) {
      dsInfo=datastores.getJSONObject(i);
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str",success);
  success=false;
  if (dsInfo != null) {
    final Map<String,String> options=dataStoreOptions.getOptionsAsMap();
    final List<ConfigOption> configOptions=Arrays.asList(ConfigUtils.createConfigOptionsFromJCommander(dataStoreOptions));
    final Collection<String> nonPasswordRequiredFields=Collections2.transform(Collections2.filter(configOptions,new Predicate<ConfigOption>(){
      @Override public boolean apply(      final ConfigOption input){
        return !input.isPassword() && !input.isOptional();
      }
    }
),new Function<ConfigOption,String>(){
      @Override public String apply(      final ConfigOption input){
        return input.getName();
      }
    }
);
    for (    final Entry<String,String> entry : options.entrySet()) {
      if (nonPasswordRequiredFields.contains(entry.getKey())) {
        assertTrue("String_Node_Str" + entry.getKey() + "String_Node_Str",dsInfo.getString(entry.getKey()).equals(entry.getValue()));
      }
    }
  }
  LOGGER.info("String_Node_Str");
  final JSONObject datastore=geoserverServiceClient.getDatastore(TestUtils.TEST_NAMESPACE,ServicesTestEnvironment.TEST_WORKSPACE);
  assertTrue("String_Node_Str",datastore.getJSONObject("String_Node_Str").getString("String_Node_Str").equals(TestUtils.TEST_NAMESPACE));
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str" + GpxUtils.GPX_WAYPOINT_FEATURE + "String_Node_Str",geoserverServiceClient.publishLayer(TestUtils.TEST_NAMESPACE,ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE,GpxUtils.GPX_WAYPOINT_FEATURE,ServicesTestEnvironment.TEST_WORKSPACE));
  LOGGER.info("String_Node_Str");
  final JSONArray layers=geoserverServiceClient.getLayers().getJSONArray("String_Node_Str").getJSONObject(0).getJSONArray("String_Node_Str");
  for (int i=0; i < layers.size(); i++) {
    if (layers.getJSONObject(i).getString("String_Node_Str").equals(GpxUtils.GPX_WAYPOINT_FEATURE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + GpxUtils.GPX_WAYPOINT_FEATURE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  final JSONObject layer=geoserverServiceClient.getLayer(GpxUtils.GPX_WAYPOINT_FEATURE);
  assertTrue("String_Node_Str",layer.getJSONObject("String_Node_Str").getString("String_Node_Str").equals(GpxUtils.GPX_WAYPOINT_FEATURE));
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str" + GpxUtils.GPX_WAYPOINT_FEATURE + "String_Node_Str",geoserverServiceClient.deleteLayer(GpxUtils.GPX_WAYPOINT_FEATURE));
  assertTrue("String_Node_Str",geoserverServiceClient.deleteDatastore(TestUtils.TEST_NAMESPACE,ServicesTestEnvironment.TEST_WORKSPACE));
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE + "String_Node_Str",geoserverServiceClient.deleteStyle(ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE));
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE + "String_Node_Str",geoserverServiceClient.deleteStyle(ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE));
  assertTrue("String_Node_Str",geoserverServiceClient.deleteWorkspace(ServicesTestEnvironment.TEST_WORKSPACE));
}

Fixed version (ground truth):
@Test public void testServices() throws IOException, SchemaException {
  geoserverServiceClient=new GeoserverServiceClient(ServicesTestEnvironment.GEOWAVE_BASE_URL,ServicesTestEnvironment.GEOSERVER_USER,ServicesTestEnvironment.GEOSERVER_PASS);
  infoServiceClient=new InfoServiceClient(ServicesTestEnvironment.GEOWAVE_BASE_URL);
  ingestServiceClient=new IngestServiceClient(ServicesTestEnvironment.GEOWAVE_BASE_URL);
  boolean success=false;
  LOGGER.info("String_Node_Str");
  success=ingestServiceClient.localIngest(new File[]{new File(ASHLAND_GPX_FILE)},((TestDataStoreOptions)dataStoreOptions).getStoreType().name(),TestUtils.TEST_NAMESPACE,null,ASHLAND_INGEST_TYPE,null,false);
  assertTrue("String_Node_Str" + ASHLAND_GPX_FILE + "String_Node_Str",success);
  success=false;
  TestUtils.deleteAll(dataStoreOptions);
  LOGGER.info("String_Node_Str");
  success=ingestServiceClient.hdfsIngest(new File[]{new File(ASHLAND_GPX_FILE)},((TestDataStoreOptions)dataStoreOptions).getStoreType().name(),TestUtils.TEST_NAMESPACE,null,ASHLAND_INGEST_TYPE,null,false);
  assertTrue("String_Node_Str" + ASHLAND_GPX_FILE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  final JSONArray adapters=infoServiceClient.getAdapters(((TestDataStoreOptions)dataStoreOptions).getStoreType().name()).getJSONArray("String_Node_Str");
  for (int i=0; i < adapters.size(); i++) {
    if (adapters.getJSONObject(i).getString("String_Node_Str").equals(GpxUtils.GPX_WAYPOINT_FEATURE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + GpxUtils.GPX_WAYPOINT_FEATURE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  final JSONArray indices=infoServiceClient.getIndices(((TestDataStoreOptions)dataStoreOptions).getStoreType().name()).getJSONArray("String_Node_Str");
  for (int i=0; i < indices.size(); i++) {
    if (indices.getJSONObject(i).getString("String_Node_Str").equals(TestUtils.DEFAULT_SPATIAL_INDEX.getId().getString())) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + TestUtils.DEFAULT_SPATIAL_INDEX.getId().getString() + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_WORKSPACE + "String_Node_Str",geoserverServiceClient.createWorkspace(ServicesTestEnvironment.TEST_WORKSPACE));
  LOGGER.info("String_Node_Str");
  final JSONArray workspaces=geoserverServiceClient.getWorkspaces().getJSONArray("String_Node_Str");
  for (int i=0; i < workspaces.size(); i++) {
    if (workspaces.getJSONObject(i).getString("String_Node_Str").equals(ServicesTestEnvironment.TEST_WORKSPACE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_WORKSPACE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE + "String_Node_Str",geoserverServiceClient.publishStyle(new File[]{new File(ServicesTestEnvironment.TEST_SLD_NO_DIFFERENCE_FILE)}));
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE + "String_Node_Str",geoserverServiceClient.publishStyle(new File[]{new File(ServicesTestEnvironment.TEST_SLD_MINOR_SUBSAMPLE_FILE)}));
  LOGGER.info("String_Node_Str");
  final JSONArray styles=geoserverServiceClient.getStyles().getJSONArray("String_Node_Str");
  for (int i=0; i < styles.size(); i++) {
    if (styles.getJSONObject(i).getString("String_Node_Str").equals(ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE + "String_Node_Str",success);
  success=false;
  for (int i=0; i < styles.size(); i++) {
    if (styles.getJSONObject(i).getString("String_Node_Str").equals(ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  final String style=IOUtils.toString(geoserverServiceClient.getStyle(ServicesTestEnvironment.TEST_SLD_NO_DIFFERENCE_FILE));
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE + "String_Node_Str",(style != null) && !style.isEmpty());
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str",geoserverServiceClient.publishDatastore(dataStoreOptions.getType(),dataStoreOptions.getOptionsAsMap(),TestUtils.TEST_NAMESPACE,null,null,null,null,ServicesTestEnvironment.TEST_WORKSPACE));
  LOGGER.info("String_Node_Str");
  final JSONArray datastores=geoserverServiceClient.getDatastores(ServicesTestEnvironment.TEST_WORKSPACE).getJSONArray("String_Node_Str");
  JSONObject dsInfo=null;
  for (int i=0; i < datastores.size(); i++) {
    if (datastores.getJSONObject(i).getString("String_Node_Str").equals(TestUtils.TEST_NAMESPACE)) {
      dsInfo=datastores.getJSONObject(i);
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str",success);
  success=false;
  if (dsInfo != null) {
    final Map<String,String> options=dataStoreOptions.getOptionsAsMap();
    final List<ConfigOption> configOptions=Arrays.asList(ConfigUtils.createConfigOptionsFromJCommander(dataStoreOptions,false));
    final Collection<String> nonPasswordRequiredFields=Collections2.transform(Collections2.filter(configOptions,new Predicate<ConfigOption>(){
      @Override public boolean apply(      final ConfigOption input){
        return !input.isPassword() && !input.isOptional();
      }
    }
),new Function<ConfigOption,String>(){
      @Override public String apply(      final ConfigOption input){
        return input.getName();
      }
    }
);
    for (    final Entry<String,String> entry : options.entrySet()) {
      if (nonPasswordRequiredFields.contains(entry.getKey())) {
        assertTrue("String_Node_Str" + entry.getKey() + "String_Node_Str",dsInfo.getString(entry.getKey()).equals(entry.getValue()));
      }
    }
  }
  LOGGER.info("String_Node_Str");
  final JSONObject datastore=geoserverServiceClient.getDatastore(TestUtils.TEST_NAMESPACE,ServicesTestEnvironment.TEST_WORKSPACE);
  assertTrue("String_Node_Str",datastore.getJSONObject("String_Node_Str").getString("String_Node_Str").equals(TestUtils.TEST_NAMESPACE));
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str" + GpxUtils.GPX_WAYPOINT_FEATURE + "String_Node_Str",geoserverServiceClient.publishLayer(TestUtils.TEST_NAMESPACE,ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE,GpxUtils.GPX_WAYPOINT_FEATURE,ServicesTestEnvironment.TEST_WORKSPACE));
  LOGGER.info("String_Node_Str");
  final JSONArray layers=geoserverServiceClient.getLayers().getJSONArray("String_Node_Str").getJSONObject(0).getJSONArray("String_Node_Str");
  for (int i=0; i < layers.size(); i++) {
    if (layers.getJSONObject(i).getString("String_Node_Str").equals(GpxUtils.GPX_WAYPOINT_FEATURE)) {
      success=true;
      break;
    }
  }
  assertTrue("String_Node_Str" + GpxUtils.GPX_WAYPOINT_FEATURE + "String_Node_Str",success);
  success=false;
  LOGGER.info("String_Node_Str");
  final JSONObject layer=geoserverServiceClient.getLayer(GpxUtils.GPX_WAYPOINT_FEATURE);
  assertTrue("String_Node_Str",layer.getJSONObject("String_Node_Str").getString("String_Node_Str").equals(GpxUtils.GPX_WAYPOINT_FEATURE));
  LOGGER.info("String_Node_Str");
  assertTrue("String_Node_Str" + GpxUtils.GPX_WAYPOINT_FEATURE + "String_Node_Str",geoserverServiceClient.deleteLayer(GpxUtils.GPX_WAYPOINT_FEATURE));
  assertTrue("String_Node_Str",geoserverServiceClient.deleteDatastore(TestUtils.TEST_NAMESPACE,ServicesTestEnvironment.TEST_WORKSPACE));
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE + "String_Node_Str",geoserverServiceClient.deleteStyle(ServicesTestEnvironment.TEST_STYLE_NAME_NO_DIFFERENCE));
  assertTrue("String_Node_Str" + ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE + "String_Node_Str",geoserverServiceClient.deleteStyle(ServicesTestEnvironment.TEST_STYLE_NAME_MINOR_SUBSAMPLE));
  assertTrue("String_Node_Str",geoserverServiceClient.deleteWorkspace(ServicesTestEnvironment.TEST_WORKSPACE));
}