Fix broken test

This commit is contained in:
jamesagnew 2018-12-09 19:36:03 -05:00
parent 67f5ba6aa0
commit 81e8131ffc
11 changed files with 70 additions and 27 deletions

View File

@ -256,27 +256,30 @@ public abstract class BaseApp {
System.err.println("" + ansi().fg(Ansi.Color.WHITE).boldOff());
logCommandUsageNoHeader(command);
runCleanupHookAndUnregister();
System.exit(1);
exitDueToException(e);
} catch (CommandFailureException e) {
ourLog.error(e.getMessage());
runCleanupHookAndUnregister();
if ("true".equals(System.getProperty("test"))) {
throw e;
} else {
System.exit(1);
}
exitDueToException(e);
} catch (Throwable t) {
ourLog.error("Error during execution: ", t);
runCleanupHookAndUnregister();
exitDueToException(new CommandFailureException("Error: " + t.toString(), t));
}
}
private void exitDueToException(Throwable e) {
if ("true".equals(System.getProperty("test"))) {
throw new CommandFailureException("Error: " + t.toString(), t);
if (e instanceof CommandFailureException) {
throw (CommandFailureException)e;
}
throw new Error(e);
} else {
System.exit(1);
}
}
}
private void runCleanupHookAndUnregister() {
if (myShutdownHookHasNotRun) {
Runtime.getRuntime().removeShutdownHook(myShutdownHook);

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.model.entity;
/*-
* #%L
* HAPI FHIR Model
* %%
* Copyright (C) 2014 - 2018 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.io.Serializable;
public abstract class BaseResourceIndex implements Serializable {

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server.interceptor;
/*-
* #%L
* HAPI FHIR - Server Framework
* %%
* Copyright (C) 2014 - 2018 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;