Package org.netbeans.modules.exceptions.entity

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


    public void testSet() throws Exception {
        File log = LogsManagerTest.extractResourceAs(data, "1.log", "log444");
        logsManager.addLog(log, "127.0.0.1");
        Statistics<?> somestats = Lookup.getDefault().lookup(Help.class);
        EntityManager em = perUtils.createEntityManager();
        Logfile logfile = LogFileTask.getLogInfo("log444", em);
        em.getTransaction().begin();
        Preferences prefs = DbPreferences.root(logfile, somestats, em);

        Set<String> testData = new HashSet<String>(10);
        String key = "key";
View Full Code Here


        return mapping.findForward(SUCCESS);
    }

    protected List<String> getPatches(EntityManager em, Exceptions exceptions, List<LogRecord> records) {

        Logfile logfile = exceptions.getLogfileId();
        Nbversion version = logfile.getProductVersionId().getNbversionId();
        Map<String, Object> params = Collections.singletonMap("nbversion", (Object) version);
        List<Patch> patches = PersistenceUtils.executeNamedQuery(em, "Patch.findNbVersion", params, Patch.class);
        NetBeansModules modules = new NetBeansModules();
        modules.setRememberDistinctVersions(true);
        List<String> installedPatches = new ArrayList<String>();
View Full Code Here

                fail("Too small increment of of " + e.getKey() + " = " + e.getValue() + " and " + newValue);
            }
        }
       
       
        Logfile info = LogFileTask.getRunningTask().getLogInfo();
        assertNotNull("There is a log info", info);
        assertEquals("address is ok", info.getIpAddr(), "10.0.0.23");
    }
View Full Code Here

            os.setVersion("1.1");
            os.setArch("Linux");
            em.persist(os);
        }

        Logfile lf = new Logfile(i * 100);
        lf.setBuildnumber(0l);
        lf.setUserdir("dsfddsf");
        lf.setUploadNumber(i);
        lf.setChangeset(0l);
        lf.setProductVersionId(pv);
        lf.setNbuser(user);
        em.persist(lf);

        FileOutputStream fos = new FileOutputStream(lf.getNPSFile());
        fos.write("Hallo World!".getBytes());
        fos.close();

        Report r = new Report(i);
        r.setComponent("ide");
View Full Code Here

        Throwable thrown = new NullPointerException("TESTING NULL POINTER");
        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        String userId = "file";
        int session = 1;
        Logfile log = new Logfile(userId, session);
        TestLogFileTask task = new TestLogFileTask(em, log);
        DbInsertion insertion = new DbInsertion(rec, thrown, task);
        insertion.start(new ExceptionsData());
        task.markFinished();
View Full Code Here

        Throwable thrown = new NullPointerException("TESTING NULL POINTER");
        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        String userId = "file";
        int session = 1;
        Logfile log = new Logfile(userId, session);
        DbInsertion insertion = new DbInsertion(rec, thrown, new TestLogFileTask(em, log));
        insertion.start(new ExceptionsData());
        //waitLogsParsed();
        List<org.netbeans.modules.exceptions.entity.Exceptions> all =
                PersistenceUtils.getAll(em, org.netbeans.modules.exceptions.entity.Exceptions.class);
        org.netbeans.modules.exceptions.entity.Exceptions rootException = all.get(all.size() - 1);
        rootId = rootException.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, org.netbeans.modules.exceptions.entity.Exceptions.class);
        rootException = all.get(all.size() - 1);
        assertNotNull(rootException);
        assertEquals(1, rootException.getReportId().getDuplicates(em));
        assertEquals(1, rootException.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(1, rootException.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, org.netbeans.modules.exceptions.entity.Exceptions.class);
        rootException = all.get(all.size() - 1);

        rootException = insert(em, new DbInsertion(rec, thrown, new TestLogFileTask(em, log)));
        assertEquals(2, rootException.getReportId().getDuplicates(em));
        assertEquals(1, rootException.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(2, rootException.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, org.netbeans.modules.exceptions.entity.Exceptions.class);
        rootException = all.get(all.size() - 1);

        rootException = insert(em, new DbInsertion(rec, thrown, new TestLogFileTask(em, log)));
        assertEquals(3, rootException.getReportId().getDuplicates(em));
        assertEquals(1, rootException.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(3, rootException.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, org.netbeans.modules.exceptions.entity.Exceptions.class);
        rootException = all.get(all.size() - 1);

        rootException = insert(em, new DbInsertion(rec, thrown, new TestLogFileTask(em, log)));
        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, rootException.getReportId().getDuplicates(em));
        assertEquals(2, rootException.getReportId().getDuplicatesFromDistinctUsers(em));
        assertEquals(3, rootException.getReportId().getDuplicatesFromOneUser(em, user));
        assertEquals(1, rootException.getReportId().getDuplicatesFromOneUser(em, user2));

        session = 5;
        log = new Logfile(userId, session);
        rootException = insert(em, new DbInsertion(rec, thrown, new TestLogFileTask(em, log)));

        // -- refresh persistence context ---//
        em.getTransaction().commit();
        em.close();
View Full Code Here

    public void testDontInsertUserDirComponents() throws InterruptedException {
        TestHandler handler = new TestHandler();
        BugReporter.LOG.addHandler(handler);
        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        Logfile log = new Logfile("testDir", 1);
        ProductVersion pv = new ProductVersion(1);
        pv.setProductVersion("NetBeans IDE 6.0 (Build 081204)");
        Nbversion nbv = new Nbversion(1);
        nbv.setVersion("6.0");
        pv.setNbversionId(nbv);
        log.setProductVersionId(pv);
        TestLogFileTask task = new TestLogFileTask(em, log);
        Nbuser user = new Nbuser(1);
        user.setName("HALLO");
        org.netbeans.modules.exceptions.entity.Exceptions exc = new org.netbeans.modules.exceptions.entity.Exceptions(100);
        Report report = new Report(100);
View Full Code Here

        rec.setParameters(params.toArray());
        Throwable thrown = new NullPointerException("TESTING NULL POINTER");
        String userId = "file";

        ExceptionsData eData = new ExceptionsData();
        Logfile log = new Logfile(userId, session);
        TestLogFileTask task = new TestLogFileTask(em, log);
        DbInsertion dbInsertion = new DbInsertion(rec, thrown, task);
        dbInsertion.start(eData);
        task.markFinished();
        waitIssuezillaInsertionFinished();
View Full Code Here

TOP

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

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.