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.openspaces.eviction.test.LRUSingleOrderTest.java

@Test
public void readKeepsAnObjectTest() throws Exception {
    logger.info("write an object");
    gigaSpace.write(new SilverMedal(0));

    logger.info("fill the space with more than cache size object and red the original in the middle");
    for (int i = 1; i <= cacheSize + 10; i++) {
        if (i == (cacheSize / 2))
            gigaSpace.read(new SilverMedal(0));
        else/*from ww w  .j a  va  2  s. c om*/
            gigaSpace.write(new SilverMedal(i));
    }
    Assert.assertEquals("amount of objects in space is larger than cache size", gigaSpace.count(new Object()),
            cacheSize);

    logger.info("assert the original object is still in cache");
    Assert.assertNotNull("silver medal 0 is not in space", gigaSpace.read(new SilverMedal(0)));
    logger.info("Test Passed");
}

From source file:com.spectralogic.ds3client.helpers.channels.WindowedSeekableByteChannel_Test.java

@Test(timeout = 1000)
public void readChannelSections() throws IOException {
    try (final SeekableByteChannel channel = stringToChannel("aabbbcccc")) {
        final Object lock = new Object();
        final SeekableByteChannel channelOfAs = new WindowedSeekableByteChannel(channel, lock, 0L, 2L);
        final SeekableByteChannel channelOfBs = new WindowedSeekableByteChannel(channel, lock, 2L, 3L);
        final SeekableByteChannel channelOfCs = new WindowedSeekableByteChannel(channel, lock, 5L, 4L);

        assertThat(channelOfAs.size(), is(2L));
        assertThat(channelOfBs.size(), is(3L));
        assertThat(channelOfCs.size(), is(4L));

        assertThat(channelToString(channelOfAs), is("aa"));
        assertThat(channelToString(channelOfBs), is("bbb"));
        assertThat(channelToString(channelOfCs), is("cccc"));
    }//from   w  w  w .  j  a  v a  2  s.c  o  m
}

From source file:com.ebay.pulsar.analytics.metricstore.limitspec.LimitSpecTest.java

private void testDefaultLimitSpec() {
    String d1 = "d1";
    OrderByColumnSpec c1 = new OrderByColumnSpec(d1, SortDirection.descending);
    DefaultLimitSpec dls = new DefaultLimitSpec(10, Lists.newArrayList(c1));

    assertEquals(dls.getColumns(), Lists.newArrayList(c1));
    assertEquals(dls.getLimit(), 10);/* w  ww  . ja v a  2  s.c o m*/
    assertEquals(dls.getType(), "default");
    assertTrue(dls.equals(dls));
    DefaultLimitSpec dls2 = new DefaultLimitSpec(10, Lists.newArrayList(c1));
    assertArrayEquals(dls.cacheKey(), dls2.cacheKey());
    dls2 = new DefaultLimitSpec(3, null);
    assertTrue(!dls.equals(dls2));
    assertTrue(!dls2.equals(dls));
    dls2 = new DefaultLimitSpec(3, Lists.newArrayList(c1));
    assertTrue(!dls.equals(dls2));
    assertTrue(!dls2.equals(dls));
    dls2 = new DefaultLimitSpec(10, null);
    assertTrue(!dls.equals(dls2));
    assertTrue(!dls2.equals(dls));
    dls2 = new DefaultLimitSpec(10, Lists.newArrayList(c1));
    assertTrue(dls.equals(dls2));
    assertTrue(dls2.equals(dls));
    assertTrue(dls2.equals(dls2));
    assertTrue(dls.hashCode() == dls2.hashCode());

    assertTrue(!dls.equals(new Object()));
}

From source file:com.parse.ParseDecoderTest.java

@Test
public void testNonJSONObject() {
    Object obj = new Object();
    assertSame(obj, ParseDecoder.get().decode(obj));
}

From source file:net.itransformers.topologyviewer.menu.handlers.graphTools.searchMenuHandlers.SearchByIpMenuHandler.java

