Search in sources :

Example 1 with PojoProducerMeta

use of org.apache.servicecomb.provider.pojo.schema.PojoProducerMeta in project incubator-servicecomb-java-chassis by apache.

the class PojoProducerProvider method init.

@Override
public void init() throws Exception {
    for (PojoProducerMeta pojoProducerMeta : pojoProducers.getProducers()) {
        initPojoProducerMeta(pojoProducerMeta);
        Microservice microservice = RegistryUtils.getMicroservice();
        try {
            producerSchemaFactory.getOrCreateProducerSchema(microservice.getServiceName(), pojoProducerMeta.getSchemaId(), pojoProducerMeta.getInstanceClass(), pojoProducerMeta.getInstance());
        } catch (Throwable e) {
            throw new IllegalArgumentException("create producer schema failed, class=" + pojoProducerMeta.getInstanceClass().getName(), e);
        }
    }
}
Also used : Microservice(org.apache.servicecomb.serviceregistry.api.registry.Microservice) PojoProducerMeta(org.apache.servicecomb.provider.pojo.schema.PojoProducerMeta)

Example 2 with PojoProducerMeta

use of org.apache.servicecomb.provider.pojo.schema.PojoProducerMeta in project incubator-servicecomb-java-chassis by apache.

the class MockUtil method mockAbstractServiceProvider.

public void mockAbstractServiceProvider() {
    new MockUp<AbstractProducerProvider>() {

        @SuppressWarnings("unchecked")
        @Mock
        protected <T> T findProviderSchema(OperationMeta operationMeta) {
            PojoProducerMeta lPojoSchemaMeta = Mockito.mock(PojoProducerMeta.class);
            Mockito.when(lPojoSchemaMeta.getInstance()).thenReturn(lPojoSchemaMeta);
            return (T) lPojoSchemaMeta;
        }
    };
}
Also used : PojoProducerMeta(org.apache.servicecomb.provider.pojo.schema.PojoProducerMeta) MockUp(mockit.MockUp) OperationMeta(org.apache.servicecomb.core.definition.OperationMeta)

Aggregations

PojoProducerMeta (org.apache.servicecomb.provider.pojo.schema.PojoProducerMeta)2 MockUp (mockit.MockUp)1 OperationMeta (org.apache.servicecomb.core.definition.OperationMeta)1 Microservice (org.apache.servicecomb.serviceregistry.api.registry.Microservice)1