Package org.netbeans.modules.exceptions.entity

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


        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


    private class THandler extends Handler {

        public void publish(LogRecord record) {
            String message = record.getMessage();
            if ("METADATA = NULL".equals(message)) {
                Logfile logFile = LogFileTask.getRunningTask().getLogInfo();
                if ((logFile.getProductVersionId() != null) || (!"11.0.0.51".equals(logFile.getIpAddr()))) {
                    shouldFail = true;
                }
            }
        }
View Full Code Here

        }
        return arr;
    }
    private void check(int count, String version, String IP, String IPAddr, int UploadNumber, String userDir, String fileName, String buildNumber){
        assertEquals("LOG file is INSERTED", count, LogsManager.getDefault().getNumberOfLogs());
        Logfile logFile  = LogFileTask.getRunningTask().getLogInfo();
        assertNotNull("Version", logFile.getProductVersionId());
        assertEquals("VERSION", version, logFile.getProductVersionId().getProductVersion());
        assertEquals("UPLOAD NUMBER, ", new Integer(UploadNumber), logFile.getUploadNumber());
        assertEquals("USERDIR NUMBER, ", userDir, logFile.getUserdir());
        assertEquals("FileName", fileName, logFile.getFileName());
        assertEquals("BuildNumber", new Long(buildNumber), logFile.getBuildnumber());
        assertEquals("IP", new Long(IP), logFile.getIp());
        assertEquals("IP Addr", IPAddr, logFile.getIpAddr());
    }
View Full Code Here

        params[5] = comments[0];
        params[6] = "test";
        String userId = "file";
        String action = "org.openide.actions.NewFile";
        int session = 3;
        Logfile log = new Logfile(userId, session);

        rec.setParameters(params);
        File nps = log.getNPSFile();
        InputStream is = SnapshotManagerTest.class.getResourceAsStream("snapshot.nps");
        createFileFromStream(nps, is);
        is.close();
       
        DbInsertion insertion = new DbInsertion(rec, null, null, new TestLogFileTask(em, log), 1323l, null, action);
