Package org.netbeans.modules.exceptions.entity

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


        rec.setParameters(params.toArray());
        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        String userId = "file";
        int session = 1;
        Logfile log = new Logfile(userId, session);
        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();
View Full Code Here


        ProductVersion pw = new ProductVersion(1);
        pw.setNbversionId(nv);
        pw.setProductVersion("pw");
        em.persist(pw);

        Logfile lf = new Logfile(10);
        lf.setUploadNumber(0);
        lf.setUserdir("gestures");
        lf.setProductVersionId(pw);
        em.persist(lf);

        Report report = new Report(0);
        em.persist(report);
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);
        TestLogFileTask task = new TestLogFileTask(em, log);
        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);
        Nbuser user = new Nbuser(1);
        user.setName("HALLO");
        Slowness slown = new Slowness(100);
        slown.setActionTime(1000L);
        Method m = new Method(30);
View Full Code Here

        params.add("petrzajac");
        rec.setParameters(params.toArray());
        String userId = "file";

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

        em.getTransaction().begin();
        Exceptions exc = new Exceptions(exceptionId);
        Report report = new Report(exceptionId);
        exc.setReportId(report);
        Stacktrace stack = new Stacktrace(Utils.getNextId(Stacktrace.class));
        Logfile logfile = new Logfile(userId, 0);
        ProductVersion pVersion = new ProductVersion(Utils.getNextId(ProductVersion.class));
        pVersion.setProductVersion("pVersion");
        Nbversion version = new Nbversion(Utils.getNextId(Nbversion.class));
        version.setVersion("version");
        pVersion.setNbversionId(version);
        logfile.setProductVersionId(pVersion);
        exc.setLogfileId(logfile);
        exc.setStacktrace(stack);
        em.persist(version);
        em.persist(pVersion);
        em.persist(logfile);
View Full Code Here

        assertEquals(3, logsManager.getParsedLogs());
        logsManager.preparePageContext(page, "test", Collections.singleton("TimeToFailture"));
        verifyLoaded(page);

        EntityManager em = perUtils.createEntityManager();
        Logfile globalLogFile = LogFileTask.getLogInfo("global", 0, em);
        assertNotNull("Global data are saved in DB", globalLogFile);

        Query query = em.createQuery("SELECT p FROM Preference p WHERE logfile = :log");
        query.setParameter("log", globalLogFile);
        List<Preference> prefs = query.getResultList();
View Full Code Here

        performTest("NetBeans IDE 7.0 M1", "7.0M1", true);
    }

    private void performTest(String productVersion, String TM, boolean result){
        org.netbeans.modules.exceptions.entity.Exceptions exc = new org.netbeans.modules.exceptions.entity.Exceptions();
        Logfile lf = new Logfile();
        ProductVersion pv = new ProductVersion();
        Nbversion nb = new Nbversion();
        lf.setProductVersionId(pv);
        pv.setNbversionId(nb);
        exc.setLogfileId(lf);
        String nbVersion = org.netbeans.modules.exceptions.utils.Utils.getNbVersion(productVersion);
        nb.setVersion(nbVersion);
        Issue iss = new Issue(1);
View Full Code Here

        result = exceptions.finishSessionUpload(userId, 1, true, thr);
        checkResult("NO METADATA IN REPORT", result, null, null, false);//not META DATA

        em = PersistenceUtils.getInstance().createEntityManager();
        em.getTransaction().begin();
        Logfile logfile = new Logfile("log4445", 1);
        new DbInsertionTest.TestLogFileTask(em, logfile);//add log file into log LogFileTask -> unfinished

        result = exceptions.finishSessionUpload(userId, 1, true, logData);
        checkResult("NO THROWN IN REPORT", result, null, null, false);//not THROWN
        result = exceptions.finishSessionUpload(userId, 1, true, both);
        checkResult("THERE SHOULD BE NO DUPLICATE OF THIS ISSUE", result, 2, null, true);//not DUPLICATE
        em.getTransaction().commit();
        em.getTransaction().begin();

        logfile = new Logfile("log4445", 2);
        new DbInsertionTest.TestLogFileTask(em, logfile);
       
        result = exceptions.finishSessionUpload(userId, 1, true, both);// INSERT ONCE MORE
        checkResult("THIS ISSUE SHOULD BE A DUPLICATE OF #2", result, 3, 2, true);//duplicate of issue no 1
        em.getTransaction().commit();
View Full Code Here

public class LoggerUtils {

    static final String USER_CONFIGURATION = "UI_USER_CONFIGURATION";   // NOI18N

    public static InputStream getLoggerAsInputStream(Submit exc) {
        Logfile logfile = exc.getLogfileId();
        String userId = logfile.getUserdir();
        String dirPath = org.netbeans.server.uihandler.Utils.getUploadDirPath(
                org.netbeans.server.uihandler.Utils.getRootUploadDirPath(), userId);
        java.io.InputStream is = null;
        try {
            String fileName = dirPath + File.separator + logfile.getFileName();
            if (new File(fileName).exists()) {
                is = new java.io.FileInputStream(fileName);
            } else {
                fileName = fileName + ".gz";
                is = new java.util.zip.GZIPInputStream(new java.io.FileInputStream(fileName));
View Full Code Here

   
    public void testBasicPrefsOps() throws Exception {
        File log2 = LogsManagerTest.extractResourceAs(data, "2.log", "log4442");
        result.addLog(log2, "127.0.0.1");
        result.waitParsingFinished();
        Logfile file2 = LogFileTask.getRunningTask().getLogInfo();

        assertNotNull("f1", file);
        assertNotNull("f2", file2);
        if (file == file2) {
            fail("log files are same!");
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.