本文整理汇总了Java中us.kbase.common.service.ServerException类的典型用法代码示例。如果您正苦于以下问题:Java ServerException类的具体用法?Java ServerException怎么用?Java ServerException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerException类属于us.kbase.common.service包,在下文中一共展示了ServerException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadModuleVersion
import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected ModuleVersion loadModuleVersion(ModuleMethod modmeth,
String serviceVer) throws IOException, JsonClientException {
final CatalogClient catClient = new CatalogClient(
config.getCatalogURL());
//TODO is this needed?
catClient.setIsInsecureHttpConnectionAllowed(true);
if (serviceVer == null || serviceVer.isEmpty()) {
serviceVer = RELEASE;
}
try {
return catClient.getModuleVersion(new SelectModuleVersion()
.withModuleName(moduleName).withVersion(serviceVer));
} catch (ServerException se) {
throw new IllegalArgumentException(String.format(
"Error looking up module %s with version %s: %s",
moduleName, serviceVer, se.getLocalizedMessage()));
}
}
示例2: failGetObjectInfo
import us.kbase.common.service.ServerException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void failGetObjectInfo(final GetObjectInfo3Params params, final String exception)
throws Exception {
try {
CLIENT1.getObjectInfo3(params);
fail("got object with bad id");
} catch (ServerException se) {
assertThat("correct excep message", se.getLocalizedMessage(),
is(exception));
}
final us.kbase.workspace.GetObjectInfoNewParams newp =
new us.kbase.workspace.GetObjectInfoNewParams()
.withObjects(params.getObjects())
.withIgnoreErrors(params.getIgnoreErrors())
.withIncludeMetadata(params.getIncludeMetadata());
for (final String key: params.getAdditionalProperties().keySet()) {
newp.setAdditionalProperties(key, params.getAdditionalProperties().get(key));
}
failGetObjectInfoNew(newp, exception.replace("GetObjectInfo3", "GetObjectInfoNew"));
}
示例3: failListObjects
import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failListObjects(List<String> wsnames, List<Long> wsids,
String type, String perm, Map<String, String> meta, Long showHidden,
Long showDeleted, Long allVers, Long includeMeta, long limit, String exp)
throws Exception {
try {
CLIENT1.listObjects(new ListObjectsParams().withWorkspaces(wsnames)
.withIds(wsids).withType(type).withShowHidden(showHidden)
.withShowDeleted(showDeleted).withShowAllVersions(allVers)
.withIncludeMetadata(includeMeta).withPerm(perm).withMeta(meta)
.withLimit(limit));
fail("listed objects with bad params");
} catch (ServerException se) {
assertThat("correct excep message", se.getLocalizedMessage(),
is(exp));
}
}
示例4: checkHandleServiceConnection
import us.kbase.common.service.ServerException; //导入依赖的package包/类
private static void checkHandleServiceConnection(
final URL handleServiceUrl,
final AuthToken handleMgrToken,
final InitReporter rep) {
try {
final AbstractHandleClient cli = new AbstractHandleClient(
handleServiceUrl, handleMgrToken);
if (handleServiceUrl.getProtocol().equals("http")) {
rep.reportInfo("Warning - the Handle Service url uses insecure http. " +
"https is recommended.");
cli.setIsInsecureHttpConnectionAllowed(true);
}
cli.isOwner(new LinkedList<String>());
} catch (Exception e) {
if (!(e instanceof ServerException) || !e.getMessage().contains(
"can not execute select * from Handle")) {
rep.reportFail("Could not establish a connection to the Handle Service at "
+ handleServiceUrl + ": " + e.getMessage());
}
}
}
示例5: checkHandleManagerConnection
import us.kbase.common.service.ServerException; //导入依赖的package包/类
private static void checkHandleManagerConnection(
final URL handleManagerUrl,
final AuthToken handleMgrToken,
final InitReporter rep) {
try {
final HandleMngrClient cli = new HandleMngrClient(
handleManagerUrl, handleMgrToken);
if (handleManagerUrl.getProtocol().equals("http")) {
rep.reportInfo("Warning - the Handle Manager url uses insecure http. " +
"https is recommended.");
cli.setIsInsecureHttpConnectionAllowed(true);
}
cli.setPublicRead(Arrays.asList("FAKEHANDLE_-100"));
} catch (Exception e) {
if (!(e instanceof ServerException) || !e.getMessage().contains(
"Unable to set acl(s) on handles FAKEHANDLE_-100")) {
rep.reportFail("Could not establish a connection to the Handle Manager Service at "
+ handleManagerUrl + ": " + e.getMessage());
}
}
}
示例6: doReads
import us.kbase.common.service.ServerException; //导入依赖的package包/类
public void doReads() {
thread = new Thread() {
@Override
public void run() {
try {
errors += performReads();
} catch (Exception e) {
e.printStackTrace();
if (e instanceof ServerException) {
System.out.println(((ServerException) e).getData());
}
}
}
};
thread.start();
}
示例7: doWrites
import us.kbase.common.service.ServerException; //导入依赖的package包/类
public void doWrites() {
thread = new Thread() {
@Override
public void run() {
try {
errors += performWrites();
} catch (Exception e) {
e.printStackTrace();
if (e instanceof ServerException) {
System.out.println(((ServerException) e).getData());
}
}
}
};
thread.start();
}
示例8: reportAweStatus
import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected static void reportAweStatus(AuthToken authPart, String returnVal,
String result) throws IOException, JsonProcessingException,
MalformedURLException, JsonClientException,
JsonParseException, JsonMappingException, ServerException, AuthException {
System.out.println(result);
JsonNode rootNode = new ObjectMapper().registerModule(new JacksonTupleModule()).readTree(result);
String aweId = "";
if (rootNode.has("data")){
JsonNode dataNode = rootNode.get("data");
if (dataNode.has("id")){
aweId = CmonkeyServerConfig.AWE_SERVICE_URL + "/" + dataNode.get("id").textValue();
System.out.println(aweId);
updateJobProgress(returnVal, "AWE job submitted: " + aweId, 1L, authPart.toString());
}
}
if (rootNode.has("error")){
if (rootNode.get("error").textValue()!=null){
System.out.println(rootNode.get("error").textValue());
updateJobProgress(returnVal, "AWE reported error on job " + aweId, 1L, authPart.toString());
throw new ServerException(rootNode.get("error").textValue(), 0, "Unknown", null);
}
}
}
示例9: failJob
import us.kbase.common.service.ServerException; //导入依赖的package包/类
private void failJob(CallbackStuff cbs, String moduleMeth, String release,
String exp)
throws Exception{
try {
cbs.callMethod(moduleMeth, new HashMap<String, Object>(), release);
fail("Ran bad job");
} catch (ServerException se) {
assertThat("correct exception", se.getLocalizedMessage(), is(exp));
}
}
示例10: failSetWSDesc
import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failSetWSDesc(SetWorkspaceDescriptionParams swdp, String excep)
throws Exception {
try {
CLIENT1.setWorkspaceDescription(swdp);
fail("set ws desc with bad params");
} catch (ServerException se) {
assertThat("correct excep message", se.getLocalizedMessage(),
is(excep));
}
}
示例11: failGetObjectInfoNew
import us.kbase.common.service.ServerException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void failGetObjectInfoNew(
final us.kbase.workspace.GetObjectInfoNewParams params,
final String exception)
throws Exception {
try {
CLIENT1.getObjectInfoNew(params);
fail("got object with bad id");
} catch (ServerException se) {
assertThat("correct excep message", se.getLocalizedMessage(),
is(exception));
}
}
示例12: failObjRename
import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failObjRename(RenameObjectParams rop,
String excep) throws Exception {
try {
CLIENT1.renameObject(rop);
fail("renamed with bad params");
} catch (ServerException se) {
assertThat("correct excep message", se.getLocalizedMessage(),
is(excep));
}
}
示例13: failWSRename
import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failWSRename(RenameWorkspaceParams rwp,
String excep) throws Exception {
try {
CLIENT1.renameWorkspace(rwp);
fail("renamed with bad params");
} catch (ServerException se) {
assertThat("correct excep message", se.getLocalizedMessage(),
is(excep));
}
}
示例14: failGetWSDesc
import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failGetWSDesc(final WorkspaceIdentity wsi, final String exp) throws Exception {
try {
CLIENT1.getWorkspaceDescription(wsi);
fail("got desc from WS when expected failure");
} catch (ServerException se) {
assertThat("correct excep message", se.getLocalizedMessage(), is(exp));
}
}
示例15: failSetGlobalPerm
import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failSetGlobalPerm(SetGlobalPermissionsParams sgpp,
String exp) throws Exception {
try {
CLIENT1.setGlobalPermission(sgpp);
fail("set global perms with bad params");
} catch (ServerException se) {
assertThat("correct excep message", se.getLocalizedMessage(),
is(exp));
}
}