Example usage for java.lang Object Object

List of usage examples for java.lang Object Object

Introduction

In this page you can find the example usage for java.lang Object Object.

Prototype

@HotSpotIntrinsicCandidate
public Object() 

Source Link

Document

Constructs a new object.

Usage

From source file:com.redhat.lightblue.metadata.types.IntegerTypeTest.java

@Test
public void testCompareV2Null() {
    assertEquals(integerType.compare(new Object(), null), 1);
}

From source file:net.eusashead.hateoas.conditional.interceptor.ConditionalResponseInterceptorTest.java

@Test
public void testPreHandleGetEtagMiss() throws Exception {

    // Request value
    String path = "/path/to/resource/";
    String query = "query=string";

    // Set ETag value to return by service
    setETag(path, query, "etag-a");

    // Build request/response
    HttpServletRequest request = get("/path/to/resource/", "query=string").ifNoneMatch("etag-b").build();
    HttpServletResponse response = response().build();

    // Execute/*from  w  w  w. ja va2s  .c  om*/
    boolean handle = interceptor.preHandle(request, response, new Object());

    // Validate
    Assert.assertTrue(handle);

}

From source file:com.redhat.lightblue.metadata.types.BigIntegerTypeTest.java

@Test
public void testCompareV1Null() {
    assertEquals(bigIntegerType.compare(null, new Object()), -1);
}

From source file:org.sakaiproject.scorm.ui.player.behaviors.AbstractSCORM13APBase.java

@Before
public void onSetUpBeforeTransaction() throws Exception {
    scormApplicationService = (ScormApplicationService) applicationContext
            .getBean("org.sakaiproject.scorm.service.api.ScormApplicationService");
    scormSequencingService = (ScormSequencingService) applicationContext
            .getBean("org.sakaiproject.scorm.service.api.ScormSequencingService");
    scormContentService = (ScormContentService) applicationContext
            .getBean("org.sakaiproject.scorm.service.api.ScormContentService");
    scormResourceService = (ScormResourceService) applicationContext
            .getBean("org.sakaiproject.scorm.service.api.ScormResourceService");

    resourceId = scormResourceService.putArchive(getClass().getResourceAsStream("SCORM2004.3.PITE.1.1.zip"),
            "SCORM2004.3.PITE.1.1.zip", "application/zip", true, 0);

    scormContentService.storeAndValidate(resourceId, false, "UTF-8");
    contentPackage = scormContentService.getContentPackages().get(0);
    sessionBean = new SessionBean();
    sessionBean.setContentPackage(contentPackage);
    sessionBean.setErrorManager(new APIErrorManager(IErrorManager.SCORM_2004_API));
    // init the launch data.
    scormSequencingService.navigate(SeqNavRequests.NAV_START, sessionBean, null, new Object());
    scoBean = scormApplicationService.produceScoBean("undefined", sessionBean);

    scorm13api = new SCORM13API() {

        @Override//from w  w w  .  j av  a  2s  . c o m
        public Object getTarget() {
            return null;
        }

        @Override
        public SessionBean getSessionBean() {
            return sessionBean;
        }

        @Override
        public ScormSequencingService getSequencingService() {
            return scormSequencingService;
        }

        @Override
        public ScoBean getScoBean() {
            return scoBean;
        }

        @Override
        public ScormApplicationService getApplicationService() {
            return scormApplicationService;
        }

        @Override
        public INavigable getAgent() {
            return null;
        }
    };
}

From source file:com.adaptris.core.jms.activemq.ActiveMqJmsTransactedWorkflowTest.java

