Search in sources :

Example 1 with ApplicationProperties

use of com.icthh.xm.ms.entity.config.ApplicationProperties 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)

Example 2 with ApplicationProperties

use of com.icthh.xm.ms.entity.config.ApplicationProperties in project xm-ms-entity by xm-online.

the class AvatarUrlListener method getPrefix.

private String getPrefix() {
    if (prefix == null) {
        ApplicationContext ctx = ApplicationContextHolder.getInstance().getApplicationContext();
        ApplicationProperties applicationProperties = ctx.getBean("applicationProperties", ApplicationProperties.class);
        prefix = String.format(applicationProperties.getAmazon().getAws().getTemplate(), applicationProperties.getAmazon().getS3().getBucket());
    }
    return prefix;
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) ApplicationProperties(com.icthh.xm.ms.entity.config.ApplicationProperties)

Aggregations

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