Examples of Stock


Examples of org.jbehave.examples.core.model.Stock

    private Stock stock;
    private ExamplesTable table;

    @Given("haja uma ação com símbolo $symbol e um limite de $threshold")
    public void aStock(@Named("symbol") String symbol, @Named("threshold") double threshold) {
        stock = new Stock(symbol, threshold);
    }
View Full Code Here

Examples of org.jbehave.examples.core.model.Stock

import org.jbehave.examples.core.model.Trader;

public class TradingService {

    public Stock newStock(String symbol, double threshold) {
        return new Stock(symbol, threshold);
    }
View Full Code Here

Examples of org.jboss.arquillian.quickstart.cxf.model.Stock

     * Creates new instance of {@link StockServiceResource} class.
     */
    public StockServiceResource() {

        // creates test stock
        Stock stock = new Stock();
        stock.setId(1L);
        stock.setName("Acme");
        stock.setCode("ACM");
        stock.setValue(new BigDecimal(37.5D));
        stock.setDate(new Date());

        stockMap.put(stock.getId(), stock);
    }
View Full Code Here

Examples of org.jboss.arquillian.quickstart.jaxrs2.model.Stock

     * Creates new instance of {@link StockServiceResource} class.
     */
    public StockServiceResource() {

        // creates test stock
        Stock stock = new Stock();
        stock.setId(1L);
        stock.setName("Acme");
        stock.setCode("ACM");
        stock.setValue(new BigDecimal(37.5D));
        stock.setDate(new Date());

        stockMap.put(stock.getId(), stock);
    }
View Full Code Here

Examples of org.jboss.arquillian.quickstart.jaxrs2.model.Stock

     * {@inheritDoc}
     */
    @Override
    public void updateStock(@PathParam("id") long id, Stock stock) {

        Stock current = stockMap.get(id);
        if (current == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        // updates the stock
        current.setName(stock.getName());
        current.setCode(stock.getCode());
        current.setDate(stock.getDate());
        current.setValue(stock.getValue());
    }
View Full Code Here

Examples of org.jboss.arquillian.quickstart.jaxrs2.model.Stock

     * {@inheritDoc}
     */
    @Override
    public Stock getStock(@PathParam("id") long id) {

        Stock stock = stockMap.get(id);
        if (stock == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        return stock;
View Full Code Here

Examples of org.jboss.arquillian.quickstart.jersey.model.Stock

     * Creates new instance of {@link StockServiceResource} class.
     */
    public StockServiceResource() {

        // creates test stock
        Stock stock = new Stock();
        stock.setId(1L);
        stock.setName("Acme");
        stock.setCode("ACM");
        stock.setValue(new BigDecimal(37.5D));
        stock.setDate(new Date());

        stockMap.put(stock.getId(), stock);
    }
View Full Code Here

Examples of org.jboss.arquillian.quickstart.resteasy.model.Stock

     * {@inheritDoc}
     */
    @Override
    public Stock getStock(@PathParam("id") long id) {

        Stock stock = stockMap.get(id);
        if (stock == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        return stock;
View Full Code Here

Examples of org.jquantlib.instruments.Stock

        final double iniPrice = 3.56;
        final double newPrice = iniPrice*1.0214; // changed +2.14%

        // define Stock
        final RelinkableHandle<Quote> h = new RelinkableHandle<Quote>(new SimpleQuote(iniPrice));
        final Instrument s = new Stock(h);

        // attach an Observer to Stock
        final Flag priceChange = new Flag();
        s.addObserver(priceChange);

        // verify initial price
        if (iniPrice != s.NPV()) {
            fail("stock quote valuation failed");
        }

        // set a new price
        h.linkTo(new SimpleQuote(newPrice));

        // Observer must detect price change
        if (!priceChange.isUp()) {
            fail("Observer was not notified of instrument change");
        }

        if (newPrice != s.NPV()) {
            fail("stock quote havent changed value");
        }

    }
View Full Code Here

Examples of org.jquantlib.instruments.Stock

        QL.info("Testing observability of instruments...");


        final SimpleQuote me1 = new SimpleQuote(0.0);
        final RelinkableHandle<Quote>  h = new RelinkableHandle<Quote>(me1);
        final Instrument s = new Stock(h);

        final Flag f = new Flag();
        s.addObserver(f); //f.registerWith(s);

        s.NPV();
        me1.setValue(3.14);
        if (!f.isUp()) {
            fail("Observer was not notified of instrument change");
        }

        s.NPV();
        f.lower();
        final SimpleQuote me2 = new SimpleQuote(0.0);

        h.linkTo(me2);
        if (!f.isUp()) {
            fail("Observer was not notified of instrument change");
        }

        f.lower();
        s.freeze();
        s.NPV();
        me2.setValue(2.71);
        if (f.isUp()) {
            fail("Observer was notified of frozen instrument change");
        }

        s.NPV();
        s.unfreeze();
        if (!f.isUp()) {
            fail("Observer was not notified of instrument change");
        }
    }
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.