public void testHandleChannelUnavailableWithException_Bug2343() throws Exception {
    int msgCount = 10;
    EmbeddedActiveMq activeMqBroker = new EmbeddedActiveMq();
    String destination = createSafeUniqueId(new Object());
    final Channel channel = createStartableChannel(activeMqBroker, true,
            "testHandleChannelUnavailableWithException_Bug2343", destination);
    JmsTransactedWorkflow workflow = (JmsTransactedWorkflow) channel.getWorkflowList().get(0);
    workflow.setChannelUnavailableWaitInterval(new TimeInterval(1L, TimeUnit.SECONDS));
    workflow.getServiceCollection().addService(new ThrowExceptionService(new ConfiguredException("Fail")));
    try {//from w  w w . jav  a  2 s  .  c  o  m
        activeMqBroker.start();
        channel.requestStart();
        channel.toggleAvailability(false);
        Timer t = new Timer();
        t.schedule(new TimerTask() {
            @Override
            public void run() {
                channel.toggleAvailability(true);
            }

        }, 666);
        StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(),
                new PtpProducer(new ConfiguredProduceDestination(destination)));
        send(sender, msgCount);
    } finally {
        channel.requestClose();
    }
    assertEquals(msgCount, activeMqBroker.messagesOnQueue(destination));
    activeMqBroker.destroy();
}

From source file:com.altcanvas.twitspeak.TwitterTask.java

public TwitterTask.Payload doInBackground(TwitterTask.Payload... params) {
    TwitterTask.Payload payload = params[0];
    Object[] data = (Object[]) payload.data;

    switch (payload.taskType) {
    case FRIENDS_TIMELINE_DLOAD:
    case FRIENDS_TIMELINE_DLOAD2:
        try {//w w  w . j av  a 2 s  .  c  o m
            Database db = (Database) data[2];
            Twitter twitter = (Twitter) data[1];

            JSONArray timeline = twitter.getFriendsTimeline();

            if (timeline.length() > 0) {
                // We have new twits, delete all old ones
                db.deleteAllTwits(null);
            }

            for (int i = 0; i < timeline.length(); i++) {
                JSONObject twit = timeline.getJSONObject(i);

                Twit t = new Twit();
                t.text = twit.getString("text");
                t.timestamp = Twit.sanitizeTimestamp(twit.getString("created_at"));
                JSONObject user = twit.optJSONObject("user");
                if (user != null) {
                    t.username = user.getString("name");
                    t.screenname = user.getString("screen_name");
                }
                db.insertTwit(t);
            }

            payload.result = new Object();

        } catch (AsocialException ae) {
            payload.exception = ae;
            payload.result = null;
        } catch (JSONException je) {
            payload.exception = je;
            payload.result = null;
        }
        break;
    case UPDATE:
        try {
            Twitter twitter = (Twitter) data[1];
            String update = (String) data[2];
            payload.result = twitter.update(update);
        } catch (AsocialException ae) {
            payload.exception = ae;
            payload.result = null;
        }
        break;
    }
    return payload;
}

From source file:com.tinyhydra.botd.sql.SQLInterface.java

private Object QueryMethodTemplate() {
    String table = "";
    String field = "";
    String value = "";

    Object returnObject = null;//from  w  w w  .ja  va  2  s  .c  om

    PreparedStatement getObjectStmt = null;
    String getObjectQuery = qSELECT + qALL + qFROM + table + qWHERE + field + qEQUALS_VALUE;

    ResultSet rs = null;
    try {
        if (con == null || con.isClosed())
            con = new SQLConnector().getConnection();

        getObjectStmt = con.prepareStatement(getObjectQuery);
        getObjectStmt.setString(1, value);

        rs = getObjectStmt.executeQuery();
        while (rs.next()) {
            returnObject = new Object();
        }

    } catch (SQLException sqe) {
        System.out.println(sqe);
    } finally {
        closeStatement(getObjectStmt);
    }
    if (rs == null)
        return null;

    return returnObject;
}

From source file:com.rapleaf.hank.ZkTestCase.java

