Examples of Duration


Examples of net.sf.mpxj.Duration

     * @return int Integer with the rounded duration in hours
     */
    private static int durationToIntHours(Duration duration,
            ProjectHeader header) {

        Duration durationInHours = duration
                .convertUnits(TimeUnit.HOURS, header);

        return (int) Math.floor(durationInHours.getDuration());
    }
View Full Code Here

Examples of org.apache.axis.types.Duration

        org.apache.axis.types.MonthDay ym = new MonthDay(8, 5);
        deserialize("<result xsi:type=\"xsd:gMonthDay\">--08-05</result>",
                     ym);
    }
    public void testDuration() throws Exception {
        org.apache.axis.types.Duration ym = new Duration(false, 2, 3, 8, 8, 1, 3.3);
        deserialize("<result xsi:type=\"xsd:duration\">P2Y3M8DT8H1M3.3S</result>",
                     ym);
        org.apache.axis.types.Duration ym2 = new Duration(true, 2, 3, 8, 8, 1, 3.3);
        deserialize("<result xsi:type=\"xsd:duration\">-P2Y3M8DT8H1M3.3S</result>",
                     ym2);
    }
View Full Code Here

Examples of org.apache.axis2.databinding.schema.types.Duration

            checkValue(xmlString[i],values[i]);
        }
    }

    protected void compare(String val1, String val2) {
        assertTrue(new  Duration(val1).equals(new Duration(val2)));
    }
View Full Code Here

Examples of org.apache.axis2.databinding.types.Duration

                    throw new AxisFault(getFaultString(value, "decimal"));
                }
            }
            if (Constants.XSD_DURATION.equals(type)) {
                try {
                    Duration duration = ConverterUtil.convertToDuration(value);
                    return duration.toString();
                } catch (Exception e) {
                    throw new AxisFault(getFaultString(value, "duration"));
                }
            }
            if (Constants.XSD_QNAME.equals(type)) {
View Full Code Here

Examples of org.apache.catalina.filters.ExpiresFilter.Duration

                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(3,
                        expiresConfiguration.getDurations().size());

                Duration oneMonth = expiresConfiguration.getDurations().get(0);
                Assert.assertEquals(DurationUnit.MONTH, oneMonth.getUnit());
                Assert.assertEquals(1, oneMonth.getAmount());

                Duration fifteenDays = expiresConfiguration.getDurations().get(
                        1);
                Assert.assertEquals(DurationUnit.DAY, fifteenDays.getUnit());
                Assert.assertEquals(15, fifteenDays.getAmount());

                Duration twoHours = expiresConfiguration.getDurations().get(2);
                Assert.assertEquals(DurationUnit.HOUR, twoHours.getUnit());
                Assert.assertEquals(2, twoHours.getAmount());
            }
            // VERIFY IMAGE/GIF
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "image/gif");
                Assert.assertEquals(StartingPoint.LAST_MODIFICATION_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(2,
                        expiresConfiguration.getDurations().size());

                Duration fiveHours = expiresConfiguration.getDurations().get(0);
                Assert.assertEquals(DurationUnit.HOUR, fiveHours.getUnit());
                Assert.assertEquals(5, fiveHours.getAmount());

                Duration threeMinutes = expiresConfiguration.getDurations().get(
                        1);
                Assert.assertEquals(DurationUnit.MINUTE, threeMinutes.getUnit());
                Assert.assertEquals(3, threeMinutes.getAmount());

            }
            // VERIFY IMAGE/JPG
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "image/jpg");
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());

                Duration tenThousandSeconds = expiresConfiguration.getDurations().get(
                        0);
                Assert.assertEquals(DurationUnit.SECOND,
                        tenThousandSeconds.getUnit());
                Assert.assertEquals(10000, tenThousandSeconds.getAmount());

            }
            // VERIFY VIDEO/MPEG
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "video/mpeg");
                Assert.assertEquals(StartingPoint.LAST_MODIFICATION_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());

                Duration twentyThousandSeconds = expiresConfiguration.getDurations().get(
                        0);
                Assert.assertEquals(DurationUnit.SECOND,
                        twentyThousandSeconds.getUnit());
                Assert.assertEquals(20000, twentyThousandSeconds.getAmount());
            }
        } finally {
            tomcat.stop();
        }
    }
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.Duration

    SwiftObjectPath sobject = SwiftObjectPath.fromPath(serviceURI, path);
    byte[] stuff = new byte[1];
    stuff[0] = 'a';
    client.upload(sobject, new ByteArrayInputStream(stuff), stuff.length);
    //check file exists
    Duration head = new Duration();
    Header[] responseHeaders = client.headRequest("expect success",
                                                  sobject,
                                                  SwiftRestClient.NEWEST);
    head.finished();
    LOG.info("head request duration " + head);
    for (Header header: responseHeaders) {
      LOG.info(header.toString());
    }
    //delete the file
