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:org.springmodules.validation.validator.ConditionalValidatorTests.java

public void testValidate_WhenConditionCheckFail() throws Exception {
    Object object = new Object();
    BindException errors = new BindException(object, "name");

    conditionControl.expectAndReturn(condition.check(object), false);

    conditionControl.replay();// www. j a v a  2 s.  c  o m
    innerValidatorControl.replay();

    validator.validate(object, errors);

    conditionControl.verify();
    innerValidatorControl.verify();
}

From source file:spring.travel.site.request.RequestInfoInterceptorTest.java

@Test
public void shouldSetRequestInfoAttributeWithIpAddressIfNoCookiePresent() throws Exception {
    Enumeration<String> cookieHeaders = Collections.emptyEnumeration();
    when(request.getHeaders("Cookie")).thenReturn(cookieHeaders);

    assertTrue(interceptor.preHandle(request, response, new Object()));

    verify(request, times(1)).setAttribute(eq(attributeName), requestCaptor.capture());
    Request requestInfo = requestCaptor.getValue();

    assertEquals(Optional.empty(), requestInfo.getCookieValue());
    assertEquals(ipAddress, requestInfo.getRemoteAddress());
    assertEquals(Optional.empty(), requestInfo.getUser());
}

From source file:com.armorize.hackalert.extractor.msword.MSBaseParser.java

/**
 * Main for testing. Pass a ms document as argument
 *///w w w .  java 2  s .c om
