Package de.novanic.eventservice.service

Examples of de.novanic.eventservice.service.EventServiceException


        ListenRunnable theListenRunnable = new ListenRunnable(theStreamingServerConnector, theUserInfo);
        Thread theListenThread = new Thread(theListenRunnable);
        theListenThread.start();
        theListenThread.join();

        EventServiceException theOccurredException = theListenRunnable.getOccurredException();
        assertNotNull(theOccurredException);
        assertTrue(theOccurredException.getCause() instanceof IOException);
    }
View Full Code Here


        theUserInfo.addEvent(theDomain, new DummyEvent());

        theListenThread.join();

        EventServiceException theOccurredException = theListenRunnable.getOccurredException();
        assertNotNull(theOccurredException);
        assertTrue(theOccurredException.getCause() instanceof SerializationException);
    }
View Full Code Here

        theUserInfo.addEvent(theDomain, new DummyEvent());

        theListenThread.join();

        EventServiceException theOccurredException = theListenRunnable.getOccurredException();
        assertNotNull(theOccurredException);
        assertTrue(theOccurredException.getCause() instanceof UnsupportedEncodingException);
    }
View Full Code Here

        //interrupt min. waiting
        theListenThread.interrupt();

        theListenThread.join();

        EventServiceException theOccurredException = theListenRunnable.getOccurredException();
        assertNotNull(theOccurredException);
        assertTrue(theOccurredException.getCause() instanceof InterruptedException);

        Date theEndTime = new Date();
        assertTrue((theEndTime.getTime() - theStartTime.getTime()) < 1000);
    }
View Full Code Here

                    try {
                        final long theStartTime = System.currentTimeMillis();
                        aUserInfo.wait(theMaxWaitingTime);
                        return (System.currentTimeMillis() - theStartTime >= theMaxWaitingTime);
                    } catch(InterruptedException e) {
                        throw new EventServiceException("Error on waiting max. waiting time!", e);
                    }
                }
            }
        }
        return false;
View Full Code Here

    private void waitTime(int aWaitingTime) throws EventServiceException {
        if(aWaitingTime > 0) {
            try {
                Thread.sleep(aWaitingTime);
            } catch(InterruptedException e) {
                throw new EventServiceException("Error on waiting min. waiting time!", e);
            }
        }
    }
View Full Code Here

     */
    protected static String getEncoding() throws EventServiceException {
        if(ENCODING != null) {
            return ENCODING;
        }
        throw new EventServiceException("The encoding property wasn't initialized. It is initialized with the configuration at the time of object construction.");
    }
View Full Code Here

     */
    protected static byte[] encode(String aString) throws EventServiceException {
        try {
            return aString.getBytes(getEncoding());
        } catch(UnsupportedEncodingException e) {
            throw new EventServiceException("Error on encoding \"" + aString + "\"!", e); //shouldn't be able to occur
        }
    }
View Full Code Here

    public void prepare(HttpServletResponse aResponse) throws EventServiceException {
        myResponse = aResponse;
        try {
            myOutputStream = aResponse.getOutputStream();
        } catch(IOException e) {
            throw new EventServiceException("Error on using output stream of the response!", e);
        }
        myResponse.setContentType("text/html;charset=" + getEncoding());
        myResponse.setHeader("expires", "0");
        myResponse.setHeader("cache-control", "no-cache");
        myResponse.setHeader("transfer-encoding", "chunked");
View Full Code Here

      theServerSerializationStreamWriter.serializeValue(anEvent, DomainEvent.class);

      return theServerSerializationStreamWriter.toString();
      } catch(SerializationException e) {
      throw new EventServiceException("Error on serializing the event \"" + anEvent
                    + "\" for domain \"" + anEvent.getDomain() + "\"!", e);
    }
    }
View Full Code Here

TOP

Related Classes of de.novanic.eventservice.service.EventServiceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.