Package com.darkhonor.rage.model

Examples of com.darkhonor.rage.model.TestCase


     */
    @Ignore("Not ready yet")
    @Test
    public void testGradeTestCase() {
        System.out.println("gradeTestCase");
        TestCase tc = null;
        Response response = null;
        boolean verbatim = false;
        boolean exclusions = false;
        boolean expResult = false;
        boolean result = RageLib.gradeTestCase(tc, response, verbatim, exclusions);
View Full Code Here


            LOGGER.error("(find) Provided Test Case Id is less than 1");
            throw new IllegalArgumentException("Provided Test Case Id is less than 1");
        } else
        {
            EntityTransaction tx = em.getTransaction();
            TestCase testCase;
            tx.begin();
            testCase = em.find(TestCase.class, id);
            tx.commit();
            return testCase;
        }
View Full Code Here

            LOGGER.error("(find) Provided Test Case Id is less than 1");
            throw new IllegalArgumentException("Provided Test Case Id is less than 1");
        } else
        {
            EntityTransaction tx = em.getTransaction();
            TestCase updatedTestCase = em.find(TestCase.class, testCase.getId());
            if (updatedTestCase == null)
            {
                LOGGER.error("(update) Provided TestCase does not exist");
                throw new IllegalArgumentException("Provided TestCase does not exist");
            }
            updatedTestCase.setValue(testCase.getValue());
            updatedTestCase.setInputs(new ArrayList<String>());
            updatedTestCase.setOutputs(new ArrayList<String>());
            updatedTestCase.setExcludes(new ArrayList<String>());
            // Clear current inputs, outputs, and excludes
            tx.begin();
            updatedTestCase = em.merge(updatedTestCase);
            tx.commit();
            // Add current inputs, outputs, and excludes
            for (int i = 0; i < testCase.getInputs().size(); i++)
            {
                updatedTestCase.addInput(testCase.getInputs().get(i));
            }
            for (int i = 0; i < testCase.getOutputs().size(); i++)
            {
                updatedTestCase.addOutput(testCase.getOutputs().get(i));
            }
            for (int i = 0; i < testCase.getExcludes().size(); i++)
            {
                updatedTestCase.addExclusion(testCase.getExcludes().get(i));
            }
            tx.begin();
            updatedTestCase = em.merge(updatedTestCase);
            tx.commit();
            return updatedTestCase;
View Full Code Here

            LOGGER.error("(find) Provided Test Case Id is less than 1");
            throw new IllegalArgumentException("Provided Test Case Id is less than 1");
        } else
        {
            EntityTransaction tx = em.getTransaction();
            TestCase deletedTestCase = em.find(TestCase.class, testCase.getId());
            if (deletedTestCase == null)
            {
                LOGGER.error("(delete) Provided TestCase does not exist");
                throw new IllegalArgumentException("Provided TestCase does not "
                        + "exist");
View Full Code Here

            LOGGER.error("(find) Provided Test Case Id is less than 1");
            throw new IllegalArgumentException("Provided Test Case Id is less than 1");
        } else
        {
            EntityTransaction tx = em.getTransaction();
            TestCase deletedTestCase = em.find(TestCase.class, id);
            if (deletedTestCase == null)
            {
                LOGGER.error("(delete) Provided TestCase ID does not exist");
                throw new IllegalArgumentException("Provided TestCase Id does not "
                        + "exist");
View Full Code Here

        Category category2 = createPersistedCategory(2L, "Loop");
        Category category3 = createPersistedCategory(3L, "Iteration");
        // Create some specific TestCases to start with that can be used for testing
        // createPersistedQuestion does this as well, but with unpredictable
        // TestCase id values
        TestCase testCase1 = new TestCase(new BigDecimal("1.0"));
        testCase1.setId(new Long(5L));
        testCase1.addInput("1234");
        testCase1.addInput("5678");
        testCase1.addOutput("Result = 12345678");
        testCase1.addExclusion("2345");
        testCase1.addExclusion("9876");
        testCase1.addExclusion("Result = 12345678");

        TestCase testCase2 = new TestCase(new BigDecimal("2.5"));
        testCase2.setId(new Long(2L));
        testCase2.addInput("4");
        testCase2.addInput("5");
        testCase2.addOutput("Result = 999999999");
       
        TestCase testCase3 = new TestCase(new BigDecimal("1.0"));
        testCase3.setId(new Long(3L));
        testCase3.addInput("123");
        testCase3.addInput("1234");
        testCase3.addOutput("12345");

        TestCase testCase4 = new TestCase(new BigDecimal("1.0"));
        testCase4.setId(new Long(4L));
        testCase4.addInput("234");
        testCase4.addInput("2345");
        testCase4.addOutput("23456");
       
        TestCase testCase5 = new TestCase(new BigDecimal("3.5"));
        testCase5.setId(new Long(6L));
        testCase5.addOutput("Hello World");
        testCase5.addExclusion("Mini Me");

        persistTestCase(testCase1);
        persistTestCase(testCase2);
        persistTestCase(testCase3);
        persistTestCase(testCase4);
View Full Code Here

            question.setVerbatim(verbatim);
            question.setOrderedOutput(orderedOutput);

            for (int i = 0; i < testCases.size(); i++)
            {
                TestCase testCase = em.find(TestCase.class, testCases.get(i).getId());
                question.addTestCase(testCase);
            }
           
            EntityTransaction tx = em.getTransaction();
            tx.begin();
View Full Code Here

     */
    private void btnExcAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcAddActionPerformed

        if (lstTestCases.getSelectedIndex() != -1)
        {
            TestCase tc = (TestCase) lstTestCases.getSelectedValue();
            String input = "zzzz";
            do  // Error Check to make sure a value is entered
            {
                if ((input != null) && (input.equals("zzzz")))
                {
                    input = JOptionPane.showInputDialog(null,
                            "Enter exclusion for Test Case", "Enter Exclusion",
                            JOptionPane.QUESTION_MESSAGE);
                } else // This is an error time through
                {
                    input = JOptionPane.showInputDialog(null,
                            "ERROR: Enter valid exclusion for test case",
                            "ERROR: Enter Exclusion",
                            JOptionPane.ERROR_MESSAGE);
                }
            } while ((input == null) || (input.equals("")));
            tc.addExclusion(input);
            modExclusionList.add(input);
            if (modExclusionList.getSize() > 0)
            {
                btnExcRemove.setEnabled(true);
            }
View Full Code Here

        {
            JOptionPane.showMessageDialog(null, "ERROR: No exclusion selected",
                    "Error", JOptionPane.ERROR_MESSAGE);
        } else
        {
            TestCase tc = (TestCase) lstTestCases.getSelectedValue();
            tc.removeExclusion((String) lstExclusions.getSelectedValue());
            modExclusionList.remove(lstExclusions.getSelectedIndex());
        }
        if (modExclusionList.getSize() < 1)
        {
            btnExcRemove.setEnabled(false);
View Full Code Here

        {
            JOptionPane.showMessageDialog(null, "ERROR: No input selected",
                    "Error", JOptionPane.ERROR_MESSAGE);
        } else
        {
            TestCase tc = (TestCase) lstTestCases.getSelectedValue();
            tc.removeInput((String) lstInputs.getSelectedValue());
            modInputList.remove(lstInputs.getSelectedIndex());
        }
        if (modInputList.getSize() < 1)
        {
            btnInputRemove.setEnabled(false);
View Full Code Here

TOP

Related Classes of com.darkhonor.rage.model.TestCase

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.