use of io.codekvast.common.customer.CustomerData in project codekvast by crispab.
the class DashboardIntegrationTest method should_accept_valid_getCustomerDataByCustomerId_2.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_accept_valid_getCustomerDataByCustomerId_2() {
CustomerData customerData = customerService.getCustomerDataByCustomerId(2L);
assertThat(customerData.getCustomerId(), is(2L));
assertThat(customerData.getContactEmail(), nullValue());
}
use of io.codekvast.common.customer.CustomerData in project codekvast by crispab.
the class DashboardIntegrationTest method should_accept_valid_getCustomerDataByLicenseKey.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_accept_valid_getCustomerDataByLicenseKey() {
CustomerData customerData = customerService.getCustomerDataByLicenseKey("");
assertThat(customerData.getCustomerId(), is(1L));
assertThat(customerData.getCustomerName(), is("Demo"));
assertThat(customerData.getPricePlan().getName(), is("DEMO"));
}
use of io.codekvast.common.customer.CustomerData in project codekvast by crispab.
the class MariadbIntegrationTest method should_start_trial_period_at_first_agent_publishing.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_start_trial_period_at_first_agent_publishing() {
// given
Instant now = Instant.now();
jdbcTemplate.update("UPDATE customers SET plan = 'test', collectionStartedAt = NULL, trialPeriodEndsAt = NULL WHERE id = 1");
CustomerData customerData = customerService.getCustomerDataByCustomerId(1L);
assertThat(customerData.getPricePlan().getMaxCollectionPeriodDays(), is(PricePlanDefaults.TEST.getMaxCollectionPeriodDays()));
assertThat(customerData.getCollectionStartedAt(), is(nullValue()));
assertThat(customerData.getTrialPeriodEndsAt(), is(nullValue()));
assertThat(customerData.isTrialPeriodExpired(now), is(false));
// when
customerData = customerService.registerAgentDataPublication(customerData, now);
// then
assertThat(customerData.getCollectionStartedAt(), is(now));
int days = customerData.getPricePlan().getMaxCollectionPeriodDays();
assertThat(customerData.getTrialPeriodEndsAt(), is(now.plus(days, DAYS)));
assertThat(customerData.isTrialPeriodExpired(now.plus(days - 1, DAYS)), is(false));
assertThat(customerData.isTrialPeriodExpired(now.plus(days + 1, DAYS)), is(true));
}
use of io.codekvast.common.customer.CustomerData in project codekvast by crispab.
the class MariadbIntegrationTest method should_accept_valid_getCustomerDataByExternalId_with_pricePlanOverride.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_accept_valid_getCustomerDataByExternalId_with_pricePlanOverride() {
CustomerData customerData = customerService.getCustomerDataByExternalId("external-1");
assertThat(customerData.getCustomerId(), is(1L));
assertThat(customerData.getCustomerName(), is("Demo"));
assertThat(customerData.getPricePlan().getName(), is("DEMO"));
assertThat(customerData.getPricePlan().getOverrideBy(), is("integration test"));
}
use of io.codekvast.common.customer.CustomerData in project codekvast by crispab.
the class MariadbIntegrationTest method should_accept_valid_getCustomerDataByLicenseKey.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_accept_valid_getCustomerDataByLicenseKey() {
CustomerData customerData = customerService.getCustomerDataByLicenseKey("");
assertThat(customerData.getCustomerId(), is(1L));
assertThat(customerData.getCustomerName(), is("Demo"));
assertThat(customerData.getPricePlan().getName(), is("DEMO"));
}
Aggregations