View Full Code Here

        return null;
    }

    protected Invocations finishSessionUpload(String userId, int sessionNumber,
                                        boolean initialParse, Help.Invocations d) {
        Logfile l = LogFileTask.getRunningTask().getLogInfo();
        Long build = l == null ? null : l.getBuildnumber();
        if (build == null || build <= 70416L) {
            // ignore old builds, those created before April 16, 2007
            return null;
        }
       
View Full Code Here

        String userId = "file";
        int session = 3;
       
        rec.setParameters(params);
        Throwable thrown = new NullPointerException("TESTING NULL POINTER");
        Logfile log = new Logfile(userId, session);
        DbInsertion insertion = new DbInsertion(rec, thrown, new TestLogFileTask(em, log));
        ExceptionsData insertionResult = getInsertionData(insertion);
        assertFalse("THIS ISSUE IS NOT ANY DUPLICATE", insertionResult.isDuplicateReport());
        assertNull("NO ISSUEZILLA ID", insertionResult.getIssuezillaId());
        assertEquals("Exception report", ExceptionsData.DataType.EXC_REPORT, insertionResult.getDataType());
        waitLogsParsed();
       
        List<Nbuser> usersList = PersistenceUtils.getAll(em, Nbuser.class);
        Nbuser user = usersList.get(0);
        assertEquals("THERE MUST BE ONE USER", 1, usersList.size());
        assertEquals("USER NAME CHECK", user.getName(), params[3]);
       
        List<org.netbeans.modules.exceptions.entity.Exceptions> exceptionList = PersistenceUtils.getAll(em, org.netbeans.modules.exceptions.entity.Exceptions.class);
        org.netbeans.modules.exceptions.entity.Exceptions exception = exceptionList.get(0);
        assertEquals("THERE MUST BE ONE ISSUE", 1, exceptionList.size());
        assertEquals("THIS ISSUE WAS ADDED WITH ID", insertionResult.getSubmitId(), exception.getId());
        assertEquals("SUMMARY CHECK", exception.getSummary(), params[4]);
        assertEquals(fileNames[0], exception.getLogfileId().getFileName());
        assertEquals("VM MACHINE CHECK", exception.getVmId().getName(), params[1]);
        assertEquals("NB PRODUCT VERSION CHECK", exception.getLogfileId().getProductVersionId().getProductVersion(), params[2]);
        String os = exception.getOperatingsystemId().getName() + ", " + exception.getOperatingsystemId().getVersion() + ", " + exception.getOperatingsystemId().getArch();
        assertEquals("OPERATING SYSTEM NAME CHECK", os, params[0]);
        assertEquals("PRODUCT BUILD NUMBER", exception.getBuild(), Long.valueOf("070212"));
        assertEquals("NR. OF DUPLICATES SHOULD BE 1", 1, exception.getReportId().getSubmitCollection().size());
        assertEquals("STACKTRACE LINES NUMBER", thrown.getStackTrace().length, exception.getStacktrace().getLineCollection().size());

        List<Line> linesList = PersistenceUtils.getAll(em, Line.class);
        Iterator<Line> lineIterator = linesList.iterator();
        assertTrue("THERE MUST BE FEW LINES", linesList.size() > 0);
        List<StackTraceElement> list = Arrays.asList(thrown.getStackTrace());
        do{
            Line line = lineIterator.next();
            assertNotNull("JarFile is not inserted", line.getJarfileId());
            int lineOrder = line.getLinePK().getLineOrder();
            int lineNumber = line.getLinePK().getLinenumber();
            int stackLineNumber = list.get(lineOrder).getLineNumber();
            if (stackLineNumber < 0) stackLineNumber = 0;
            assertEquals(lineNumber, stackLineNumber);
        }while (lineIterator.hasNext());
        assertEquals(linesList.size(), list.size());
       
        Integer count = perUtils.count(Jarfile.class);
        assertTrue("THE NUMBER MUST BE NOT 0", count > 0);
       
        logFiles = AddLogFileTest.logFiles(em);
        assertEquals("JUST ONE logfile: " + logFiles,1, logFiles.size());
        assertEquals("Build Number", logFiles.get(0).getBuildnumber(), Long.valueOf("070212"));
        assertEquals("Upload Number", logFiles.get(0).getUploadNumber(), new Integer(session));
        assertEquals("userDir", logFiles.get(0).getUserdir(), userId);
        assertEquals("File Name", logFiles.get(0).getFileName(), userId+"."+String.valueOf(session-1));
        assertNull("IP is null - it was not set", logFiles.get(0).getIp());
       
        //********* ADD DUPLICATE *********/
        params[3] = users[1];
        params[5] = comments[1];
        params[2] = productVersion[1];
        rec.setParameters(params);
        log = new Logfile(userId, session+1);
        insertion = new DbInsertion(rec, thrown, new TestLogFileTask(em, log));
        insertionResult = getInsertionData(insertion);
        assertTrue("THIS ISSUE IS A DUPLICATE", insertionResult.isDuplicateReport());
        assertAreDuplicates("DUPLICATE INSERTION", em, new Integer(1), insertionResult.getSubmitId());
        assertNull("NO ISSUEZILLA ID", insertionResult.getIssuezillaId());
        assertEquals("Exception report", ExceptionsData.DataType.EXC_REPORT, insertionResult.getDataType());
        waitLogsParsed();
       
        Integer nextCount = perUtils.count(Jarfile.class);
        assertEquals("THE NUMBER OF JAR FILES MUST BE THE SAME", count, nextCount);
       
        usersList = PersistenceUtils.getAll(em, Nbuser.class);
        user = usersList.get(0);
        assertEquals("THERE MUST BE USER", 1, usersList.size());
        assertEquals(users[0], user.getName());
       
       
       
        List<Comment> commentList = PersistenceUtils.getAll(em, Comment.class);
        assertEquals("THERE SHOULD BE TWO COMMENTS", 2, commentList.size());
        //first record
        Comment comment = commentList.get(0);
        assertEquals(comments[0],comment.getComment());
       
        comment = commentList.get(1);
        //second record
        assertEquals(comments[1],comment.getComment());
       
        exceptionList = PersistenceUtils.getAll(em, org.netbeans.modules.exceptions.entity.Exceptions.class);
        exception = exceptionList.get(0);
        assertEquals("THERE MUST BE ONE ISSUE", 2, exceptionList.size());
        //check the first one
        assertEquals("THIS ISSUE WAS ADDED WITH ID", new Integer(1), exception.getId());
        assertEquals("SUMMARY CHECK", exception.getSummary(), params[4]);
        assertEquals(fileNames[0], exception.getLogfileId().getFileName());
        assertEquals("VM MACHINE CHECK", exception.getVmId().getName(), params[1]);
        assertEquals("NB PRODUCT VERSION CHECK", exception.getLogfileId().getProductVersionId().getProductVersion(), productVersion[0]);
        assertEquals("PRODUCT BUILD NUMBER", exception.getBuild(),Long.valueOf("070212"));
        os = exception.getOperatingsystemId().getName() + ", " + exception.getOperatingsystemId().getVersion() + ", " + exception.getOperatingsystemId().getArch();
        assertEquals("OPERATING SYSTEM NAME CHECK", os, params[0]);
//        assertNull("THIS SHOULD NOT BE A DUPLICATE", exception.getDuplicateof());// NULL
        //check the second one
        exception = exceptionList.get(1);
        assertEquals("THIS ISSUE WAS ADDED WITH ID", new Integer(2), exception.getId());
        assertEquals("SUMMARY CHECK", exception.getSummary(), params[4]);
        assertEquals(fileNames[1], exception.getLogfileId().getFileName());
        assertEquals("VM MACHINE CHECK", exception.getVmId().getName(), params[1]);
        assertEquals("NB PRODUCT VERSION CHECK", exception.getLogfileId().getProductVersionId().getProductVersion(), productVersion[1]);
        assertEquals("PRODUCT BUILD NUMBER", exception.getBuild(), Long.valueOf("070416"));
        os = exception.getOperatingsystemId().getName() + ", " + exception.getOperatingsystemId().getVersion() + ", " + exception.getOperatingsystemId().getArch();
        assertEquals("OPERATING SYSTEM NAME CHECK", os, params[0]);
//        assertNotNull("THIS SHOULD BE A DUPLICATE", exception.getDuplicateof());
//        assertEquals("THIS SHOULD BE A DUPLICATE OF ISSUE 1", exception.getDuplicateof(), exceptionList.get(0));
        assertEquals("COMPONENT FROM COMMENT", "versioncontrol", exception.getReportId().getComponent());
        assertEquals("SUBCOMPONENT FROM COMMENT", "Subversion", exception.getReportId().getSubcomponent());
       
       
        logFiles = AddLogFileTest.logFiles(em);
        assertEquals("TWO logfile",2, logFiles.size());
        //--- FIRST --//
        Logfile logFile = logFiles.get(0);
        assertEquals("Build Number", logFile.getBuildnumber(), Long.valueOf("070212"));
        assertEquals("Upload Number", logFile.getUploadNumber(), new Integer(session));
        assertEquals("userDir", logFile.getUserdir(), userId);
        assertEquals("File Name", logFile.getFileName(), userId+"."+String.valueOf(session-1));
        assertNull("IP is null - it was not set", logFile.getIp());
        assertNotNull(logFile.getProductVersionId());
        assertEquals("PRODUCT VERSION CHECK",  productVersion[0], logFile.getProductVersionId().getProductVersion());
        assertEquals("NBVersion CHECK", "Dev", logFile.getProductVersionId().getNbversionId().getVersion());

        //---SECOND--//
        logFile = logFiles.get(1);
        assertEquals("Build Number", logFile.getBuildnumber(), Long.valueOf("070416"));
        assertEquals("Upload Number", logFile.getUploadNumber(), new Integer(session+1));
        assertEquals("userDir", logFile.getUserdir(), userId);
        assertEquals("File Name", logFile.getFileName(), userId+"."+String.valueOf(session));
        assertNull("IP is null - it was not set", logFile.getIp());
        assertNotNull(logFile.getProductVersionId());
        assertEquals("PRODUCT VERSION CHECK",  productVersion[1], logFile.getProductVersionId().getProductVersion());
        assertEquals("NBVersion CHECK", "Dev", logFile.getProductVersionId().getNbversionId().getVersion());
    }
