当前位置: 首页>>代码示例>>Java>>正文


Java MultiException类代码示例

本文整理汇总了Java中org.glassfish.hk2.api.MultiException的典型用法代码示例。如果您正苦于以下问题:Java MultiException类的具体用法?Java MultiException怎么用?Java MultiException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MultiException类属于org.glassfish.hk2.api包,在下文中一共展示了MultiException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testThrowsExecptionWhenSearchDomainDoesNotExist

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Test
public void testThrowsExecptionWhenSearchDomainDoesNotExist() {
    when(amazonCloudSearch.describeDomains(any()))
            .thenReturn(new DescribeDomainsResult().withDomainStatusList(Lists.newArrayList()));

    try {
        // TODO suppress exception stacktrace
        getService(ModelIndexer.class);
    } catch (MultiException e) {
        assertEquals("Could not find CloudSearch domain: test-model", e.getCause().getMessage());

        return;
    }

    fail("Was expection an exception");
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:17,代码来源:IndexerTest.java

示例2: testThrowsExecptionWhenSearchServiceDoesNotExist

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Test
public void testThrowsExecptionWhenSearchServiceDoesNotExist() {
    when(amazonCloudSearch.describeDomains(any())).thenReturn(new DescribeDomainsResult()
            .withDomainStatusList(Lists.newArrayList(new DomainStatus().withSearchService(new ServiceEndpoint()))));

    try {
        // TODO suppress exception stacktrace
        getService(ModelIndexer.class);
    } catch (MultiException e) {
        assertEquals("Could not find SearchService for: test-model", e.getCause().getMessage());

        return;
    }

    fail("Was expection an exception");
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:17,代码来源:IndexerTest.java

示例3: toResponse

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Override
public Response toResponse(MultiException exc) {
	LOGGER.debug("mapping " + exc.getClass(), exc);
	List<Throwable> errors = exc.getErrors();
	if (errors.size() > 0) {
		Throwable cause = errors.get(0);
		if (cause instanceof QueryParamException
				|| cause instanceof FormParamException) {
			ParamException paramException = (ParamException) cause;
			return Response
					.status(400)
					.type(MediaType.TEXT_PLAIN)
					.entity("illegal value for parameter '"
							+ paramException.getParameterName() + "'")
					.build();
		}

	}
	return Response.serverError().build();
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:Larissa,代码行数:21,代码来源:MultiExceptionMapper.java

示例4: resolve

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Override
public Object resolve(Injectee injectee, ServiceHandle<?> root) {
  ActiveDescriptor<?> descriptor = locator.getInjecteeDescriptor(injectee);
  
  if (descriptor == null) {
    
    // Is it OK to return null?
    if (isNullable(injectee)) {
      return null;
    }
    
    throw new MultiException(new UnsatisfiedDependencyException(injectee));
  }
  
  return locator.getService(descriptor, root, injectee);
}
 
开发者ID:Squarespace,项目名称:jersey2-guice,代码行数:17,代码来源:GuiceThreeThirtyResolver.java

示例5: scan

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
public void scan() {
    try {
        DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class);
        Populator populator = dcs.getPopulator();

        populator.populate(new JerseyDescriptorFinder());
        log.info("found " + serviceLocator.getAllServices(Contract.class).size() + " contracts");
    } catch (IOException e) {
        throw new MultiException(e);
    }
}
 
开发者ID:wakingrufus,项目名称:elo-api,代码行数:12,代码来源:JerseyAutoScan.java

示例6: tearDown

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
/**
 * Tear down the test harness and unload the binder.
 *
 * @throws Exception if there's a problem tearing things down
 */
public void tearDown() throws Exception {

    // Reset the default timezone to what it was before the JTB was created
    DateTimeZone.setDefault(previousDateTimeZone);

    getHarness().tearDown();

    DimensionDictionary dictionary = configurationLoader.getDimensionDictionary();
    Set<Dimension> dimensions = dictionary.findAll();
    List<Throwable> caughtExceptions = Collections.emptyList();
    for (Dimension dimension : dimensions) {
        if (dimension instanceof KeyValueStoreDimension) {
            KeyValueStoreDimension kvDimension = (KeyValueStoreDimension) dimension;
            try {
                kvDimension.deleteAllDimensionRows();
            } catch (Exception e) {
                caughtExceptions.add(e);
                String msg = String.format("Unable to delete all DimensionRows for %s", dimension.getApiName());
                LOG.error(msg, e);
            }
        }
    }
    state.cache.clear();
    testBinderFactory.shutdownLoaderScheduler();

    if (!caughtExceptions.isEmpty()) {
        // Throw what we caught last so that we don't lose it.
        throw new MultiException(caughtExceptions);
    }

    getDimensionConfiguration().stream()
            .map(DimensionConfig::getSearchProvider)
            .forEach(SearchProvider::clearDimension);
}
 
开发者ID:yahoo,项目名称:fili,代码行数:40,代码来源:JerseyTestBinder.java

示例7: getAllServices

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Override
public <T> List<T> getAllServices(Class<T> contractOrImpl, Annotation... qualifiers) throws MultiException {
    if (contractOrImpl.equals(OAuth1SignatureMethod.class)) {
        return (List<T>) Arrays.asList(
            new OAuth1SignatureMethod[]{
                new HmaSha1Method(),
                new SimpleRsaSha1Method(),
                new PlaintextMethod()
        });
    }
    return null;
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:13,代码来源:OAuthServiceLocatorShim.java

示例8: create

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ServiceLocator create(String name, ServiceLocator parent) {
    ServiceLocator retVal = super.create(name, parent);
    DynamicConfigurationService dcs = retVal.getService(DynamicConfigurationService.class);
    Populator populator = dcs.getPopulator();

    try {
        populator.populate();
    } catch (IOException e) {
        throw new MultiException(e);
    }
    return retVal;
}
 
开发者ID:icode,项目名称:ameba,代码行数:17,代码来源:ServiceLocatorGenerator.java

示例9: getService

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Override
public <T> T getService(Class<T> contractOrImpl, Annotation... qualifiers) throws MultiException {
    throw new UnsupportedOperationException("Will not be supported!");
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:5,代码来源:OAuthServiceLocatorShim.java

示例10: getServiceHandle

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Override
public <T> ServiceHandle<T> getServiceHandle(Class<T> contractOrImpl, Annotation... qualifiers) throws MultiException {
    throw new UnsupportedOperationException("Will not be supported!");
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:5,代码来源:OAuthServiceLocatorShim.java

示例11: getAllServiceHandles

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Override
public <T> List<ServiceHandle<T>> getAllServiceHandles(Class<T> contractOrImpl, Annotation... qualifiers) throws MultiException {
    throw new UnsupportedOperationException("Will not be supported!");
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:5,代码来源:OAuthServiceLocatorShim.java

示例12: reifyDescriptor

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Override
public ActiveDescriptor<?> reifyDescriptor(Descriptor descriptor, Injectee injectee) throws MultiException {
    throw new UnsupportedOperationException("Will not be supported!");
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:5,代码来源:OAuthServiceLocatorShim.java

示例13: getInjecteeDescriptor

import org.glassfish.hk2.api.MultiException; //导入依赖的package包/类
@Override
public ActiveDescriptor<?> getInjecteeDescriptor(Injectee injectee) throws MultiException {
    throw new UnsupportedOperationException("Will not be supported!");
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:5,代码来源:OAuthServiceLocatorShim.java


注:本文中的org.glassfish.hk2.api.MultiException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。