Example usage for org.springframework.util Assert isInstanceOf

List of usage examples for org.springframework.util Assert isInstanceOf

Introduction

In this page you can find the example usage for org.springframework.util Assert isInstanceOf.

Prototype

public static void isInstanceOf(Class<?> type, @Nullable Object obj) 

Source Link

Document

Assert that the provided object is an instance of the provided class.

Usage

From source file:im.tym.wraop.full.WrapperFactoryBuilderTest.java

@Test
public void testBuild() {
    SpiBasedWrapperFactory<Object> factory = (SpiBasedWrapperFactory<Object>) new WrapperFactoryBuilder()
            .build();/*from w w w  .ja va 2s.c  o  m*/
    Assert.isInstanceOf(AspectJWrapperFactorySpi.class, factory.getSpi());
}

From source file:im.tym.wraop.nospring.WrapperFactoryBuilderTest.java

@Test
public void testBuild() {
    SpiBasedWrapperFactory<Object> factory = (SpiBasedWrapperFactory<Object>) new WrapperFactoryBuilder()
            .build();/*from w w w . ja  va  2 s.  co m*/
    Assert.isInstanceOf(NoopWrapperFactorySpi.class, factory.getSpi());
}

From source file:im.tym.wraop.noaspectj.WrapperFactoryBuilderTest.java

@Test
public void testBuild() {
    SpiBasedWrapperFactory<Object> factory = (SpiBasedWrapperFactory<Object>) new WrapperFactoryBuilder()
            .build();//w ww. j a  v a 2  s  . co m
    Assert.isInstanceOf(SpringAOPWrapperFactorySpi.class, factory.getSpi());
}

From source file:org.eclipse.gemini.blueprint.test.platform.DefaultFrameworkTemplate.java

public DefaultFrameworkTemplate(Object target, Log log) {
    if (OsgiPlatformDetector.isR42()) {
        Assert.isInstanceOf(Framework.class, target);
        fwk = (Framework) target;//  w w w .ja  v a 2 s . c  o  m
    } else {
        throw new IllegalStateException("Cannot use OSGi 4.2 Framework API in an OSGi 4.1 environment");
    }
    this.log = log;
}

From source file:es.upm.fiware.rss.ws.AlgorithmServiceTest.java

@Test
public void getAlgoritmsTest() throws Exception {
    Response response = toTest.getAlgoritms();

    org.junit.Assert.assertEquals(200, response.getStatus());
    Assert.isInstanceOf(List.class, response.getEntity());

}

From source file:org.apache.mina.springrpc.MinaServerHandler.java

@Override
public void messageReceived(IoSession session, Object message) throws Exception {
    if (logger.isDebugEnabled()) {
        logger.debug("Message received : " + message);
    }// www.j  a  v  a 2 s  .  co  m
    Assert.isInstanceOf(ReturnAddressAwareRemoteInvocation.class, message);
    ReturnAddressAwareRemoteInvocation invocation = (ReturnAddressAwareRemoteInvocation) message;
    ReturnAddressAwareRemoteInvocationResult result = invocationHandler.invoke(invocation);
    session.write(result);
}

From source file:com.alliander.osgp.adapter.ws.endpointinterceptors.SoapHeaderEndpointInterceptor.java

@Override
public boolean handleRequest(final MessageContext messageContext, final Object endpoint) throws Exception {

    Assert.isInstanceOf(SoapMessage.class, messageContext.getRequest());
    final SoapMessage request = (SoapMessage) messageContext.getRequest();
    final SoapHeader soapHeader = request.getSoapHeader();

    // Try to get the values from the Soap Header.
    final String organisationIdentification = SoapHeaderEndpointInterceptorHelper.getHeaderValue(soapHeader,
            this.organisationIdentificationHeaderName);
    final String userName = SoapHeaderEndpointInterceptorHelper.getHeaderValue(soapHeader,
            this.USER_NAME_HEADER_NAME);
    final String applicationName = SoapHeaderEndpointInterceptorHelper.getHeaderValue(soapHeader,
            this.APPLICTION_NAME_HEADER_NAME);

    // Check if the values are empty, if so, throw exception.
    if (StringUtils.isEmpty(organisationIdentification)) {
        throw new EmptyOrganisationIdentificationSoapHeaderException();
    }//ww  w .  j a v  a2  s  .  co  m

    if (StringUtils.isEmpty(userName)) {
        throw new EmptyUserNameSoapHeaderException();
    }

    if (StringUtils.isEmpty(applicationName)) {
        throw new EmptyApplicationNameSoapHeaderException();
    }

    // Finally, set the organisation identification into the message
    // context, so it can be used in the end point later.
    messageContext.setProperty(this.contextPropertyName, organisationIdentification);

    // Return true so the interceptor chain will continue.
    return true;
}

From source file:org.apache.cxf.fediz.service.idp.beans.CacheTokenForWauthAction.java

public void submit(RequestContext context) {

    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    Assert.isInstanceOf(STSUserDetails.class, auth.getDetails());
    final STSUserDetails stsUserDetails = (STSUserDetails) auth.getDetails();
    SecurityToken securityToken = stsUserDetails.getSecurityToken();

    Idp idpConfig = (Idp) WebUtils.getAttributeFromFlowScope(context, IDP_CONFIG);

    WebUtils.putAttributeInExternalContext(context, idpConfig.getRealm(), securityToken);
    LOG.info("Token [IDP_TOKEN=" + securityToken.getId() + "] for realm [" + idpConfig.getRealm()
            + "] successfully cached.");
}

From source file:io.twipple.springframework.data.clusterpoint.convert.DefaultClusterpointTypeAliasAccessor.java

@Override
public void writeTypeTo(@NotNull ClusterpointDocument sink, @NotNull Object alias) {

    Assert.notNull(sink);/*from w ww . j  a  v  a  2  s . co m*/
    Assert.notNull(alias);
    Assert.isInstanceOf(QName.class, alias);

    sink.setTypeAlias((QName) alias);
}

From source file:org.trustedanalytics.servicebroker.hive.config.ServiceInstanceProvisioningConfigTest.java

@Test
public void CreatingJdbcOperationsTest() {
    Assert.isInstanceOf(JdbcTemplate.class, toTest);
}