Search in sources :

Example 1 with TenantContextHolder

use of com.icthh.xm.commons.tenant.TenantContextHolder in project xm-ms-entity by xm-online.

the class XmTenantLifecycleServiceUnitTest method before.

@Before
public void before() {
    MockitoAnnotations.initMocks(this);
    TenantContextHolder tenantContextHolder = mock(TenantContextHolder.class);
    when(tenantContextHolder.getContext()).thenReturn(tenantContext);
    when(tenantContext.getTenant()).thenReturn(Optional.of(tenant));
    when(tenant.isSuper()).thenReturn(true);
    xmTenantLifecycleService = new XmTenantLifecycleService(tenantClients, applicationProperties, tenantContextHolder);
}
Also used : TenantContextHolder(com.icthh.xm.commons.tenant.TenantContextHolder) Before(org.junit.Before)

Example 2 with TenantContextHolder

use of com.icthh.xm.commons.tenant.TenantContextHolder in project xm-ms-entity by xm-online.

the class XmEntitySpecServiceUnitTest method init.

@Before
@SneakyThrows
public void init() {
    TenantContext tenantContext = mock(TenantContext.class);
    when(tenantContext.getTenantKey()).thenReturn(Optional.of(TenantKey.valueOf(TENANT)));
    tenantContextHolder = mock(TenantContextHolder.class);
    when(tenantContextHolder.getContext()).thenReturn(tenantContext);
    ApplicationProperties ap = new ApplicationProperties();
    ap.setSpecificationPathPattern(URL);
    xmEntitySpecService = createXmEntitySpecService(ap, tenantContextHolder);
}
Also used : TenantContext(com.icthh.xm.commons.tenant.TenantContext) TenantContextHolder(com.icthh.xm.commons.tenant.TenantContextHolder) ApplicationProperties(com.icthh.xm.ms.entity.config.ApplicationProperties) Before(org.junit.Before) SneakyThrows(lombok.SneakyThrows)

Aggregations

TenantContextHolder (com.icthh.xm.commons.tenant.TenantContextHolder)2 Before (org.junit.Before)2 TenantContext (com.icthh.xm.commons.tenant.TenantContext)1 ApplicationProperties (com.icthh.xm.ms.entity.config.ApplicationProperties)1 SneakyThrows (lombok.SneakyThrows)1