Package java.util

Examples of java.util.Random.nextInt()


                if (r.nextInt(100) < 10) {
                    conn.createStatement().execute("ALTER TABLE TEST_META ALTER COLUMN ID INT DEFAULT 10");
                }
                if (r.nextBoolean()) {
                    if (r.nextBoolean()) {
                        prep.setString(1, new String(new char[r.nextInt(30) * 10]));
                        prep.execute();
                    } else {
                        prep2.setString(1, new String(new char[r.nextInt(30) * 10]));
                        prep2.execute();
                    }
View Full Code Here


                if (r.nextBoolean()) {
                    if (r.nextBoolean()) {
                        prep.setString(1, new String(new char[r.nextInt(30) * 10]));
                        prep.execute();
                    } else {
                        prep2.setString(1, new String(new char[r.nextInt(30) * 10]));
                        prep2.execute();
                    }
                } else {
                    if (r.nextBoolean()) {
                        conn.createStatement().execute("UPDATE TEST SET NAME = NULL");
View Full Code Here

            stat.execute("create table t" + i + "(data varchar)");
        }
        Random random = new Random(1);
        int len = getSize(50, 500);
        for (int i = 0; i < len; i++) {
            String table = "t" + random.nextInt(tableCount);
            String sql;
            if (random.nextBoolean()) {
                sql = "insert into " + table + " values(space(100000))";
            } else {
                sql = "delete from " + table;
View Full Code Here

        Random random = new Random();
        random.setSeed(1);
        for (int i = 0; i < len; i++) {
            char c;
            do {
                c = (char) random.nextInt();
            } while (c >= 0xd800 && c <= 0xdfff);
            buff[i] = c;
        }
        String big = new String(buff);
        prep.setInt(1, 1);
View Full Code Here

                    fail("No reply from process");
                } else if (!s.startsWith("#")) {
                    // System.out.println(s);
                    fail("Expected: #..., got: " + s);
                } else if (s.startsWith("#Running")) {
                    int sleep = 10 + random.nextInt(100);
                    Thread.sleep(sleep);
                    printTime("killing: " + i);
                    p.destroy();
                    p.waitFor();
                    break;
View Full Code Here

                    openConnection();
                }
                if (tables.size() < 1) {
                    createTable(random);
                }
                int p = random.nextInt(100);
                if ((p -= 2) <= 0) {
                    // 2%: open new connection
                    if (connections.size() < 5) {
                        openConnection();
                    }
View Full Code Here

                        openConnection();
                    }
                } else if ((p -= 1) <= 0) {
                    // 1%: close connection
                    if (connections.size() > 1) {
                        Connection conn = connections.remove(random.nextInt(connections.size()));
                        if (random.nextBoolean()) {
                            conn.close();
                        }
                    }
                } else if ((p -= 10) <= 0) {
View Full Code Here

                    // 10% create table
                    createTable(random);
                } else if ((p -= 20) <= 0) {
                    // 20% large insert, delete, or update
                    if (tables.size() > 0) {
                        Connection conn = connections.get(random.nextInt(connections.size()));
                        Statement stat = conn.createStatement();
                        String table = tables.get(random.nextInt(tables.size()));
                        if (random.nextBoolean()) {
                            // 10% insert
                            stat.execute("INSERT INTO " + table + "(NAME) SELECT 'Hello ' || X FROM SYSTEM_RANGE(0, 20)");
View Full Code Here

                } else if ((p -= 20) <= 0) {
                    // 20% large insert, delete, or update
                    if (tables.size() > 0) {
                        Connection conn = connections.get(random.nextInt(connections.size()));
                        Statement stat = conn.createStatement();
                        String table = tables.get(random.nextInt(tables.size()));
                        if (random.nextBoolean()) {
                            // 10% insert
                            stat.execute("INSERT INTO " + table + "(NAME) SELECT 'Hello ' || X FROM SYSTEM_RANGE(0, 20)");
                        } else if (random.nextBoolean()) {
                            // 5% update
View Full Code Here

                        }
                    }
                } else if ((p -= 5) < 0) {
                    // 5% truncate or drop table
                    if (tables.size() > 0) {
                        Connection conn = connections.get(random.nextInt(connections.size()));
                        Statement stat = conn.createStatement();
                        String table = tables.get(random.nextInt(tables.size()));
                        if (random.nextBoolean()) {
                            stat.execute("TRUNCATE TABLE " + table);
                        } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.