Package org.netbeans.modules.exceptions.entity

Examples of org.netbeans.modules.exceptions.entity.Submit$SubmitImpl


            }
        }

        // increase priority if needed
        public TransactionResult runQuery(EntityManager em) {
            Submit merged = Submit.getById(em, submit.getId());
            if (!merged.getReportId().isInIssuezilla()){
                // nothing to do
                return TransactionResult.NONE;
            }
            int issuezillaId = merged.getReportId().getIssueId();
            if (!PersistenceUtils.issueIsOpen(issuezillaId)){
                return TransactionResult.NONE;
            }
            int duplicatesCount = merged.getReportId().getDuplicates(em);
            int duplicatesAmount = getDuplicatesAmount(duplicatesCount);
            if (duplicatesAmount == 0){
                return TransactionResult.NONE;
            }
            if (merged instanceof Exceptions &&
View Full Code Here


            createNewSubmit(em, i);
        }
        em.getTransaction().commit();
        em.close();
        em = perUtils.createEntityManager();
        Submit id1 = Submit.getById(em, 1);
        List<Submit> result = splitDups.splitDuplicates(new String[]{"2", "3", "4"}, "1");
        assertEquals(3, result.size());
        for (Submit sbm : result) {
            assertEquals(id1.getReportId(), sbm.getReportId());
        }

        result = splitDups.splitDuplicates(new String[0], "1");
        assertTrue(result.isEmpty());

        result = splitDups.splitDuplicates(new String[]{"1"}, "1");
        assertEquals(result.iterator().next(), id1);
        assertEquals(new Integer(1), id1.getReportId().getId());
        em.close();
        result = splitDups.splitDuplicates(new String[]{"2", "3", "4", "5", "9"}, "3");
        assertEquals(5, result.size());
        em = perUtils.createEntityManager();
        em.getTransaction().begin();
        Submit id3 = Submit.getById(em, 3);
        for (Submit exceptions : result) {
            assertEquals(id3.getReportId(), exceptions.getReportId());
            assertTrue(exceptions.getReportId().getDuplicateManChanged());
        }
        em.getTransaction().commit();
        em.close();
    }
View Full Code Here

        em.close();
    }

    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");
        sbm.setReportId(report);
        em.persist(report);
        em.persist(sbm);
        return sbm;
    }
View Full Code Here

    public void testRedirect() throws Exception {
        MockServices.setServices();
        AuthenticatorImpl.setDefaultAuthToken(new AuthToken("exceptions_reporter", "vsdsvsds"));
        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        Submit sbm = BugzillaReporterTest.prepareData(em, 1, true);
        em.getTransaction().commit();
        em.close();

        HttpServletRequest request = new TestHttpSevletRequest(Collections.<String, Object>emptyMap(), Collections.singletonMap("reportid", sbm.getId().toString()));
        HttpServletResponse response = new TestHttpServletResponse();
        new IssuezillaRedirect().processRequest(request, response);
        DatabaseTestCase.waitIssuezillaInsertionFinished();
        em = perUtils.createEntityManager();
        em.getTransaction().begin();
View Full Code Here

    }

    private Submit createSubmit(Integer issueId, int reportId, int submitId){
        Report r1 = new Report(reportId);
        r1.setIssueId(issueId);
        Submit s1 = new Exceptions(submitId);
        s1.setReportId(r1);
        return s1;
    }
View Full Code Here

        assertNotNull(result);
        assertTrue(result.isEmpty());
    }

    public void testNotInIZ() throws Exception {
        Submit e1 = createNewSubmit();
        List<Submit> result = runQuery("both", "ALL");
        assertNotNull(result);
        assertFalse(result.isEmpty());
        assertEquals(e1, result.get(0));
View Full Code Here

        assertNotNull(result);
        assertTrue(result.isEmpty());
    }

    public void testInIZ() throws Exception {
        Submit e1 = createNewSubmit();
        e1.getReportId().setIssueId(1000);

        List<Submit> result = runQuery("both", "ALL");
        assertNotNull(result);
        assertFalse(result.isEmpty());
        assertEquals(e1, result.get(0));
View Full Code Here

        assertNotNull(result);
        assertTrue(result.isEmpty());
    }

    public void testOpen() throws Exception {
        Submit e1 = createNewSubmit();
        e1.getReportId().setIssueId(1000);
        Issue issue = BugReporterFactory.getDefaultReporter().getIssue(1000);
        issue.setIssueStatus("NEW");

        List<Submit> result = runQuery("both", "OPEN");
        assertNotNull(result);
View Full Code Here

        assertNotNull(result);
        assertTrue(result.isEmpty());
    }

    public void testClosed() throws Exception {
        Submit e1 = createNewSubmit();
        e1.getReportId().setIssueId(1000);
        Issue issue = BugReporterFactory.getDefaultReporter().getIssue(1000);
        issue.setIssueStatus("RESOLVED");

        List<Submit> result = runQuery("both", "OPEN");
        assertNotNull(result);
View Full Code Here

            Utils.processPersistable(new Persistable.Query() {

                public TransactionResult runQuery(EntityManager em) {
                    Integer issueId = Integer.parseInt(issueIdStr);
                    Matcher match = Matcher.getDefault();
                    Submit sbm = Submit.getById(em, issueId);
                    if(sbm == null){
                        register(request, new Component("non existing submit with id", issueId.toString()));
                    }else{
                        Component comp;
                        if (sbm instanceof Exceptions) {
                            comp = match.match(em, ((Exceptions)sbm).getMockThrowable());
                        }else{
                            SlownessChecker checker = new SlownessChecker(em, null, sbm.getLogfileId());
                            comp = checker.getComponentForSlowness();
                        }
                        register(request, comp);
                    }
                    return TransactionResult.NONE;
View Full Code Here

TOP

Related Classes of org.netbeans.modules.exceptions.entity.Submit$SubmitImpl

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.