protected void refreshCallContext(final UUID accountId) { refreshCallContext(accountId, clock, internalCallContextFactory, callContext, internalCallContext); }
@Override public void run(final IHookCallBack callBack, final ITestResult testResult) { // Make sure we start with a clean state assertListenerStatus(); // Run the actual test callBack.runTestMethod(testResult); if (testResult.getThrowable() == null) { // Make sure we finish in a clean state (if the test didn't fail) assertListenerStatus(); } }
protected KillbillConfigSource getConfigSource(final Map<String, String> extraProperties) { return getConfigSource(null, extraProperties); }
@BeforeMethod(alwaysRun = true) public void beforeMethodAlwaysRun(final Method method) throws Exception { if (hasFailed()) { return; } log.info("***************************************************************************************************"); log.info("*** Starting test {}:{}", method.getDeclaringClass().getName(), method.getName()); log.info("***************************************************************************************************"); if (internalCallContext != null) { internalCallContext.reset(); } }
@AfterMethod(alwaysRun = true) public void afterMethodAlwaysRun(final Method method, final ITestResult result) throws Exception { if (hasFailed()) { return;
protected void refreshCallContext() { refreshCallContext(callContext.getAccountId(), clock, internalCallContextFactory, callContext, internalCallContext); }
@BeforeMethod(alwaysRun = true) public void beforeMethodAlwaysRun(final Method method) throws Exception { if (hasFailed()) { return; } log.info("***************************************************************************************************"); log.info("*** Starting test {}:{}", method.getDeclaringClass().getName(), method.getName()); log.info("***************************************************************************************************"); if (internalCallContext != null) { internalCallContext.reset(); } }
@BeforeClass(alwaysRun = true) public void globalBeforeTest() { configSource = getConfigSource(extraPropertiesForTestSuite); skifeConfigSource = new ConfigSource() { @Override public String getString(final String propertyName) { return configSource.getString(propertyName); } }; // We need to set the instance variable in each subsequent class instantiated in the suite clock = Mockito.mock(ClockMock.class, new Answer() { @Override public Object answer(final InvocationOnMock invocation) throws Throwable { final Object answer = invocation.getMethod().invoke(theRealClock, invocation.getArguments()); final DateTime utcNow = theRealClock.getUTCNow(); if (callContext != null) { callContext.setCreatedDate(utcNow); } if (internalCallContext != null) { internalCallContext.setCreatedDate(utcNow); internalCallContext.setUpdatedDate(utcNow); } return answer; } }); }
@Override public void run(final IHookCallBack callBack, final ITestResult testResult) { // Make sure we start with a clean state assertListenerStatus(); // Run the actual test callBack.runTestMethod(testResult); if (testResult.getThrowable() == null) { // Make sure we finish in a clean state (if the test didn't fail) assertListenerStatus(); } }
protected void refreshCallContext(final UUID accountId) { refreshCallContext(accountId, clock, internalCallContextFactory, callContext, internalCallContext); }
@AfterMethod(alwaysRun = true) public void afterMethodAlwaysRun(final Method method, final ITestResult result) throws Exception { if (hasFailed()) { return;
protected KillbillConfigSource getConfigSource(final Map<String, String> extraProperties) { return getConfigSource(null, extraProperties); }
protected void refreshCallContext() { refreshCallContext(callContext.getAccountId(), clock, internalCallContextFactory, callContext, internalCallContext); }
@BeforeClass(alwaysRun = true) public void globalBeforeTest() { configSource = getConfigSource(extraPropertiesForTestSuite); skifeConfigSource = new ConfigSource() { @Override public String getString(final String propertyName) { return configSource.getString(propertyName); } }; // We need to set the instance variable in each subsequent class instantiated in the suite clock = Mockito.mock(ClockMock.class, new Answer() { @Override public Object answer(final InvocationOnMock invocation) throws Throwable { final Object answer = invocation.getMethod().invoke(theRealClock, invocation.getArguments()); final DateTime utcNow = theRealClock.getUTCNow(); if (callContext != null) { callContext.setCreatedDate(utcNow); } if (internalCallContext != null) { internalCallContext.setCreatedDate(utcNow); internalCallContext.setUpdatedDate(utcNow); } return answer; } }); }
GuicyKillbillTestSuite.refreshCallContext(account.getId(), clock, internalCallContextFactory, mutableCallContext, internalCallContext);
public Account createAccount(final CallContext callContext) throws AccountApiException { final Account accountData = new MockAccountBuilder().name(UUID.randomUUID().toString().substring(1, 8)) .firstNameLength(6) .email(UUID.randomUUID().toString().substring(1, 8)) .phone(UUID.randomUUID().toString().substring(1, 8)) .migrated(false) .externalKey(UUID.randomUUID().toString().substring(1, 8)) .billingCycleDayLocal(31) .currency(accountCurrency) .paymentMethodId(UUID.randomUUID()) .timeZone(DateTimeZone.UTC) .createdDate(clock.getUTCNow()) .build(); final MutableCallContext mutableCallContext = new MutableCallContext(internalCallContext); final Account account; if (isFastTest()) { account = GuicyKillbillTestSuiteNoDB.createMockAccount(accountData, accountUserApi, accountApi, immutableAccountApi, nonEntityDao, clock, internalCallContextFactory, mutableCallContext, internalCallContext); } else { account = accountUserApi.createAccount(accountData, callContext); } GuicyKillbillTestSuite.refreshCallContext(account.getId(), clock, internalCallContextFactory, mutableCallContext, internalCallContext); return account; }