Example usage for java.lang Integer Integer

List of usage examples for java.lang Integer Integer

Introduction

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

Prototype

@Deprecated(since = "9")
public Integer(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.

Usage

From source file:org.owasp.dependencytrack.model.ApplicationTest.java

@Test
@Transactional//w  w  w .  j a  v a 2 s .  c o m
public void testObject() {
    Application application = new Application();
    application.setId(1);
    application.setName("Test Application");

    assertNull(application.getVersions());
    assertEquals(new Integer(1), application.getId());
    assertEquals("Test Application", application.getName());

    Application cloned = (Application) application.clone();
    assertEquals(null, cloned.getId());
    assertEquals("Test Application", cloned.getName());
}

From source file:org.owasp.dependencytrack.model.UserTest.java

@Test
@Transactional//from   w w  w  .  ja  v  a  2 s. c  o  m
public void testObject() {
    Roles role = new Roles("admin");

    User user = new User();
    user.setId(1);
    user.setUsername("testuser");
    user.setPassword("password");
    user.setIsLdap(true);
    user.setRoles(role);

    assertEquals(new Integer(1), user.getId());
    assertEquals("testuser", user.getUsername());
    assertEquals("password", user.getPassword());
    assertEquals(true, user.isLdap());
    assertEquals("admin", role.getRole());
}

From source file:jp.co.acroquest.endosnipe.report.converter.util.calc.IntegerCalculator.java

public Object div(Object obj1, Object obj2) {
    Integer intData1 = (Integer) obj1;
    Integer intData2 = (Integer) obj2;

    return (Object) (new Integer((int) (intData1.intValue() / intData2.intValue())));
}

From source file:edu.vt.middleware.crypt.io.Base64FilterInputStreamTest.java

/**
 * @return  Test data./*from   w w  w. j  a  v a  2s .  c  o m*/
 *
 * @throws  Exception  On test data generation failure.
 */
@DataProvider(name = "testdata")
public Object[][] createTestDataBase64() throws Exception {
    return new Object[][] { { new Integer(0) }, { new Integer(Base64FilterInputStream.LINE_LENGTH_64) },
            { new Integer(Base64FilterInputStream.LINE_LENGTH_76) }, };
}

From source file:com.ewcms.component.counter.dao.CounterDAO.java

@Override
public void updCount(final int articleId) {
    boolean exist = articleCountExist(articleId);
    if (exist) {/* w  w  w  .  ja  va  2  s . c o m*/
        String sql = "Update component_counter Set counter = counter + 1 Where article_id = ?";
        jdbcTemplate.update(sql, articleId);
    } else {
        String sql = "Insert Into component_counter (article_id,counter) values (?,?)";
        jdbcTemplate.update(sql, articleId, new Integer(1));
    }
}

From source file:server.ServerUI.java

void displayUsersStatusChart(int availableNum, int busyNum, int awayNum, int offlineNum) {
    DefaultPieDataset pieDataset = new DefaultPieDataset();
    pieDataset.setValue("Avaliable", new Integer(availableNum));
    pieDataset.setValue("Away", new Integer(awayNum));
    pieDataset.setValue("Busy", new Integer(busyNum));
    pieDataset.setValue("Offline", new Integer(offlineNum));
    JFreeChart chart = ChartFactory.createPieChart("Users Statistics", pieDataset, true, true, true);
    PiePlot p;/*from  w  w  w . j a  v  a2s  .  com*/
    p = (PiePlot) chart.getPlot();
    ChartFrame chartPanelObj = new ChartFrame("USERS", chart);
    chartPanelObj.setVisible(true);
    chartPanelObj.setSize(450, 500);
}

From source file:ca.sqlpower.architect.UpdateDeleteRuleConverterTest.java

public void testFromInt() throws Exception {
    Object r = converter.convert(UpdateDeleteRule.class, new Integer(3));
    assertSame(UpdateDeleteRule.ruleForCode(3), r);
}

From source file:edu.uci.ics.jung.algorithms.flows.TestEdmondsKarpMaxFlow.java

public void testSanityChecks() {
    DirectedGraph<Number, Number> g = new DirectedSparseMultigraph<Number, Number>();
    Number source = new Integer(1);
    Number sink = new Integer(2);
    g.addVertex(source);// w w w. j  a  v a2 s . c  o m
    g.addVertex(sink);

    Number v = new Integer(3);

    DirectedGraph<Number, Number> h = new DirectedSparseMultigraph<Number, Number>();
    Number w = new Integer(4);
    g.addVertex(w);

    try {
        new EdmondsKarpMaxFlow<Number, Number>(g, source, source, null, null, null);
        fail("source and sink vertices not distinct");
    } catch (IllegalArgumentException iae) {
    }

    try {
        new EdmondsKarpMaxFlow<Number, Number>(h, source, w, null, null, null);
        fail("source and sink vertices not both part of specified graph");
    } catch (IllegalArgumentException iae) {
    }

    try {
        new EdmondsKarpMaxFlow<Number, Number>(g, source, v, null, null, null);
        fail("source and sink vertices not both part of specified graph");
    } catch (IllegalArgumentException iae) {
    }
}

From source file:company.gonapps.loghut.controller.LoginController.java

@RequestMapping(value = "/login.do", method = RequestMethod.POST)
public String login(HttpServletRequest request, String id, String password, String request_path)
        throws Exception {
    if (id.equals(getSettingDao().getSetting("admin.id"))
            && password.equals(getSettingDao().getSetting("admin.password"))) {

        request.getSession().setMaxInactiveInterval(new Integer(getSettingDao().getSetting("session.timeout")));
        if (request_path != null)
            return "redirect:" + request.getScheme() + "://" + request.getServerName()
                    + getSettingDao().getSetting("admin.url") + request_path;
        return "redirect:" + request.getScheme() + "://" + request.getServerName()
                + getSettingDao().getSetting("admin.url");
    }/*from   w ww.j  a  v  a  2s . c  o m*/
    return "redirect:" + request.getScheme() + "://" + request.getServerName()
            + getSettingDao().getSetting("admin.url") + "/login_form.do";
}

From source file:FramewithComponents.java

public FramewithComponents() {
    super("JLayeredPane Demo");
    setSize(256, 256);//  w  ww. j a va  2 s.com

    JPanel content = new JPanel();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
    content.setOpaque(false);

    JLabel label1 = new JLabel("Username:");
    label1.setForeground(Color.white);
    content.add(label1);

    JTextField field = new JTextField(15);
    content.add(field);

    JLabel label2 = new JLabel("Password:");
    label2.setForeground(Color.white);
    content.add(label2);

    JPasswordField fieldPass = new JPasswordField(15);
    content.add(fieldPass);

    getContentPane().setLayout(new FlowLayout());
    getContentPane().add(content);
    ((JPanel) getContentPane()).setOpaque(false);

    ImageIcon earth = new ImageIcon("largeJava2sLogo.png");
    JLabel backlabel = new JLabel(earth);
    getLayeredPane().add(backlabel, new Integer(Integer.MIN_VALUE));
    backlabel.setBounds(0, 0, earth.getIconWidth(), earth.getIconHeight());

    WindowListener l = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(l);

    setVisible(true);
}