• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Tenant类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: respondTaxCodes

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
private void respondTaxCodes(final Tenant tenant, final String taxZone,
        final String productName, final String taxCode, final DateTime validDate,
        final HttpServletResponse resp) throws IOException {
    final List<EasyTaxTaxCode> taxCodesRecords;
    try {
        taxCodesRecords = dao.getTaxCodes(tenant.getId(), taxZone, productName, taxCode,
                validDate);
    } catch (final SQLException e) {
        buildErrorResponse(e, resp);
        return;
    }

    final byte[] data = JSON_MAPPER.writeValueAsBytes(taxCodesRecords);
    resp.setContentType(APPLICATION_JSON_UTF8);
    buildOKResponse(data, resp);
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:17,代码来源:EasyTaxServlet.java


示例2: addTaxCode

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
private void addTaxCode(final Tenant tenant, final String taxZone, final String productName,
        final String taxCode, final ServletRequest req, final HttpServletResponse resp)
        throws IOException {
    final EasyTaxTaxCode code = JSON_MAPPER.readValue(getRequestData(req),
            EasyTaxTaxCode.class);
    code.setCreatedDate(clock.getUTCNow());
    code.setKbTenantId(tenant.getId());
    code.setTaxZone(taxZone);
    code.setProductName(productName);
    code.setTaxCode(taxCode);
    try {
        dao.saveTaxCode(code);
    } catch (final SQLException e) {
        buildErrorResponse(e, resp);
        return;
    }

    buildCreatedResponse(
            "/plugins/killbill-easytax/taxCodes/" + taxZone + "/" + productName + "/" + taxCode,
            resp);
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:22,代码来源:EasyTaxServlet.java


示例3: addTaxCodes

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
private void addTaxCodes(final Tenant tenant, final ServletRequest req,
        final HttpServletResponse resp) throws IOException {
    final List<EasyTaxTaxCode> taxCodes = JSON_MAPPER.readValue(getRequestData(req),
            TAX_CODE_LIST_MAPPING_TYPE);
    if (taxCodes == null) {
        return;
    }
    DateTime now = clock.getUTCNow();
    UUID tenantId = tenant.getId();
    for (EasyTaxTaxCode code : taxCodes) {
        code.setKbTenantId(tenantId);
        code.setCreatedDate(now);
    }
    try {
        dao.saveTaxCodes(taxCodes);
    } catch (final SQLException e) {
        buildErrorResponse(e, resp);
        return;
    }

    buildOKResponse(null, resp);
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:23,代码来源:EasyTaxServlet.java


示例4: getEventTypesPerAccount

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@GET
@Path("/accounts/:kbAccountId")
public Result getEventTypesPerAccount(@Named("kbAccountId") final UUID kbAccountId, @Local @Named("killbill_tenant") final Tenant tenant,
                            Optional<ExtBusEventType> eventType) {
    final UUID kbTenantId = tenant.getId();

    if (!eventType.isPresent())
    {
        return EmailNotificationService.getEventTypesPerAccount(this.dao, kbAccountId, kbTenantId);
    }
    else
    {
        return EmailNotificationService.getEventTypePerAccount(this.dao, kbAccountId, kbTenantId, eventType.get());

    }
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:17,代码来源:EmailNotificationServlet.java


示例5: shouldDispatchGetAccountTaxCountry

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetAccountTaxCountry() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).getAccountTaxCountry(accountId, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:19,代码来源:TestSimpleTaxServlet.java


示例6: shouldRenderAccountTaxCountry

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRenderAccountTaxCountry() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");

    TaxCountryRsc rsc = new TaxCountryRsc(accountId, FRANCE);
    when(taxCountryController.getAccountTaxCountry(accountId, tenant)).thenReturn(rsc);

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
    assertEquals(mocks.getResponseContent(), "{\"accountId\":\"" + accountId + "\",\"taxCountry\":\"" + FR + "\"}");
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:21,代码来源:TestSimpleTaxServlet.java


示例7: shouldDispatchGetAccountVATIN

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetAccountVATIN() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/vatin");

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).getAccountVatin(eq(accountId), eq(tenant));
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:19,代码来源:TestSimpleTaxServlet.java


示例8: shouldRenderAccountVATIN

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRenderAccountVATIN() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");

    VATINRsc rsc = new VATINRsc(accountId, FR_TEST6_VATIN);
    when(taxCountryController.getAccountTaxCountry(accountId, tenant)).thenReturn(rsc);

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
    assertEquals(mocks.getResponseContent(), "{\"accountId\":\"" + accountId + "\",\"vatin\":\""
            + FR_TEST6_VATIN_NUM + "\"}");
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:22,代码来源:TestSimpleTaxServlet.java


示例9: shouldDispatchGetTaxCountries

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetTaxCountries() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    when(mocks.req().getPathInfo()).thenReturn(TAX_COUNTRIES_RSC_URI);

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).listTaxCountries(null, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:18,代码来源:TestSimpleTaxServlet.java


示例10: shouldDispatchGetTaxCountriesWhenAccountRestrictionIsBlank

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetTaxCountriesWhenAccountRestrictionIsBlank() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    when(mocks.req().getPathInfo()).thenReturn(TAX_COUNTRIES_RSC_URI);
    when(mocks.req().getHeader(ACCOUNT_PARAM_NAME)).thenReturn("\t");

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).listTaxCountries(null, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:19,代码来源:TestSimpleTaxServlet.java


示例11: shouldDispatchGetTaxCountriesWithAccountRestriction

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetTaxCountriesWithAccountRestriction() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn(TAX_COUNTRIES_RSC_URI);
    when(mocks.req().getParameter(ACCOUNT_PARAM_NAME)).thenReturn(accountId.toString());

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).listTaxCountries(accountId, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:20,代码来源:TestSimpleTaxServlet.java


示例12: shouldDispatchGetVATINs

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetVATINs() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    when(mocks.req().getPathInfo()).thenReturn(VATINS_RSC_URI);

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).listVatins(null, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:18,代码来源:TestSimpleTaxServlet.java


示例13: shouldDispatchGetVATINsWhenAccountRestrictionIsBlank

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetVATINsWhenAccountRestrictionIsBlank() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    when(mocks.req().getPathInfo()).thenReturn(VATINS_RSC_URI);
    when(mocks.req().getHeader(ACCOUNT_PARAM_NAME)).thenReturn("\t");

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).listVatins(null, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:19,代码来源:TestSimpleTaxServlet.java


示例14: shouldDispatchGetVATINsWithAccountRestriction

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetVATINsWithAccountRestriction() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn(VATINS_RSC_URI);
    when(mocks.req().getParameter(ACCOUNT_PARAM_NAME)).thenReturn(accountId.toString());

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).listVatins(accountId, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:20,代码来源:TestSimpleTaxServlet.java


示例15: shouldRespondInternalServerErrorWhenSavingAccountTaxCountryFails

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRespondInternalServerErrorWhenSavingAccountTaxCountryFails() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");
    mocks.withRequestBody("{\"accountId\":\"" + accountId + "\",\"taxCountry\":\"" + FR + "\"}");

    // When
    servlet.doPut(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).saveAccountTaxCountry(eq(accountId), taxCountryRsc.capture(), eq(tenant));
    assertEquals(taxCountryRsc.getValue().accountId, accountId);
    assertEquals(taxCountryRsc.getValue().taxCountry, FRANCE);
    assertEquals(mocks.getResponseStatus(), SC_INTERNAL_SERVER_ERROR);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:21,代码来源:TestSimpleTaxServlet.java


示例16: shouldRespondBadRequestWhenDispatchingPutAccountTaxCountryWithInvalidCountry

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRespondBadRequestWhenDispatchingPutAccountTaxCountryWithInvalidCountry() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");
    mocks.withRequestBody("{\"accountId\":\"" + accountId + "\",\"taxCountry\":\"KK\"}");

    when(taxCountryController.saveAccountTaxCountry(eq(accountId), any(TaxCountryRsc.class), eq(tenant)))
            .thenReturn(true);

    // When
    servlet.doPut(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController, vatinController);
    assertEquals(mocks.getResponseStatus(), SC_BAD_REQUEST);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:21,代码来源:TestSimpleTaxServlet.java


示例17: shouldDispatchPutAccountTaxCountry

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchPutAccountTaxCountry() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");
    mocks.withRequestBody("{\"accountId\":\"" + accountId + "\",\"taxCountry\":\"" + FR + "\"}");

    when(taxCountryController.saveAccountTaxCountry(eq(accountId), any(TaxCountryRsc.class), eq(tenant)))
            .thenReturn(true);

    // When
    servlet.doPut(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).saveAccountTaxCountry(eq(accountId), taxCountryRsc.capture(), eq(tenant));
    assertEquals(taxCountryRsc.getValue().accountId, accountId);
    assertEquals(taxCountryRsc.getValue().taxCountry, FRANCE);
    assertEquals(mocks.getResponseStatus(), SC_CREATED);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:24,代码来源:TestSimpleTaxServlet.java


示例18: shouldRespondInternalServerErrorWhenSavingAccountVATINFails

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRespondInternalServerErrorWhenSavingAccountVATINFails() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/vatin");
    mocks.withRequestBody("{\"accountId\":\"" + accountId + "\",\"vatin\":\"" + FR_TEST6_VATIN_NUM + "\"}");

    // When
    servlet.doPut(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).saveAccountVatin(eq(accountId), vatinRsc.capture(), eq(tenant));
    assertEquals(vatinRsc.getValue().accountId, accountId);
    assertEquals(vatinRsc.getValue().vatin, FR_TEST6_VATIN);
    assertEquals(mocks.getResponseStatus(), SC_INTERNAL_SERVER_ERROR);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:21,代码来源:TestSimpleTaxServlet.java


示例19: shouldRespondBadRequestWhenDispatchingPutAccountVATINWithInvalidVATIN

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRespondBadRequestWhenDispatchingPutAccountVATINWithInvalidVATIN() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/vatin");
    mocks.withRequestBody("{\"accountId\":\"" + accountId + "\",\"vatin\":\"boom!\"}");

    when(vatinController.saveAccountVatin(eq(accountId), any(VATINRsc.class), eq(tenant))).thenReturn(true);

    // When
    servlet.doPut(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController, vatinController);
    assertEquals(mocks.getResponseStatus(), SC_BAD_REQUEST);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:20,代码来源:TestSimpleTaxServlet.java


示例20: shouldDispatchPutAccountVATIN

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchPutAccountVATIN() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/vatin");
    mocks.withRequestBody("{\"accountId\":\"" + accountId + "\",\"vatin\":\"" + FR_TEST6_VATIN_NUM + "\"}");

    when(vatinController.saveAccountVatin(eq(accountId), any(VATINRsc.class), eq(tenant))).thenReturn(true);

    // When
    servlet.doPut(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).saveAccountVatin(eq(accountId), vatinRsc.capture(), eq(tenant));
    assertEquals(vatinRsc.getValue().accountId, accountId);
    assertEquals(vatinRsc.getValue().vatin, FR_TEST6_VATIN);
    assertEquals(mocks.getResponseStatus(), SC_CREATED);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:23,代码来源:TestSimpleTaxServlet.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FifoPriorityThreadPoolExecutor类代码示例发布时间:2022-05-23
下一篇:
Java JJavaName类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap