Search in sources :

Example 6 with ClientSession

use of com.tyndalehouse.step.core.models.ClientSession in project step by STEPBible.

the class IndexAll method main.

/**
 * main method
 *
 * @param args list of arguments
 */
public static void main(final String[] args) {
    final BibleInformationService instance = Guice.createInjector(new StepCoreModule(), new Module() {

        @Override
        public void configure(final Binder binder) {
            binder.bind(ClientSession.class).toProvider(new Provider<ClientSession>() {

                @Override
                public ClientSession get() {
                    // TODO Auto-generated method stub
                    return null;
                }
            });
        }
    }).getInstance(BibleInformationService.class);
    instance.indexAll();
}
Also used : Binder(com.google.inject.Binder) BibleInformationService(com.tyndalehouse.step.core.service.BibleInformationService) ClientSession(com.tyndalehouse.step.core.models.ClientSession) StepCoreModule(com.tyndalehouse.step.core.guice.StepCoreModule) Module(com.google.inject.Module) StepCoreModule(com.tyndalehouse.step.core.guice.StepCoreModule)

Example 7 with ClientSession

use of com.tyndalehouse.step.core.models.ClientSession in project step by STEPBible.

the class FrontControllerTest method setUp.

/**
 * Simply setting up the FrontController under test
 */
@Before
public void setUp() throws IOException {
    final ClientSession clientSession = mock(ClientSession.class);
    when(clientSession.getLocale()).thenReturn(Locale.ENGLISH);
    when(this.clientSessionProvider.get()).thenReturn(clientSession);
    final ObjectMapper mockMapper = mock(ObjectMapper.class);
    when(mockMapper.writeValueAsString(any(Object.class))).thenReturn("Test");
    when(this.objectMapper.get()).thenReturn(mockMapper);
    this.fcUnderTest = new FrontController(this.guiceInjector, mock(AppManagerService.class), this.errorResolver, this.clientSessionProvider, objectMapper);
}
Also used : ClientSession(com.tyndalehouse.step.core.models.ClientSession) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Before(org.junit.Before)

Example 8 with ClientSession

use of com.tyndalehouse.step.core.models.ClientSession in project step by STEPBible.

the class SupportController method createRequest.

/**
 * Creates a support request in JIRA - this is a POST, so we need to get the parameters in manually ourselves
 * rather than rely on reflection
 */
@Timed(name = "support-request", group = "analysis", rateUnit = TimeUnit.SECONDS, durationUnit = TimeUnit.MILLISECONDS)
public void createRequest() {
    final ClientSession session = clientSession.get();
    this.supportRequestService.createRequest(session.getParam("summary"), session.getParam("description"), session.getParam("url"), session.getParam("type"), session.getParam("email"));
}
Also used : ClientSession(com.tyndalehouse.step.core.models.ClientSession) Timed(com.yammer.metrics.annotation.Timed)

Aggregations

ClientSession (com.tyndalehouse.step.core.models.ClientSession)8 Before (org.junit.Before)3 Binder (com.google.inject.Binder)1 Module (com.google.inject.Module)1 ProvisionException (com.google.inject.ProvisionException)1 TestEntityManager (com.tyndalehouse.step.core.data.entities.impl.TestEntityManager)1 StepInternalException (com.tyndalehouse.step.core.exceptions.StepInternalException)1 StepCoreModule (com.tyndalehouse.step.core.guice.StepCoreModule)1 BibleInformationService (com.tyndalehouse.step.core.service.BibleInformationService)1 Timed (com.yammer.metrics.annotation.Timed)1 InetAddress (java.net.InetAddress)1 SocketException (java.net.SocketException)1 UnknownHostException (java.net.UnknownHostException)1 Locale (java.util.Locale)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 ConfigValueInterceptor (org.crosswire.jsword.book.sword.ConfigValueInterceptor)1 LocaleProvider (org.crosswire.jsword.internationalisation.LocaleProvider)1 Test (org.junit.Test)1