@Override
protected void setUp() throws Exception {
    super.setUp();
    Logger.getLogger("org.apache.zookeeper").setLevel(Level.WARN);

    setupZkServer();/*from w  w  w  . j  av  a 2 s .c  o  m*/

    final Object lock = new Object();
    final AtomicBoolean connected = new AtomicBoolean(false);

    zk = new ZooKeeperPlus("127.0.0.1:" + zkClientPort, 1000000, new Watcher() {
        @Override
        public void process(WatchedEvent event) {
            switch (event.getType()) {
            case None:
                if (event.getState() == KeeperState.SyncConnected) {
                    connected.set(true);
                    synchronized (lock) {
                        lock.notifyAll();
                    }
                }
            }
            LOG.debug(event.toString());
        }
    });

    synchronized (lock) {
        lock.wait(2000);
    }
    if (!connected.get()) {
        fail("timed out waiting for the zk client connection to come online!");
    }
    LOG.debug("session timeout: " + zk.getSessionTimeout());

    zk.deleteNodeRecursively(zkRoot);
    createNodeRecursively(zkRoot);
}

From source file:com.sun.socialsite.web.filters.ThreadContextFilter.java

/**
 * Release SocialSite persistence session at end of request processing.
 *//*from   ww  w  . j  a  v a  2  s .  c  o  m*/
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
        throws IOException, ServletException {

    final HttpServletRequest request = (HttpServletRequest) req;
    final HttpServletResponse response = (HttpServletResponse) res;

    log.debug("Entered ThreadContextFilter");

    SocialSite socialsite = Factory.getSocialSite();

    log.debug(String.format("url=%s decoder=%s st=%s", request.getRequestURL(), decoder,
            request.getParameter("st")));
    if ((decoder != null) && (request.getParameter("st") != null)) {
        Map<String, String> m = Collections.singletonMap(SecurityTokenDecoder.SECURITY_TOKEN_NAME,
                request.getParameter("st"));
        try {
            final SocialSiteToken token = (SocialSiteToken) (decoder.createToken(m));
            log.debug(String.format("url=%s token=%s", request.getRequestURL(), token));
            if ((token != null) && (!socialsite.getURLStrategy().equals(token.getURLStrategy()))) {
                Object overrider = new Object() {
                    public URLStrategy getURLStrategy() {
                        log.debug(String.format("url=%s token=%s urlstrategy=%s", request.getRequestURL(),
                                token, token.getURLStrategy()));
                        return token.getURLStrategy();
                    }
                };
                SocialSite ss = (SocialSite) (ProxyUtil.getOverrideProxy(socialsite, overrider));
                log.debug(String.format("url=%s ss=%s", request.getRequestURL(), ss));
                Factory.setThreadLocalSocialSite(
                        (SocialSite) (ProxyUtil.getOverrideProxy(socialsite, overrider)));
                log.debug(String.format("url=%s Factory.getSocialSite=%s", request.getRequestURL(),
                        Factory.getSocialSite()));
            }
        } catch (SecurityTokenException e) {
            log.error("Failed to get security token", e);
        }
    }

    try {
        chain.doFilter(request, response);
    } finally {
        log.debug("Releasing SocialSite Session");
        if (Factory.isBootstrapped()) {
            Factory.setThreadLocalSocialSite(null);
            Factory.getSocialSite().release();
        }
    }

    log.debug("Exiting ThreadContextFilter");
}

From source file:com.hp.autonomy.hod.client.config.ResponseParserTest.java

@Test
public void testParseResponseToClassWithoutARefreshedToken() throws IOException {
    final ResponseAndBody responseAndBody = createTestResponse();
    final Object expectedReturnValue = new Object();

    final JavaType objectType = typeFactory.uncheckedSimpleType(Object.class);
    when(objectMapper.constructType(eq(Object.class))).thenReturn(objectType);

    when(objectMapper.readValue(eq(responseAndBody.body), eq(objectType))).thenReturn(expectedReturnValue);

    final TokenProxy<EntityType.Application, TokenType.Simple> tokenProxy = new TokenProxy<>(
            EntityType.Application.INSTANCE, TokenType.Simple.INSTANCE);

    final Object returnValue = responseParser.parseResponse(tokenProxy, Object.class, responseAndBody.response);

    verify(tokenRepository, never()).update(isA(TokenProxy.class), isA(AuthenticationToken.class));
    assertThat(returnValue, is(expectedReturnValue));
}