public static void main(String mime, MSBaseParser parser, String args[]) {
    try {
        ExtractorUniversal extractor = new ExtractorUniversal("TEST");
        File orderFile = new File("order.xml");
        SettingsHandler settingsHandler = new XMLSettingsHandler(orderFile);
        settingsHandler.initialize();
        // settingsHandler.getOrder().setAttribute(
        // new Attribute(CrawlOrder.ATTR_SETTINGS_DIRECTORY, "tmp/"));
        CrawlerSettings globalSettings = settingsHandler.getSettingsObject(null);
        MapType extractorsSettings = (MapType) settingsHandler.getOrder()
                .getAttribute(CrawlOrder.ATTR_EXTRACT_PROCESSORS);

        extractorsSettings.addElement(globalSettings, extractor);
        extractor.setAttribute(new Attribute(Processor.ATTR_ENABLED, Boolean.TRUE));
        //======================
        byte[] raw = IOUtils.toByteArray(new FileInputStream("C:\\temp\\userman.doc"));
        String text = parser.getParse(raw);
        ByteArrayInputStream in = new ByteArrayInputStream(text.getBytes("utf-8"));

        HttpRecorder recorder = HttpRecorder.wrapInputStreamWithHttpRecord(new File("tmp"),
                MSBaseParser.class.getName(), in, "utf-8");

        CrawlURI curi = new CrawlURI(UURIFactory.getInstance("http://www.armorize.com/"));
        curi.setContentSize(recorder.getRecordedInput().getSize());
        curi.setContentType("application/msword");
        curi.setFetchStatus(200);
        curi.setHttpRecorder(recorder);

        curi.putObject(CoreAttributeConstants.A_HTTP_TRANSACTION, new Object());

        extractor.process(curi);
        System.out.println(curi.getOutLinks());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.unidle.web.BuildTimestampInterceptorTest.java

@Test
public void testPostHandleWithHandlerMethodWithWrongBean() throws Exception {
    subject.postHandle(null, null, new HandlerMethod(new Object(), "toString"), modelAndView);

    assertThat(modelAndView.getModel()).isEmpty();
}

From source file:net.spy.memcached.couch.AsyncConnectionManager.java

public AsyncConnectionManager(HttpHost target, int maxConnections, NHttpClientHandler handler,
        HttpParams params) throws IOReactorException {
    super();/*from w w w. ja va  2  s.  co m*/
    this.target = target;
    this.maxConnections = maxConnections;
    this.handler = handler;
    this.params = params;
    this.lock = new Object();
    this.allConns = new HashSet<NHttpClientConnection>();
    this.availableConns = new LinkedList<NHttpClientConnection>();
    this.pendingRequests = new LinkedList<AsyncConnectionRequest>();
    this.ioreactor = new DefaultConnectingIOReactor(2, params);
}

From source file:com.stehno.sjdbcx.reflection.operation.NamedQueryOperationTest.java

@Test
public void executeResultSetExtractor() throws Exception {
    final ResultSetExtractor extractor = mock(ResultSetExtractor.class);
    when(operationContext.extract(eq(ResultSetExtractor.class), any(Method.class))).thenReturn(extractor);

    final Object returned = new Object();
    when(namedParameterJdbcTemplate.query(eq(SQL), any(SqlParameterSource.class), eq(extractor)))
            .thenReturn(returned);/* www.j a v a2  s . c o m*/

    assertOperation(returned);
}

From source file:org.jasig.portlet.calendar.mvc.controller.AjaxCalendarControllerTest.java

@Before
public void setUp() {
    initMocks(this);
    testee = new AjaxCalendarController();
    request = new MockResourceRequest();
    response = new MockResourceResponse();
    nonEmptyMap = new HashMap<String, Object>();
    nonEmptyMap.put("aaa", new Object());
    request.setResourceID("01032011-7");
    ReflectionTestUtils.setField(testee, "helper", mockHelper);

    emptyEvents = new HashSet<CalendarDisplayEvent>();
    events = new HashSet<CalendarDisplayEvent>();

    when(appContext.getMessage(eq("date.formatter.display"), any(Object[].class), anyString(),
            any(Locale.class))).thenReturn("EEE MMM d");
    testee.setApplicationContext(appContext);
}

From source file:net.sourceforge.vulcan.web.VulcanContextListenerTest.java

public void testDestroyContextCallsShutDown() throws Exception {
    servletContext.setAttribute(Keys.STATE_MANAGER, mgr);
    servletContext.setAttribute(Keys.EVENT_POOL, new Object());

    l.stateManager = mgr;/*  w  w  w . j  a v  a2s  .  c o  m*/

    mgr.shutdown();

    replay();

    l.contextDestroyed(event);

    verify();
    assertNull("Did not remove state manager instance", servletContext.getAttribute(Keys.STATE_MANAGER));
    assertNull("Did not remove eventPool instance", servletContext.getAttribute(Keys.EVENT_POOL));
}

From source file:org.openspaces.eviction.test.FIFOSingleOrderTest.java

protected void assertCacheSizeEqualsCountInSpace() {
    Assert.assertEquals("amount of objects in space is larger than cache size", gigaSpace.count(new Object()),
            cacheSize);/*from  ww w  .  j ava 2s .c  o m*/
}

From source file:com.comcast.cats.service.util.HttpClientUtil.java

public static synchronized Object postForObject(String uri, Map<String, String> paramMap) {
    Object responseObject = new Object();

    HttpMethod httpMethod = new PostMethod(uri);

    if ((null != paramMap) && (!paramMap.isEmpty())) {
        httpMethod.setQueryString(getNameValuePair(paramMap));
    }/*from  ww  w .  j a  v  a  2s. c om*/

    Yaml yaml = new Yaml();

    HttpClient client = new HttpClient();
    InputStream responseStream = null;
    Reader inputStreamReader = null;

    try {
        int responseCode = client.executeMethod(httpMethod);

        if (HttpStatus.SC_OK != responseCode) {
            logger.error("[ REQUEST  ] " + httpMethod.getURI().toString());
            logger.error("[ METHOD   ] " + httpMethod.getName());
            logger.error("[ STATUS   ] " + responseCode);
        } else {
            logger.trace("[ REQUEST  ] " + httpMethod.getURI().toString());
            logger.trace("[ METHOD   ] " + httpMethod.getName());
            logger.trace("[ STATUS   ] " + responseCode);
        }

        responseStream = httpMethod.getResponseBodyAsStream();
        inputStreamReader = new InputStreamReader(responseStream, VideoRecorderServiceConstants.UTF);
        responseObject = yaml.load(inputStreamReader);
    } catch (IOException ioException) {
        ioException.printStackTrace();
    } finally {
        cleanUp(inputStreamReader, responseStream, httpMethod);
    }

    return responseObject;
}