@Override
public void actionPerformed(ActionEvent e) {

    //                Map<String, Map<String, GraphMLMetadata<G>>> test1 = graphmlLoader();

    //        String key = JOptionPane.showInputDialog(frame, "Choose IP", JOptionPane.QUESTION_MESSAGE);
    final String ip = JOptionPane.showInputDialog(frame, "Enter IP", "Value", JOptionPane.QUESTION_MESSAGE);

    GraphViewerPanel viewerPanel = (GraphViewerPanel) frame.getTabbedPane().getSelectedComponent();
    Set<String> foundVertexes;
    foundVertexes = viewerPanel.FindNodeByKey("RoutePrefixes", new Object() {
        @Override//from w ww  .  j a va  2 s.  c  o m
        public boolean equals(Object obj) {
            String s = (String) obj;
            String[] ipRanges = s.split(",");
            for (String ipRangeNotTrimmed : ipRanges) {
                String ipRange = ipRangeNotTrimmed.trim();
                if (ipRange.equals("") || ipRange.equals("0.0.0.0/0"))
                    continue;
                try {
                    SubnetUtils subnet = new SubnetUtils(ipRange);
                    if (subnet.getInfo().isInRange(ip)) {
                        return true;
                    }
                } catch (IllegalArgumentException iae) {
                    logger.error("Can not parse ip or ip range:" + ipRange + ", ip:" + ip);
                    System.out.println("Can not parse ip or ip range:" + ipRange + ", ip:" + ip);
                    iae.printStackTrace();
                    continue;
                }
            }
            return false;
        }
    });
    if (!foundVertexes.isEmpty()) {
        Iterator it = foundVertexes.iterator();
        if (foundVertexes.size() == 1) {
            Object element = it.next();
            System.out.println("Redrawing around " + element.toString());
            viewerPanel.SetPickedState(element.toString());
            viewerPanel.Animator(element.toString());
        } else {
            JOptionPane.showMessageDialog(frame, "Multiple Nodes with ip " + ip + " found :\n" + foundVertexes,
                    "Error", JOptionPane.ERROR_MESSAGE);
        }
    } else {
        JOptionPane.showMessageDialog(frame, "Can not find node with ip " + ip, "Error",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:org.jasig.cas.client.util.CommonUtilsTests.java

public void testAssertNotNull() {
    final String CONST_MESSAGE = "test";
    CommonUtils.assertNotNull(new Object(), CONST_MESSAGE);
    try {/*w  ww  .ja v a  2 s .  c om*/
        CommonUtils.assertNotNull(null, CONST_MESSAGE);
    } catch (IllegalArgumentException e) {
        assertEquals(CONST_MESSAGE, e.getMessage());
    }
}

From source file:ThreadManager.java

/**
 * Create a new ThreadManager./* w w  w . j av  a 2s. com*/
 *
 * @param numIndices      the number of values the index should take on (from 0 to numIndices-1)
 * @param task            the task to perform
 */

public ThreadManager(int numIndices, Task task) {
    this.numIndices = numIndices;
    this.task = task;
    nextIndex = new AtomicInteger(numIndices);
    controller = new Object();
    controllerWaiting = false;
    waitingThreads = new HashSet<Thread>();
}

From source file:com.gigaspaces.blueprint.frauddetection.vendor.VendorValidation.java

@PostPrimary
public void startNotifyValidation() {

    log.error(" Start Gigaspaces proxy to user cluster ");
    UrlSpaceConfigurer urlSpaceConfigurer = new UrlSpaceConfigurer("jini://*/*/user");
    gigaSpace = new GigaSpaceConfigurer(urlSpaceConfigurer.space()).gigaSpace();

    log.error(" Start notify container ");
    notifyEventListenerContainer = new SimpleNotifyContainerConfigurer(gigaSpace)
            .template(new VendorPaymentMsg()).eventListenerAnnotation(new Object() {
                @SpaceDataEvent//from w ww  .j a  v a  2  s.c  o  m
                public void eventHappened(VendorPaymentMsg event) {

                    log.error("Event is started " + event.getPaymentId());
                    IdQuery<PaymentAuthorization> idQuery = new IdQuery<PaymentAuthorization>(
                            PaymentAuthorization.class, event.getPaymentId());
                    gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", true));

                }
            }).notifyContainer();

    notifyEventListenerContainer.start();

}

From source file:de.cosmocode.json.JSONArrayListTest.java

@Override
public SampleElements<Object> samples() {
    return new SampleElements<Object>(Boolean.TRUE, Integer.MAX_VALUE, 123, new Object(), "test");
}

From source file:com.honnix.cheater.service.CheaterImpl.java

public CheaterImpl() {
    super();//from ww w .  j  a v  a 2 s  .c o  m

    currentStatus = CheaterConstant.INITIALIZING;

    try {
        client = (Client) Class.forName(CheaterConstant.CLIENT).newInstance();
    } catch (Exception e) {
        LOG.fatal("Could not instantiate client. Assume testing run.", e);

        client = new FakeClient();
    }

    try {
        spc = (Spc) Class.forName(CheaterConstant.SPC).newInstance();
    } catch (Exception e) {
        LOG.fatal("Could not instantiate spc. Assume bundle run.", e);

        spc = new FakeSpc();
    }

    thisThread = new Thread(this);
    thisThread.setName(THREAD_NAME);
    isStarted = false;

    lock = new Object();

    currentStatus = CheaterConstant.INITIALIZED;
}