View Full Code Here

       
        rec.setParameters(params);
        Throwable thrown = new NullPointerException("TESTING NULL POINTER");
       
       
        Logfile log = new Logfile(userId, session);
        DbInsertion insertion = new DbInsertion(rec, thrown, new TestLogFileTask(em, log));
        ExceptionsData insertionResult = insertionResult = getInsertionData(insertion);
        //called from different class => different stackTrace
        assertFalse("THIS ISSUE IS NOT ANY DUPLICATE", insertionResult.isDuplicateReport());
        assertEquals("NEW INSERTION NEW ID", 3, insertionResult.getSubmitId().intValue());
        assertNull("NO ISSUEZILLA ID", insertionResult.getIssuezillaId());
        assertEquals("Exception report", ExceptionsData.DataType.EXC_REPORT, insertionResult.getDataType());
        waitLogsParsed();
       
        List<org.netbeans.modules.exceptions.entity.Exceptions> exceptionList = PersistenceUtils.getAll(em, org.netbeans.modules.exceptions.entity.Exceptions.class);
        assertEquals("LIST SIZE", 3, exceptionList.size());
        org.netbeans.modules.exceptions.entity.Exceptions exception = exceptionList.get(2);
        exception.getReportId().setIssueId(issueZillaId);
        em.merge(exception);

        // ADD DUPLICATE
        log = new Logfile(userId, session);
        insertion = new DbInsertion(rec, thrown, new TestLogFileTask(em, log));
        insertionResult = insertionResult = getInsertionData(insertion);
        assertTrue("THIS ISSUE A DUPLICATE", insertionResult.isDuplicateReport());
        assertAreDuplicates("DUPLICATE INSERTION", em, 3, insertionResult.getSubmitId());
        waitLogsParsed();

        log = new Logfile(userId, session);
        insertion = new DbInsertion(rec, thrown, new TestLogFileTask(em, log));
        insertionResult = insertionResult = getInsertionData(insertion);
        assertTrue("THIS ISSUE A DUPLICATE", insertionResult.isDuplicateReport());
        assertAreDuplicates("DUPLICATE INSERTION", em, 3, insertionResult.getSubmitId());
        assertEquals("ISSUEZILLA ID", 10, insertionResult.getIssuezillaId().intValue());
