Package org.netbeans.modules.exceptions.entity

Examples of org.netbeans.modules.exceptions.entity.Slowness


        return createSubmit(Utils.getNextId(Slowness.class));
    }

    @Override
    protected Submit createSubmit(int id) {
        Slowness result = new Slowness(id);
        Method m = new Method(Utils.getNextId(Method.class));
        m.setName("test" + m.getId());
        em.persist(m);
        result.setSuspiciousMethod(m);
        return result;
    }
View Full Code Here


        } else {
            assertFalse(excData.getReportId() != 0);
        }
        if (comp != null){
            EntityManager em = perUtils.createEntityManager();
            Slowness sbm = em.find(Slowness.class, reportID);
            assertEquals(method, sbm.getSuspiciousMethod().getName());
            assertEquals(comp, sbm.getReportId().getComponent());
            assertEquals(subcomp, sbm.getReportId().getSubcomponent());
            em.close();
        }
        reportID++;
    }
View Full Code Here

        DbInsertion insertion = new DbInsertion(rec, null, null, new TestLogFileTask(em, log), 100L, null, "method");
        insertion.start(new ExceptionsData());
        //waitLogsParsed();
        List<Slowness> all =
                PersistenceUtils.getAll(em, Slowness.class);
        Slowness rootSlowness = all.get(all.size() - 1);
        rootId = rootSlowness.getId();
        List<Nbuser> users = PersistenceUtils.getAll(em, Nbuser.class);
        Nbuser user = null;
        for (Nbuser us : users) {
            if (userName.equals(us.getName())) {
                user = us;
            }
        }
        all = PersistenceUtils.getAll(em, Slowness.class);
        rootSlowness = all.get(all.size() - 1);
        assertNotNull(rootSlowness);
        assertEquals(1, rootSlowness.getReportId().getDuplicates(em));
        assertEquals(1, rootSlowness.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(1, rootSlowness.getReportId().getDuplicatesFromOneUser(em, user));

        session = 2;
        log = new Logfile(userId, session);

        // -- refresh persistence context ---//
        em.getTransaction().commit();
        em.close();
        em = perUtils.createEntityManager();
        em.getTransaction().begin();
        all = PersistenceUtils.getAll(em, Slowness.class);
        rootSlowness = all.get(all.size() - 1);

        rootSlowness = insert(em, new DbInsertion(rec, null, null, new TestLogFileTask(em, log), 100L, null, "method"));
        assertEquals(2, rootSlowness.getReportId().getDuplicates(em));
        assertEquals(1, rootSlowness.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(2, rootSlowness.getReportId().getDuplicatesFromOneUser(em, user));


        session = 3;
        log = new Logfile(userId, session);

        // -- refresh persistence context ---//
        em.getTransaction().commit();
        em.close();
        em = perUtils.createEntityManager();
        em.getTransaction().begin();
        all = PersistenceUtils.getAll(em, Slowness.class);
        rootSlowness = all.get(all.size() - 1);

        rootSlowness = insert(em, new DbInsertion(rec, null, null, new TestLogFileTask(em, log), 100L, null, "method"));
        assertEquals(3, rootSlowness.getReportId().getDuplicates(em));
        assertEquals(1, rootSlowness.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(3, rootSlowness.getReportId().getDuplicatesFromOneUser(em, user));
        userName = "exceptions";
        params.set(3, userName);
        params.set(6, "petrzajac");
        rec.setParameters(params.toArray());

        session = 4;
        log = new Logfile(userId, session);

        // -- refresh persistence context ---//
        em.getTransaction().commit();
        em.close();
        em = perUtils.createEntityManager();
        em.getTransaction().begin();
        all = PersistenceUtils.getAll(em, Slowness.class);
        rootSlowness = all.get(all.size() - 1);

        rootSlowness = insert(em, new DbInsertion(rec, null, null, new TestLogFileTask(em, log), 100L, null, "method"));
        users = PersistenceUtils.getAll(em, Nbuser.class);
        Iterator<Nbuser> userIt = users.iterator();
        Nbuser user2 = null;
        while (userIt.hasNext()) {
            user2 = userIt.next();
            if (user2.getName().equals(userName)) {
                break;
            }
        }
        assertEquals(4, rootSlowness.getReportId().getDuplicates(em));
        assertEquals(2, rootSlowness.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(3, rootSlowness.getReportId().getDuplicatesFromOneUser(em, user));
        assertEquals(1, rootSlowness.getReportId().getDuplicatesFromOneUser(em, user2));

        session = 5;
        log = new Logfile(userId, session);
        rootSlowness = insert(em, new DbInsertion(rec, null, null, new TestLogFileTask(em, log), 100L, null, "method"));

        // -- refresh persistence context ---//
        em.getTransaction().commit();
        em.close();
        em = perUtils.createEntityManager();
        em.getTransaction().begin();
        all = PersistenceUtils.getAll(em, Slowness.class);
        rootSlowness = all.get(all.size() - 1);

        assertEquals(5, rootSlowness.getReportId().getDuplicates(em));
        assertEquals(2, rootSlowness.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(3, rootSlowness.getReportId().getDuplicatesFromOneUser(em, user));
        assertEquals(2, rootSlowness.getReportId().getDuplicatesFromOneUser(em, user2));
        em.getTransaction().commit();
        em.close();
    }
View Full Code Here

        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();

        int session = 0;
        Slowness slowness = insert(em, session, null, null);
        slowness.getReportId().setIssueId(issuezillaId);
        em.merge(slowness);

        BugzillaReporter reporter = BugReporterFactory.getDefaultReporter();
        Issue issue = reporter.getIssue(issuezillaId);
        assertNotNull(issue);
View Full Code Here

        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();

        int session = 0;
        Slowness root = insert(em, session);
        root.getReportId().setIssueId(issuezillaId);
        em.merge(root);
        assertNull("ADD TO CC", handler.getResult());

        BugzillaReporter reporter = BugReporterFactory.getDefaultReporter();
        Issue issue = reporter.getIssue(issuezillaId);
View Full Code Here

        nbv.setVersion("6.0");
        pv.setNbversionId(nbv);
        log.setProductVersionId(pv);
        Nbuser user = new Nbuser(1);
        user.setName("HALLO");
        Slowness slown = new Slowness(100);
        slown.setActionTime(1000L);
        Method m = new Method(30);
        m.setName("unknown");
        Report report = new Report(100);
        slown.setSuspiciousMethod(m);
        slown.setReportId(report);
        slown.setLogfileId(log);
        report.setComponent("user.dir");
        report.setSubcomponent("some.jar");
        slown.setNbuserId(user);
        em.persist(nbv);
        em.persist(pv);
        em.persist(report);
        em.persist(user);
        em.persist(m);
View Full Code Here

    private Submit createNewSubmit(EntityManager em, int id) {
        Submit sbm;
        if (id%2 == 0){
             sbm = new Exceptions(id);
        }else{
            Slowness slown = new Slowness(id);
            Method m = new Method(id);
            m.setName("hallo" + id);
            em.persist(m);
            slown.setSuspiciousMethod(m);
            sbm = slown;
        }
        Report report = new Report(id);
        report.setComponent("test");
        report.setSubcomponent("testSub");
View Full Code Here

    private void createNewSubmit(EntityManager em, Report r, Method suspMethod, String action, Long actionTime) {
        createNewSubmit(em, r, suspMethod, action, actionTime, linux);
    }
   
    private void createNewSubmit(EntityManager em, Report r, Method suspMethod, String action, Long actionTime, Operatingsystem os) {
        Slowness sl = new Slowness(++slownessId);
        sl.setSuspiciousMethod(suspMethod);
        sl.setReportId(r);
        sl.setActionTime(actionTime);
        sl.setLatestAction(action);
        sl.setOperatingsystemId(os);
        em.persist(sl);
    }
View Full Code Here

        if (isSlowness) {
            Method m = new Method(i);
            m.setName("test" + i);
            em.persist(m);

            Slowness slowness = new Slowness(i);
            slowness.setActionTime(Long.valueOf(i));
            slowness.setSuspiciousMethod(m);
            sbm = slowness;
        } else {
            Stacktrace stack = new Stacktrace(i);
            stack.setMessage("Something is wrong");
            em.persist(stack);
View Full Code Here

        Query sbmQuery = getEntityManager(request).createNamedQuery("Slowness.findLatestByReport");

        List<Slowness> result = new ArrayList<Slowness>();
        for (Report report : reports) {
            sbmQuery.setParameter("report", report);
            Slowness slown = (Slowness) sbmQuery.getSingleResult();
            result.add(slown);
        }
        request.setAttribute("exceptions", result);
        return mapping.findForward(SUCCESS);
    }
View Full Code Here

TOP

Related Classes of org.netbeans.modules.exceptions.entity.Slowness

Copyright © 2018 www.massapicom. 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.