Search in sources :

Example 11 with Bookmark

use of name.abuchen.portfolio.model.Bookmark in project portfolio by buchen.

the class BookmarkTest method testDuplicateKeyReplacement.

@Test
public void testDuplicateKeyReplacement() {
    Bookmark page = new Bookmark("", "https://www.flatex.de/suche/?q={isin}&isin={isin}");
    Security security = new Security("Daimler", "DE0007100000", "", YahooFinanceQuoteFeed.ID);
    security.setWkn("12345");
    assertThat(page.constructURL(new Client(), security), equalTo("https://www.flatex.de/suche/?q=DE0007100000&isin=DE0007100000"));
}
Also used : Bookmark(name.abuchen.portfolio.model.Bookmark) Security(name.abuchen.portfolio.model.Security) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Example 12 with Bookmark

use of name.abuchen.portfolio.model.Bookmark in project portfolio by buchen.

the class BookmarkTest method testSuffixIsAppended.

@Test
public void testSuffixIsAppended() {
    Bookmark page = new Bookmark("", "https://www.flatex.de/suche/?q={wkn}&isin={isin}XXX");
    Security security = new Security("Daimler", "DE0007100000", "", YahooFinanceQuoteFeed.ID);
    security.setWkn("12345");
    assertThat(page.constructURL(new Client(), security), equalTo("https://www.flatex.de/suche/?q=12345&isin=DE0007100000XXX"));
}
Also used : Bookmark(name.abuchen.portfolio.model.Bookmark) Security(name.abuchen.portfolio.model.Security) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Example 13 with Bookmark

use of name.abuchen.portfolio.model.Bookmark in project portfolio by buchen.

the class BookmarkTest method testCustomAttributes.

@Test
public void testCustomAttributes() {
    AttributeType attribute = new AttributeType(UUID.randomUUID().toString());
    attribute.setType(String.class);
    attribute.setName("CUSIP Number");
    attribute.setColumnLabel("CUSIP");
    attribute.setConverter(AttributeType.StringConverter.class);
    attribute.setTarget(Security.class);
    Client client = new Client();
    client.getSettings().addAttributeType(attribute);
    Bookmark page = new Bookmark("", "https://www.flatex.de/suche/{CUSIP}");
    Security security = new Security("Daimler", "DE0007100000", "DAI.DE", YahooFinanceQuoteFeed.ID);
    security.getAttributes().put(attribute, "D1668R123");
    assertThat(page.constructURL(client, security), equalTo("https://www.flatex.de/suche/D1668R123"));
}
Also used : Bookmark(name.abuchen.portfolio.model.Bookmark) AttributeType(name.abuchen.portfolio.model.AttributeType) Client(name.abuchen.portfolio.model.Client) Security(name.abuchen.portfolio.model.Security) Test(org.junit.Test)

Aggregations

Bookmark (name.abuchen.portfolio.model.Bookmark)13 Client (name.abuchen.portfolio.model.Client)10 Security (name.abuchen.portfolio.model.Security)10 Test (org.junit.Test)8 Separator (org.eclipse.jface.action.Separator)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 List (java.util.List)2 ClientSettings (name.abuchen.portfolio.model.ClientSettings)2 Messages (name.abuchen.portfolio.ui.Messages)2 DesktopAPI (name.abuchen.portfolio.ui.util.DesktopAPI)2 SimpleAction (name.abuchen.portfolio.ui.util.SimpleAction)2 Action (org.eclipse.jface.action.Action)2 MenuManager (org.eclipse.jface.action.MenuManager)2 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 SWT (org.eclipse.swt.SWT)2 Composite (org.eclipse.swt.widgets.Composite)2 Shell (org.eclipse.swt.widgets.Shell)2