View Full Code Here

Examples of org.apache.ode.utils.xsd.Duration

    }

    public Duration evaluateAsDuration(OExpression cexp, EvaluationContext context) throws FaultException, EvaluationException {
        String literal = this.evaluateAsString(cexp, context);
        try {
            return new Duration(literal);
        } catch (Exception ex) {
            String errmsg = "Invalid duration: " + literal;
            __log.error(errmsg, ex);
            throw new FaultException(cexp.getOwner().constants.qnInvalidExpressionValue,errmsg);
        }
View Full Code Here

Examples of org.apache.openejb.util.Duration

    }

    public void deploy(BeanContext beanContext) throws OpenEJBException {
        Options options = new Options(beanContext.getProperties());

        Duration accessTimeout = getDuration(options, "Timeout", this.accessTimeout, TimeUnit.MILLISECONDS);
        accessTimeout = getDuration(options, "AccessTimeout", accessTimeout, TimeUnit.MILLISECONDS);
        Duration closeTimeout = getDuration(options, "CloseTimeout", this.closeTimeout, TimeUnit.MINUTES);

        final ObjectRecipe recipe = PassthroughFactory.recipe(new Pool.Builder(poolBuilder));
        recipe.allow(Option.CASE_INSENSITIVE_FACTORY);
        recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
        recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
View Full Code Here

Examples of org.apache.openjpa.persistence.event.common.apps.Duration

    protected double performAddsModifiesDeletes(EntityManager pm,
        int numObjects) {
        // Perform a series of transactions that will trigger adds,
        // deletes, and udpates
        Duration timeToAMD = new Duration(
            "Adds, removes, and dletes for " + numObjects + " objects.");
        timeToAMD.start();

        // create objects
        RuntimeTest1[] persistables = new RuntimeTest1[numObjects];
        for (int i = 0; i < persistables.length; i++) {
            persistables[i] = new RuntimeTest1("foo #" + i, i);
        }

        // add them
        for (int i = 0; i < persistables.length; i++) {
            startTx(pm);
            pm.persist(persistables[i]);
            endTx(pm);
        }

        // modify them
        startTx(pm);
        for (int i = 0; i < persistables.length; i++) {
            persistables[i].setStringField("bazzed" + i);
        }
        endTx(pm);

        // delete them
        startTx(pm);
        for (int i = 0; i < persistables.length; i++) {
            pm.remove(persistables[i]);
        }
        endTx(pm);

        timeToAMD.stop();
        return timeToAMD.getDurationAsSeconds();
    }
View Full Code Here

Examples of org.apache.slider.common.tools.Duration

    assert launchedApplication != null;
    int exitCode;
    // wait for the submit state to be reached
    ApplicationReport report = launchedApplication.monitorAppToState(
      YarnApplicationState.ACCEPTED,
      new Duration(Constants.ACCEPT_TIME));


    // may have failed, so check that
    if (SliderUtils.hasAppFinished(report)) {
      exitCode = buildExitCode(report);
    } else {
      // exit unless there is a wait
      exitCode = EXIT_SUCCESS;

      if (waittime != 0) {
        // waiting for state to change
        Duration duration = new Duration(waittime * 1000);
        duration.start();
        report = launchedApplication.monitorAppToState(
          YarnApplicationState.RUNNING, duration);
        if (report != null &&
            report.getYarnApplicationState() == YarnApplicationState.RUNNING) {
          exitCode = EXIT_SUCCESS;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.