View Full Code Here

        params[3] = "trunk";
        params[4] = "";
        params[5] = "76d51071af8a tip";
        buildInfo.setParameters(params);

        Logfile log = new Logfile("dafadf", 1);
        DbInsertion insertion = new DbInsertion(config, new NullPointerException("null11"), buildInfo, new TestLogFileTask(em, log));
        ExceptionsData insertionResult = getInsertionData(insertion);
        Exceptions exc = em.find(Exceptions.class, insertionResult.getSubmitId());
        assertNotNull(exc);
        assertNotNull(exc.getLogfileId().getChangeset());
View Full Code Here

        String userId = "file";
        int session = 3;

        rec.setParameters(params);
        Throwable thrown = new NullPointerException("TESTING NULL POINTER");
        Logfile log = new Logfile(userId, session);
        DbInsertion insertion = new DbInsertion(rec, thrown, new TestLogFileTask(em, log));
        ExceptionsData insertionResult = getInsertionData(insertion);
        waitLogsParsed();
        Query q =  em.createQuery("SELECT e from Exceptions e where id = " + insertionResult.getSubmitId());
        Exceptions exc = (Exceptions) q.getSingleResult();
View Full Code Here

        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());

        LogRecord result = handler.getResult();
        assertNull("NOT A DIRECT USER", result);
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.