bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public FileListTransferable(Object[] files) { fileList = new ArrayList(Arrays.asList(files)); }
public FileListTransferable(Object[] files) { fileList = new ArrayList(Arrays.asList(files)); }
1,121,044
public void dragGestureRecognized(DragGestureEvent event) { Object[] selectedValues = getSelectionModel().getSelections(); if (event.getDragAction() == DnDConstants.ACTION_COPY && selectedValues != null) { List<File> draggedValues = getSelectedFiles(); if (draggedValues != null) { Transferable transferable = new FileListTransferable( draggedValues.toArray()); event.startDrag(null, transferable); } } }
public void dragGestureRecognized(DragGestureEvent event) { Object[] selectedValues = getSelectionModel().getSelections(); if (event.getDragAction() == DnDConstants.ACTION_COPY && selectedValues != null) { List<File> draggedValues = getSelectedFiles(); if (draggedValues != null) { Transferable transferable = new FileListTransferable( directoryTable.getDirectory(), draggedValues.toArray()); event.startDrag(null, transferable); } } }
1,121,046
public boolean amIDragSource(DropTargetDragEvent dtde) { Transferable trans = dtde.getTransferable(); try { List<File> fileList = (List<File>) trans .getTransferData(DataFlavor.javaFileListFlavor); List<File> selectedFiles = getSelectedFiles(); if (selectedFiles != null && fileList.size() == selectedFiles.size()) { // if the filelist is the same as the currently selected // one we assume we are the source of this drag and drop // and we will reject this. if (selectedFiles.containsAll(fileList)) { return true; } } // check all files against the Directory // if the exact same files already exists we are the drag source for (File file : fileList) { if (directoryTable.getDirectory().alreadyHasFileOnDisk(file)) { return true; } } return false; } catch (UnsupportedFlavorException ufe) { throw new IllegalStateException(ufe); } catch (IOException e) { throw new IllegalStateException(e); } }
public boolean amIDragSource(DropTargetDragEvent dtde) { Transferable trans = dtde.getTransferable(); try { List<File> fileList = (List<File>) trans .getTransferData(DataFlavor.javaFileListFlavor); List<File> selectedFiles = getSelectedFiles(); if (selectedFiles != null && fileList.size() == selectedFiles.size()) { // if the filelist is the same as the currently selected // one we assume we are the source of this drag and drop // and we will reject this. if (selectedFiles.containsAll(fileList)) { return true; } } // check all files against the Directory // if the exact same files already exists we are the drag source for (File file : fileList) { if (directoryTable.getDirectory().alreadyHasFileOnDisk(file)) { return true; } } return false; } catch (UnsupportedFlavorException ufe) { throw new IllegalStateException(ufe); } catch (IOException e) { throw new IllegalStateException(e); } }
1,121,047
private JComponent createFileDetailsPanel() { FileDetailsPanel fileDetailsPanel = new FileDetailsPanel( getController(), selectionModel); Preferences pref = getController().getPreferences(); // check property to enable preview // preview of images is memory hungry // may cause OutOfMemoryErrors if (PreferencesEntry.CONFIG_SHOW_PREVIEW_PANEL.getValueBoolean(getController())) { PreviewPanel previewPanel = new PreviewPanel(getController(), selectionModel, this); FormLayout layout = new FormLayout("pref, fill:pref:grow", "3dlu, pref, fill:pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.addSeparator(null, cc.xy(1, 2)); builder.add(fileDetailsPanel.getEmbeddedPanel(), cc.xy(1, 3)); builder.add(previewPanel.getUIComponent(), cc.xy(2, 3)); builder.addSeparator(null, cc.xy(1, 4)); return builder.getPanel(); } FormLayout layout = new FormLayout("fill:pref:grow", "3dlu, pref, fill:pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.addSeparator(null, cc.xy(1, 2)); builder.add(fileDetailsPanel.getEmbeddedPanel(), cc.xy(1, 3)); builder.addSeparator(null, cc.xy(1, 4)); return builder.getPanel(); }
private JComponent createFileDetailsPanel() { FileDetailsPanel fileDetailsPanel = new FileDetailsPanel( getController(), selectionModel); // check property to enable preview // preview of images is memory hungry // may cause OutOfMemoryErrors if (PreferencesEntry.CONFIG_SHOW_PREVIEW_PANEL.getValueBoolean(getController())) { PreviewPanel previewPanel = new PreviewPanel(getController(), selectionModel, this); FormLayout layout = new FormLayout("pref, fill:pref:grow", "3dlu, pref, fill:pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.addSeparator(null, cc.xy(1, 2)); builder.add(fileDetailsPanel.getEmbeddedPanel(), cc.xy(1, 3)); builder.add(previewPanel.getUIComponent(), cc.xy(2, 3)); builder.addSeparator(null, cc.xy(1, 4)); return builder.getPanel(); } FormLayout layout = new FormLayout("fill:pref:grow", "3dlu, pref, fill:pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.addSeparator(null, cc.xy(1, 2)); builder.add(fileDetailsPanel.getEmbeddedPanel(), cc.xy(1, 3)); builder.addSeparator(null, cc.xy(1, 4)); return builder.getPanel(); }
1,121,048
public void actionPerformed(ActionEvent e) { Object target = getUIController().getInformationQuarter() .getDisplayTarget(); final Folder folder; if (target instanceof Directory) { folder = ((Directory) target).getRootFolder(); } else if (target instanceof Folder) { folder = (Folder) target; } else { log().warn("Unable to remove files on target: " + target); return; } Object[] selections = getSelectionModel().getSelections(); if (selections != null && selections.length > 0) { final List toRemove = new ArrayList(selections.length); for (int i = 0; i < selections.length; i++) { if (selections[i] instanceof FileInfo) { toRemove.add(selections[i]); } else if (selections[i] instanceof Directory) { toRemove.add(selections[i]); } else { log().debug( "cannot remove: " + selections[i].getClass().getName()); return; } } boolean containsDirectory = false; String fileListText = ""; for (int i = 0; i < toRemove.size(); i++) { Object object = toRemove.get(i); if (object instanceof FileInfo) { FileInfo fileInfo = (FileInfo) object; fileListText += fileInfo.getFilenameOnly() + "\n"; } else if (object instanceof Directory) { containsDirectory = true; Directory directory = (Directory) object; fileListText += directory.getName() + " " + Translation .getTranslation("delete_confimation.text_movetorecyclebin_DIR") + "\n"; } } String warningText; if (containsDirectory) { warningText = Translation .getTranslation("delete_confimation.text_movetorecyclebin_directory"); } else { warningText = Translation .getTranslation("delete_confimation.text_movetorecyclebin"); } int choice = DialogFactory.showScrollableOkCancelDialog( getController(), true, // modal true, // border Translation.getTranslation("delete_confimation.title"), warningText, fileListText, Icons.DELETE); if (choice == JOptionPane.OK_OPTION) { // TODO Use activiy visualizationworker SwingWorker worker = new SwingWorker() { @Override public Object construct() { boolean dirRemoved = false; List<FileInfo> filesToRemove = new ArrayList(); for (Object object : toRemove) { if (object instanceof FileInfo) { filesToRemove.add((FileInfo) object); } else if (object instanceof Directory) { Directory directoryToRemove = (Directory) object; if (!moveToRecycleBin(directoryToRemove)) { log().error( "move to recyclebin failed for:" + directoryToRemove); } dirRemoved = true; } } FileInfo[] filesToRemoveArray = new FileInfo[filesToRemove .size()]; filesToRemoveArray = filesToRemove .toArray(filesToRemoveArray); if (filesToRemoveArray.length > 0) { folder.removeFilesLocal(filesToRemoveArray); } if (dirRemoved) { // TODO Schaatser please check this folder.maintain(); } return null; } }; // Use swingworker to execute deletion in background worker.start(); } } }
public void actionPerformed(ActionEvent e) { Object target = getUIController().getInformationQuarter() .getDisplayTarget(); final Folder folder; if (target instanceof Directory) { folder = ((Directory) target).getRootFolder(); } else if (target instanceof Folder) { folder = (Folder) target; } else { log().warn("Unable to remove files on target: " + target); return; } Object[] selections = getSelectionModel().getSelections(); if (selections != null && selections.length > 0) { final List toRemove = new ArrayList(selections.length); for (int i = 0; i < selections.length; i++) { if (selections[i] instanceof FileInfo) { toRemove.add(selections[i]); } else if (selections[i] instanceof Directory) { toRemove.add(selections[i]); } else { log().debug( "cannot remove: " + selections[i].getClass().getName()); return; } } boolean containsDirectory = false; String fileListText = ""; for (int i = 0; i < toRemove.size(); i++) { Object object = toRemove.get(i); if (object instanceof FileInfo) { FileInfo fileInfo = (FileInfo) object; fileListText += fileInfo.getFilenameOnly() + "\n"; } else if (object instanceof Directory) { containsDirectory = true; Directory directory = (Directory) object; fileListText += directory.getName() + " " + Translation .getTranslation("delete_confimation.text_movetorecyclebin_DIR") + "\n"; } } String warningText; if (containsDirectory) { warningText = Translation .getTranslation("delete_confimation.text_movetorecyclebin_directory"); } else { warningText = Translation .getTranslation("delete_confimation.text_movetorecyclebin"); } int choice = DialogFactory.showScrollableOkCancelDialog( getController(), true, // modal true, // border Translation.getTranslation("delete_confimation.title"), warningText, fileListText, Icons.DELETE); if (choice == JOptionPane.OK_OPTION) { // TODO Use activiy visualizationworker SwingWorker worker = new SwingWorker() { @Override public Object construct() { boolean dirRemoved = false; List<FileInfo> filesToRemove = new ArrayList<FileInfo>(); for (Object object : toRemove) { if (object instanceof FileInfo) { filesToRemove.add((FileInfo) object); } else if (object instanceof Directory) { Directory directoryToRemove = (Directory) object; if (!moveToRecycleBin(directoryToRemove)) { log().error( "move to recyclebin failed for:" + directoryToRemove); } dirRemoved = true; } } FileInfo[] filesToRemoveArray = new FileInfo[filesToRemove .size()]; filesToRemoveArray = filesToRemove .toArray(filesToRemoveArray); if (filesToRemoveArray.length > 0) { folder.removeFilesLocal(filesToRemoveArray); } if (dirRemoved) { // TODO Schaatser please check this folder.maintain(); } return null; } }; // Use swingworker to execute deletion in background worker.start(); } } }
1,121,049
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
1,121,050
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
1,121,051
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
1,121,052
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
1,121,053
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
1,121,054
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
public boolean sortBy(int columnIndex) { switch (columnIndex) { case 0 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_FILETYPE), true); case 1 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_NAME), true); case 2 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_SIZE), true); case 3 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MEMBER), true); case 4 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_MODIFIED_DATE), true); case 5 : return sortBy(FileInfoComparator .getComparator(FileInfoComparator.BY_AVAILABILITY), true); } return false; }
1,121,055
public ISelection getSelection() { Control control = getControl(); if (control == null || control.isDisposed()) { return TreeSelection.EMPTY; } Widget[] items = getSelection(getControl()); ArrayList list = new ArrayList(items.length); for (int i = 0; i < items.length; i++) { Widget item = items[i]; if (item.getData() != null) { list.add(getTreePathFromItem((Item) item)); } } return new TreeSelection((TreePath[]) list.toArray(new TreePath[list .size()])); }
public ISelection getSelection() { Control control = getControl(); if (control == null || control.isDisposed()) { return TreeSelection.EMPTY; } Widget[] items = getSelection(getControl()); ArrayList list = new ArrayList(items.length); for (int i = 0; i < items.length; i++) { Widget item = items[i]; if (item.getData() != null) { list.add(getTreePathFromItem((Item) item)); } } return new TreeSelection((TreePath[]) list.toArray(new TreePath[list .size()])); }
1,121,056
public WorkbenchPreferenceExtensionNode(String id, IPreferencePage preferencePage) { super(id, preferencePage); }
public WorkbenchPreferenceExtensionNode(String id, IPreferencePage preferencePage) { super(id, preferencePage); }
1,121,057
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
private void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
1,121,058
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); boolean connected = member2atCon1 != null && member1atCon2 != null && member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected(); if (connected) { return; } int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
1,121,059
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
1,121,060
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
1,121,061
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
protected void connect(Controller cont1, Controller cont2) throws InterruptedException, ConnectionException { Reject.ifTrue(!cont1.isStarted(), "Controller1 not started yet"); Reject.ifTrue(!cont2.isStarted(), "Controller2 not started yet"); // Connect System.out.println("Connecting controllers..."); System.out.println("Con to: " + cont2.getConnectionListener().getLocalAddress()); boolean connected = false; int i = 0; do { if (i % 10 == 0) { cont1.connect(cont2.getConnectionListener().getLocalAddress()); } Member member2atCon1 = cont1.getNodeManager().getNode( cont2.getMySelf().getId()); Member member1atCon2 = cont2.getNodeManager().getNode( cont1.getMySelf().getId()); if (member2atCon1 != null && member1atCon2 != null) { if (member2atCon1.isCompleteyConnected() && member1atCon2.isCompleteyConnected()) { break; } } i++; // Member testNode1 = cont1.getMySelf().getInfo().getNode(cont2); // connected = testNode1 != null && // testNode1.isCompleteyConnected(); Thread.sleep(100); if (i > 50) { fail("Unable to connect nodes"); } } while (!connected); System.out.println("Both Controller connected"); }
1,121,062
public Member getNode(String id) { if (id == null) { return null; } if (mySelf.getId().equals(id)) { return mySelf; } return (Member) knownNodes.get(id); }
public Member getNode(String id) { if (id == null) { return null; } if (mySelf.getId().equals(id)) { return mySelf; } return (Member) knownNodes.get(id); }
1,121,063
public Member getNode(String id) { if (id == null) { return null; } if (mySelf.getId().equals(id)) { return mySelf; } return (Member) knownNodes.get(id); }
public Member getNode(String id) { if (id == null) { return null; } if (mySelf.getId().equals(id)) { return mySelf; } return (Member) knownNodes.get(id); }
1,121,064
public static void cleanTestDir() { File testDir = getTestDir(); File[] files = testDir.listFiles(); if (files == null) { return; } System.out.println("Cleaning test dir (" + files.length + " files/dirs)"); for (File file : files) { try { if (file.isDirectory()) { FileUtils.deleteDirectory(file); } else if (file.isFile()) { FileUtils.forceDelete(file); } } catch (IOException e) { // log().error(e); } } }
public static void cleanTestDir() { File testDir = getTestDir(); File[] files = testDir.listFiles(); if (files == null) { return; } System.out.println("Cleaning test dir ("+ testDir + ") (" + files.length + " files/dirs)"); for (File file : files) { try { if (file.isDirectory()) { FileUtils.deleteDirectory(file); } else if (file.isFile()) { FileUtils.forceDelete(file); } } catch (IOException e) { // log().error(e); } } }
1,121,065
public static int len(Context c, InlineTextBox box) { return (int) Math.ceil(c.getTextRenderer().getLogicalBounds(c.getGraphics(), c.getCurrentFont(), box.getSubstring()).getWidth()); }
public static int len(Context c, InlineTextBox box) { return (int) Math.ceil(c.getTextRenderer().getLogicalBounds(c.getGraphics(), c.getCurrentFont(), box.getSubstring()).getWidth()); }
1,121,067
private void convertAndSend(Message fixMessage) { jmsOperations.convertAndSend(fixMessage); }
private void convertAndSend(Message fixMessage) { if (jmsOperations != null){ jmsOperations.convertAndSend(fixMessage); } else { internalMainLogger.error("Could not send message, not connected"); } }
1,121,068
public static void fillFieldsFromExistingMessage(Message outgoingMessage, Message existingMessage) { try { String msgType = outgoingMessage.getHeader().getString(MsgType.FIELD); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); for (int fieldInt = 1; fieldInt < 2000; fieldInt++){ if (dict.isRequiredField(msgType, fieldInt) && existingMessage.isSetField(fieldInt) && !outgoingMessage.isSetField(fieldInt)){ try { outgoingMessage.setField(existingMessage.getField(new StringField(fieldInt))); } catch (FieldNotFound e) { // do nothing and ignore } } } } catch (FieldNotFound ex) { LoggerAdapter.error("Outgoing message did not have valid MsgType ", ex, LOGGER_NAME); } }
public static void fillFieldsFromExistingMessage(Message outgoingMessage, Message existingMessage) { try { String msgType = outgoingMessage.getHeader().getString(MsgType.FIELD); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); for (int fieldInt = 1; fieldInt < MAX_FIX_FIELDS; fieldInt++){ if (dict.isRequiredField(msgType, fieldInt) && existingMessage.isSetField(fieldInt) && !outgoingMessage.isSetField(fieldInt)){ try { outgoingMessage.setField(existingMessage.getField(new StringField(fieldInt))); } catch (FieldNotFound e) { // do nothing and ignore } } } } catch (FieldNotFound ex) { LoggerAdapter.error("Outgoing message did not have valid MsgType ", ex, LOGGER_NAME); } }
1,121,069
public static void fillFieldsFromExistingMessage(Message outgoingMessage, Message existingMessage) { try { String msgType = outgoingMessage.getHeader().getString(MsgType.FIELD); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); for (int fieldInt = 1; fieldInt < 2000; fieldInt++){ if (dict.isRequiredField(msgType, fieldInt) && existingMessage.isSetField(fieldInt) && !outgoingMessage.isSetField(fieldInt)){ try { outgoingMessage.setField(existingMessage.getField(new StringField(fieldInt))); } catch (FieldNotFound e) { // do nothing and ignore } } } } catch (FieldNotFound ex) { LoggerAdapter.error("Outgoing message did not have valid MsgType ", ex, LOGGER_NAME); } }
public static void fillFieldsFromExistingMessage(Message outgoingMessage, Message existingMessage) { try { String msgType = outgoingMessage.getHeader().getString(MsgType.FIELD); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); for (int fieldInt = 1; fieldInt < 2000; fieldInt++){ if (dict.isRequiredField(msgType, fieldInt) && existingMessage.isSetField(fieldInt) && !outgoingMessage.isSetField(fieldInt)){ try { outgoingMessage.setField(existingMessage.getField(new StringField(fieldInt))); } catch (FieldNotFound e) { // do nothing and ignore } } } } catch (FieldNotFound ex) { LoggerAdapter.error(MessageKey.FIX_OUTGOING_NO_MSGTYPE.getLocalizedMessage(), ex, LOGGER_NAME); } }
1,121,070
public String getLoggerName() { String remoteInfo; if (socket != null) { InetSocketAddress addr = (InetSocketAddress) socket .getRemoteSocketAddress(); remoteInfo = addr.getAddress().getHostAddress() + "^" + addr.getPort(); } else { remoteInfo = "<unknown>"; } return "ConnectionHander " + remoteInfo; }
public String getLoggerName() { String remoteInfo; if (socket != null) { InetSocketAddress addr = (InetSocketAddress) socket .getRemoteSocketAddress(); remoteInfo = addr.getAddress().getHostAddress() + "^" + addr.getPort(); } else { remoteInfo = "<unknown>"; } return "ConnectionHandler " + remoteInfo; }
1,121,071
public Object deserialize(InputStream in, int expectedSize, boolean expectCompression) throws IOException, ClassNotFoundException { byte[] byteIn = null; if (inBufferRef != null && inBufferRef.get() != null) { // Re-use old buffer byteIn = (byte[]) inBufferRef.get(); } if (expectedSize > MAX_BUFFER_SIZE) { LOG.error("Max buffersize overflow while reading. expected size " + expectedSize); return null; } // Check buffer if (byteIn == null || byteIn.length < expectedSize) { if (LOG.isVerbose()) LOG.verbose("Extending receive buffer (" + Format.formatBytes(expectedSize) + ")"); byteIn = new byte[expectedSize]; if (byteIn.length >= 128 * 1024) { LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length)); } // Chache buffer inBufferRef = new SoftReference(byteIn); } // Read into receivebuffer read(in, byteIn, expectedSize); // Deserialize return deserializeStatic(byteIn, expectCompression); }
public Object deserialize(InputStream in, int expectedSize, boolean expectCompression) throws IOException, ClassNotFoundException { byte[] byteIn = null; if (inBufferRef != null && inBufferRef.get() != null) { // Re-use old buffer byteIn = (byte[]) inBufferRef.get(); } if (expectedSize > MAX_BUFFER_SIZE) { LOG.error("Max buffersize overflow while reading. expected size " + expectedSize); return null; } // Check buffer if (byteIn == null || byteIn.length < expectedSize) { if (LOG.isVerbose()) LOG.verbose("Extending receive buffer (" + Format.formatBytes(expectedSize) + ")"); byteIn = new byte[expectedSize]; if (byteIn.length >= 128 * 1024) { LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length)); } // Chache buffer inBufferRef = new SoftReference(byteIn); } // Read into receivebuffer read(in, byteIn, expectedSize); // Deserialize return deserializeStatic(byteIn, expectCompression); }
1,121,072
public Object deserialize(InputStream in, int expectedSize, boolean expectCompression) throws IOException, ClassNotFoundException { byte[] byteIn = null; if (inBufferRef != null && inBufferRef.get() != null) { // Re-use old buffer byteIn = (byte[]) inBufferRef.get(); } if (expectedSize > MAX_BUFFER_SIZE) { LOG.error("Max buffersize overflow while reading. expected size " + expectedSize); return null; } // Check buffer if (byteIn == null || byteIn.length < expectedSize) { if (LOG.isVerbose()) LOG.verbose("Extending receive buffer (" + Format.formatBytes(expectedSize) + ")"); byteIn = new byte[expectedSize]; if (byteIn.length >= 128 * 1024) { LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length)); } // Chache buffer inBufferRef = new SoftReference(byteIn); } // Read into receivebuffer read(in, byteIn, expectedSize); // Deserialize return deserializeStatic(byteIn, expectCompression); }
public Object deserialize(InputStream in, int expectedSize, boolean expectCompression) throws IOException, ClassNotFoundException { byte[] byteIn = null; if (inBufferRef != null && inBufferRef.get() != null) { // Re-use old buffer byteIn = (byte[]) inBufferRef.get(); } if (expectedSize > MAX_BUFFER_SIZE) { LOG.error("Max buffersize overflow while reading. expected size " + expectedSize); return null; } // Check buffer if (byteIn == null || byteIn.length < expectedSize) { if (LOG.isVerbose()) LOG.verbose("Extending receive buffer (" + Format.formatBytes(expectedSize) + ")"); byteIn = new byte[expectedSize]; if (byteIn.length >= 128 * 1024) { LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length)); } // Chache buffer inBufferRef = new SoftReference(byteIn); } // Read into receivebuffer read(in, byteIn, expectedSize); // Deserialize Object obj = deserializeStatic(byteIn, expectCompression); if (bufferExceeded) { LOG.warn("Recived buffer exceeds 128KB! " + Format.formatBytes(byteIn.length) + ". Message: " + obj); } return obj; }
1,121,073
public static boolean isOnLanOrLoopback(InetAddress addr) { Reject.ifNull(addr, "Address is null"); return addr.isLoopbackAddress() || addr.isSiteLocalAddress(); }
public static boolean isOnLanOrLoopback(InetAddress addr) { Reject.ifNull(addr, "Address is null"); try { return addr.isLoopbackAddress() || addr.isSiteLocalAddress() || getAllLocalNetworkAddresses().containsKey(addr); } catch (SocketException e) { return false; } }
1,121,074
protected void clear(){ Control[] children = form.getBody().getChildren(); for (Control control : children) { if (control instanceof FIXComposite) { FIXComposite composite = (FIXComposite) control; composite.clear(); } } }
protected void clear(){ Control[] children = form.getBody().getChildren(); for (Control control : children) { if (control instanceof FIXComposite) { FIXComposite composite = (FIXComposite) control; composite.clear(); } } }
1,121,075
public void createPartControl(Composite parent) { toolkit = new FormToolkit(parent.getDisplay()); form = toolkit.createForm(parent); // form.setText("Stock Order Ticket"); GridLayout layout = new GridLayout(); form.getBody().setLayout(layout); // FIXDataDictionaryManager.loadDictionary(FIXDataDictionaryManager.FIX_4_2_BEGIN_STRING); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); buySellControl = new FIXEnumeratedComposite(form.getBody(), SWT.NONE, toolkit, Side.FIELD, new String[] { "" + Side.BUY, "" + Side.SELL, "" + Side.SELL_SHORT, "" + Side.SELL_SHORT_EXEMPT }); orderQtyControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, OrderQty.FIELD); toolkit.paintBordersFor(orderQtyControl); symbolControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Symbol.FIELD); toolkit.paintBordersFor(symbolControl); priceControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Price.FIELD); toolkit.paintBordersFor(priceControl); timeInForceControl = new FIXEnumeratedComposite(form.getBody(), SWT.NONE, toolkit, TimeInForce.FIELD, new String[] { "" + TimeInForce.DAY, "" + TimeInForce.GOOD_TILL_CANCEL, "" + TimeInForce.FILL_OR_KILL, "" + TimeInForce.IMMEDIATE_OR_CANCEL }); timeInForceControl.setSelection("" + TimeInForce.DAY, true); accountControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Account.FIELD); toolkit.paintBordersFor(accountControl); Composite okCancelComposite = toolkit.createComposite(form.getBody()); okCancelComposite.setLayout(new RowLayout(SWT.HORIZONTAL)); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END); okCancelComposite.setLayoutData(gd); sendButton = toolkit.createButton(okCancelComposite, "Send", SWT.PUSH); cancelButton = toolkit.createButton(okCancelComposite, "Cancel", SWT.PUSH); cancelButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { handleCancel(); } }); sendButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { handleSend(); } }); Listener formValidationListener = new Listener() { public void handleEvent(Event event) { validateForm(); } }; buySellControl.addSelectionListener(formValidationListener); orderQtyControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); symbolControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); priceControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); timeInForceControl.addSelectionListener(formValidationListener); validateForm(); }
public void createPartControl(Composite parent) { toolkit = new FormToolkit(parent.getDisplay()); form = toolkit.createForm(parent); // form.setText("Stock Order Ticket"); GridLayout layout = new GridLayout(); form.getBody().setLayout(layout); // FIXDataDictionaryManager.loadDictionary(FIXDataDictionaryManager.FIX_4_2_BEGIN_STRING); DataDictionary dict = FIXDataDictionaryManager.getDictionary(); buySellControl = new FIXEnumeratedComposite(form.getBody(), SWT.NONE, toolkit, Side.FIELD, new String[] { "" + Side.BUY, "" + Side.SELL, "" + Side.SELL_SHORT, "" + Side.SELL_SHORT_EXEMPT }); orderQtyControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, OrderQty.FIELD); toolkit.paintBordersFor(orderQtyControl); symbolControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Symbol.FIELD); toolkit.paintBordersFor(symbolControl); priceControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Price.FIELD); toolkit.paintBordersFor(priceControl); timeInForceControl = new FIXEnumeratedComposite(form.getBody(), SWT.NONE, toolkit, TimeInForce.FIELD, new String[] { "" + TimeInForce.DAY, "" + TimeInForce.GOOD_TILL_CANCEL, "" + TimeInForce.FILL_OR_KILL, "" + TimeInForce.IMMEDIATE_OR_CANCEL }); timeInForceControl.setSelection("" + TimeInForce.DAY, true); accountControl = new FIXStringComposite(form.getBody(), SWT.NONE, toolkit, Account.FIELD); toolkit.paintBordersFor(accountControl); Composite okCancelComposite = toolkit.createComposite(form.getBody()); okCancelComposite.setLayout(new RowLayout(SWT.HORIZONTAL)); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END); okCancelComposite.setLayoutData(gd); sendButton = toolkit.createButton(okCancelComposite, "Send", SWT.PUSH); cancelButton = toolkit.createButton(okCancelComposite, "Cancel", SWT.PUSH); cancelButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { handleCancel(); } }); sendButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { handleSend(); } }); Listener formValidationListener = new Listener() { public void handleEvent(Event event) { validateForm(); } }; buySellControl.addSelectionListener(formValidationListener); orderQtyControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); symbolControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); priceControl.getTextControl().addListener(SWT.KeyUp, formValidationListener); timeInForceControl.addSelectionListener(formValidationListener); validateForm(); }
1,121,076
public void mouseUp(MouseEvent e) { handleCancel(); }
public void mouseUp(MouseEvent e) { handleSend(); }
1,121,077
protected void handleCancel() { clear(); validateForm(); }
protected void handleCancel() { clear(); }
1,121,078
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
protected void handleSend() { try { validator.validateAll(); String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
1,121,079
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
1,121,080
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order", e); } }
protected void handleSend() { try { String orderID = Application.getIDFactory().getNext(); Message aMessage = FIXMessageUtil.newLimitOrder(new InternalID(orderID), Side.BUY, BigDecimal.ZERO, new MSymbol(""), BigDecimal.ZERO, TimeInForce.DAY, null); aMessage.removeField(Side.FIELD); aMessage.removeField(OrderQty.FIELD); aMessage.removeField(Symbol.FIELD); aMessage.removeField(Price.FIELD); aMessage.removeField(TimeInForce.FIELD); populateMessageFromUI(aMessage); Application.getOrderManager().handleInternalMessage(aMessage); //clear(); } catch (Exception e) { Application.getMainConsoleLogger().error("Error sending order: "+e.getMessage(), e); } }
1,121,082
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); i++; } }
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); i++; } }
1,121,083
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); i++; } }
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); i++; } }
1,121,084
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); i++; } }
public FIXEnumeratedComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber, DataDictionary dict, String[] valuesToDisplay) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, dict.getFieldName(fixFieldNumber) + ": "); buttons = new Button[valuesToDisplay.length]; Composite buttonComposite = toolkit.createComposite(this); buttonComposite.setLayout(new RowLayout(SWT.VERTICAL)); int i = 0; for (String string : valuesToDisplay) { buttons[i] = toolkit.createButton(buttonComposite, dict .getValueName(fixFieldNumber, valuesToDisplay[i]), SWT.RADIO); buttons[i].setData(new StringField(fixFieldNumber, valuesToDisplay[i])); } }
1,121,085
public FIXStringComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); toolkit.createLabel(this, FIXDataDictionaryManager.getHumanFieldName(fixFieldNumber)+": "); textField = toolkit.createText(this, ""); }
public FIXStringComposite(Composite parent, int style, FormToolkit toolkit, int fixFieldNumber) { super(parent, style, toolkit, fixFieldNumber); this.setLayout(new RowLayout(SWT.HORIZONTAL)); label = toolkit.createLabel(this, FIXDataDictionaryManager.getHumanFieldName(fixFieldNumber)+": "); textField = toolkit.createText(this, ""); }
1,121,086
public InternalID(String internalID) { if (internalID == null) throw new IllegalArgumentException("ID must not be null"); mID = internalID; }
public InternalID(String internalID) { if (internalID == null) throw new IllegalArgumentException(MessageKey.ERROR_NULL_ID.getLocalizedMessage()); mID = internalID; }
1,121,087
public void handleInternalMessage(Message aMessage) throws FieldNotFound, MarketceteraException, JMSException { fireOrderActionOccurred(aMessage); if (FIXMessageUtil.isOrderSingle(aMessage)) { addNewOrder(aMessage); } else if (FIXMessageUtil.isCancelRequest(aMessage)) { cancelOneOrder(aMessage); } else if (FIXMessageUtil.isCancelReplaceRequest(aMessage)) { cancelReplaceOneOrder(aMessage); } else if (FIXMessageUtil.isCancelRequest(aMessage)) { cancelOneOrder(aMessage); } }
public void handleInternalMessage(Message aMessage) throws FieldNotFound, MarketceteraException, JMSException { fireOrderActionOccurred(aMessage); if (FIXMessageUtil.isOrderSingle(aMessage)) { addNewOrder(aMessage); } else if (FIXMessageUtil.isCancelRequest(aMessage)) { cancelOneOrder(aMessage); } else if (FIXMessageUtil.isCancelReplaceRequest(aMessage)) { cancelReplaceOneOrder(aMessage); } else if (FIXMessageUtil.isCancelRequest(aMessage)) { cancelOneOrder(aMessage); } }
1,121,088
public ActionDescriptor(IConfigurationElement actionElement, int targetType, Object target) { // Load attributes. id = actionElement.getAttribute(ATT_ID); pluginId = actionElement.getDeclaringExtension().getNamespace(); String label = actionElement.getAttribute(ATT_LABEL); String tooltip = actionElement.getAttribute(ATT_TOOLTIP); String helpContextId = actionElement.getAttribute(ATT_HELP_CONTEXT_ID); String mpath = actionElement.getAttribute(ATT_MENUBAR_PATH); String tpath = actionElement.getAttribute(ATT_TOOLBAR_PATH); String style = actionElement.getAttribute(ATT_STYLE); String icon = actionElement.getAttribute(ATT_ICON); String hoverIcon = actionElement.getAttribute(ATT_HOVERICON); String disabledIcon = actionElement.getAttribute(ATT_DISABLEDICON); String description = actionElement.getAttribute(ATT_DESCRIPTION); String accelerator = actionElement.getAttribute(ATT_ACCELERATOR); // Verify input. if (label == null) { WorkbenchPlugin .log("Invalid action declaration (label == null): " + id); //$NON-NLS-1$ label = WorkbenchMessages.ActionDescriptor_invalidLabel; } // Calculate menu and toolbar paths. String mgroup = null; String tgroup = null; if (mpath != null) { int loc = mpath.lastIndexOf('/'); if (loc != -1) { mgroup = mpath.substring(loc + 1); mpath = mpath.substring(0, loc); } else { mgroup = mpath; mpath = null; } } if (targetType == T_POPUP && mgroup == null) mgroup = IWorkbenchActionConstants.MB_ADDITIONS; if (tpath != null) { int loc = tpath.lastIndexOf('/'); if (loc != -1) { tgroup = tpath.substring(loc + 1); tpath = tpath.substring(0, loc); } else { tgroup = tpath; tpath = null; } } menuPath = mpath; menuGroup = mgroup; if ((tpath != null) && tpath.equals("Normal")) //$NON-NLS-1$ tpath = ""; //$NON-NLS-1$ toolbarId = tpath; toolbarGroupId = tgroup; // Create action. action = createAction(targetType, actionElement, target, style); if (action.getText() == null) // may have been set by delegate action.setText(label); if (action.getToolTipText() == null && tooltip != null) // may have been set by delegate action.setToolTipText(tooltip); if (helpContextId != null) { String fullID = helpContextId; if (helpContextId.indexOf(".") == -1) //$NON-NLS-1$ // For backward compatibility we auto qualify the id if it is not // qualified) fullID = actionElement.getDeclaringExtension().getNamespace() + "." + helpContextId;//$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(action, fullID); } if (description != null) action.setDescription(description); if (style != null) { // Since 2.1, the "state" and "pulldown" attributes means something different // when the new "style" attribute has been set. See doc for more info. String state = actionElement.getAttribute(ATT_STATE); if (state != null) { if (style.equals(STYLE_RADIO) || style.equals(STYLE_TOGGLE)) action.setChecked(state.equals("true"));//$NON-NLS-1$ } } else { // Keep for backward compatibility for actions not using the // new style attribute. String state = actionElement.getAttribute(ATT_STATE); if (state != null) { action.setChecked(state.equals("true"));//$NON-NLS-1$ } } String extendingPluginId = actionElement.getDeclaringExtension() .getNamespace(); if (icon != null) { action.setImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, icon)); } if (hoverIcon != null) { action.setHoverImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, hoverIcon)); } if (disabledIcon != null) { action .setDisabledImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, disabledIcon)); } if (accelerator != null) processAccelerator(action, accelerator); }
public ActionDescriptor(IConfigurationElement actionElement, int targetType, Object target) { // Load attributes. id = actionElement.getAttribute(ATT_ID); pluginId = actionElement.getDeclaringExtension().getNamespace(); String label = actionElement.getAttribute(ATT_LABEL); String tooltip = actionElement.getAttribute(ATT_TOOLTIP); String helpContextId = actionElement.getAttribute(ATT_HELP_CONTEXT_ID); String mpath = actionElement.getAttribute(ATT_MENUBAR_PATH); String tpath = actionElement.getAttribute(ATT_TOOLBAR_PATH); String style = actionElement.getAttribute(ATT_STYLE); String icon = actionElement.getAttribute(ATT_ICON); String hoverIcon = actionElement.getAttribute(ATT_HOVERICON); String disabledIcon = actionElement.getAttribute(ATT_DISABLEDICON); String description = actionElement.getAttribute(ATT_DESCRIPTION); String accelerator = actionElement.getAttribute(ATT_ACCELERATOR); // Verify input. if (label == null) { WorkbenchPlugin .log("Invalid action declaration (label == null): " + id); //$NON-NLS-1$ label = WorkbenchMessages.ActionDescriptor_invalidLabel; } // Calculate menu and toolbar paths. String mgroup = null; String tgroup = null; if (mpath != null) { int loc = mpath.lastIndexOf('/'); if (loc != -1) { mgroup = mpath.substring(loc + 1); mpath = mpath.substring(0, loc); } else { mgroup = mpath; mpath = null; } } if (targetType == T_POPUP && mgroup == null) mgroup = IWorkbenchActionConstants.MB_ADDITIONS; if (tpath != null) { int loc = tpath.lastIndexOf('/'); if (loc != -1) { tgroup = tpath.substring(loc + 1); tpath = tpath.substring(0, loc); } else { tgroup = tpath; tpath = null; } } menuPath = mpath; menuGroup = mgroup; if ((tpath != null) && tpath.equals("Normal")) //$NON-NLS-1$ tpath = ""; //$NON-NLS-1$ toolbarId = tpath; toolbarGroupId = tgroup; // Create action. action = createAction(targetType, actionElement, target, style); if (action.getText() == null) // may have been set by delegate action.setText(label); if (action.getToolTipText() == null && tooltip != null) // may have been set by delegate action.setToolTipText(tooltip); if (helpContextId != null) { String fullID = helpContextId; if (helpContextId.indexOf(".") == -1) //$NON-NLS-1$ // For backward compatibility we auto qualify the id if it is not // qualified) fullID = actionElement.getDeclaringExtension().getNamespace() + "." + helpContextId;//$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(action, fullID); } if (description != null) action.setDescription(description); if (style != null) { // Since 2.1, the "state" and "pulldown" attributes means something different // when the new "style" attribute has been set. See doc for more info. String state = actionElement.getAttribute(ATT_STATE); if (state != null) { if (style.equals(STYLE_RADIO) || style.equals(STYLE_TOGGLE)) action.setChecked(state.equals("true"));//$NON-NLS-1$ } } else { // Keep for backward compatibility for actions not using the // new style attribute. String state = actionElement.getAttribute(ATT_STATE); if (state != null) { action.setChecked(state.equals("true"));//$NON-NLS-1$ } } String extendingPluginId = actionElement.getDeclaringExtension() .getNamespace(); if (icon != null) { action.setImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, icon)); } if (hoverIcon != null) { action.setHoverImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, hoverIcon)); } if (disabledIcon != null) { action .setDisabledImageDescriptor(AbstractUIPlugin .imageDescriptorFromPlugin(extendingPluginId, disabledIcon)); } if (accelerator != null) processAccelerator(action, accelerator); }
1,121,089
public String getID() { throw new NotImplementedException(); }
public String getID() { return scriptWorkspacePath; }
1,121,090
public String getScript() { throw new NotImplementedException(); }
public String getScript() { return scriptContent; }
1,121,091
public RubyIO(Ruby ruby, RubyClass type) { super(ruby, type); }
protected RubyIO(Ruby ruby, RubyClass type) { super(ruby, type); }
1,121,092
public static RubyArray newArray(Ruby runtime, IRubyObject obj) { ArrayList list = new ArrayList(1); list.add(obj); return new RubyArray(runtime, list); }
public static RubyArray newArray(Ruby runtime, IRubyObject obj) { ArrayList list = new ArrayList(1); list.add(obj); return new RubyArray(runtime, list); }
1,121,093
public RegistryPageContributor(String pageId, IConfigurationElement element, Collection keywordIds) { this(pageId,element); keywordReferences = keywordIds; }
public RegistryPageContributor(String pageId, IConfigurationElement element, Collection keywordIds) { this(pageId,element); keywordReferences = keywordIds; }
1,121,094
public static Test suite() { try { sOMS = new MyOMS(CONFIG_FILE); sOMS.init(); sOMS.run(); } catch (Exception e) { LoggerAdapter.error("Unable to initialize OMS", e, OrderManagementSystemIT.class.getName()); fail("Unable to init OMS"); } TestSuite suite = new MarketceteraTestSuite(OrderManagementSystemIT.class); suite.addTest(new RepeatedTest(new OrderManagementSystemIT("testEndToEndOrderFilling"), 5)); return suite; }
public static Test suite() { try { sOMS = new MyOMS(CONFIG_FILE); sOMS.init(); sOMS.run(); } catch (Exception e) { LoggerAdapter.error("Unable to initialize OMS", e, OrderManagementSystemIT.class.getName()); fail("Unable to init OMS"); } TestSuite suite = new MarketceteraTestSuite(OrderManagementSystemIT.class, OrderManagementSystem.OMS_MESSAGE_BUNDLE_INFO); suite.addTest(new RepeatedTest(new OrderManagementSystemIT("testEndToEndOrderFilling"), 5)); return suite; }
1,121,095
public static void error(String msg, Throwable ex, Object inCat) { getMyLogger(inCat).log(WRAPPER_FQCN, Level.ERROR, msg, ex); }
public static void error(String msg, Object inCat) { getMyLogger(inCat).log(WRAPPER_FQCN, Level.ERROR, msg, ex); }
1,121,096
public static void error(String msg, Throwable ex, Object inCat) { getMyLogger(inCat).log(WRAPPER_FQCN, Level.ERROR, msg, ex); }
public static void error(String msg, Throwable ex, Object inCat) { getMyLogger(inCat).log(WRAPPER_FQCN, Level.ERROR, msg, null); }
1,121,097
public MarketceteraTestSuite(Class aClass, String string) { super(aClass, string); init(); }
public MarketceteraTestSuite(Class aClass, String string) { super(aClass, string); init(); }
1,121,098
public JMSAdapter(String initialContextFactoryName, String providerURL, String connectionFactoryName, boolean explicitDestinationCreation) { mOutgoingQueueSessions = new HashMap<String, QueueSession>(); mOutgoingQueues = new HashMap<String, Queue>(); mOutgoingQueueSenders = new HashMap<String, QueueSender>(); mIncomingQueueSessions = new HashMap<String, QueueSession>(); mIncomingQueues = new HashMap<String, Queue>(); mIncomingQueueReceivers = new HashMap<String, QueueReceiver>(); mOutgoingTopicSessions = new HashMap<String, TopicSession>(); mOutgoingTopics = new HashMap<String, Topic>(); mOutgoingTopicPublishers = new HashMap<String, TopicPublisher>(); mIncomingTopicSessions = new HashMap<String, TopicSession>(); mIncomingTopics = new HashMap<String, Topic>(); mIncomingTopicSubscribers = new HashMap<String, TopicSubscriber>(); mInitialContextFactoryName = initialContextFactoryName; mProviderURL = providerURL; mConnectionFactoryName = connectionFactoryName; mExplicitlyCreateDestinations = explicitDestinationCreation; LoggerAdapter.debug("creating a JMSAdapter for url " + mProviderURL, this); }
public JMSAdapter(String initialContextFactoryName, String providerURL, String connectionFactoryName, boolean explicitDestinationCreation) { mOutgoingQueueSessions = new HashMap<String, QueueSession>(); mOutgoingQueues = new HashMap<String, Queue>(); mOutgoingQueueSenders = new HashMap<String, QueueSender>(); mIncomingQueueSessions = new HashMap<String, QueueSession>(); mIncomingQueues = new HashMap<String, Queue>(); mIncomingQueueReceivers = new HashMap<String, QueueReceiver>(); mOutgoingTopicSessions = new HashMap<String, TopicSession>(); mOutgoingTopics = new HashMap<String, Topic>(); mOutgoingTopicPublishers = new HashMap<String, TopicPublisher>(); mIncomingTopicSessions = new HashMap<String, TopicSession>(); mIncomingTopics = new HashMap<String, Topic>(); mIncomingTopicSubscribers = new HashMap<String, TopicSubscriber>(); mInitialContextFactoryName = initialContextFactoryName; mProviderURL = providerURL; mConnectionFactoryName = connectionFactoryName; mExplicitlyCreateDestinations = explicitDestinationCreation; LoggerAdapter.debug("creating a JMSAdapter for url " + mProviderURL, this); }
1,121,099
public void start() { for (Connection aConnection : mConnections.values()) { try { aConnection.start(); LoggerAdapter.debug("Adapter for "+mProviderURL + " started for client "+aConnection.getClientID(), this); } catch (JMSException ex) { LoggerAdapter.error("Exception starting JMS connection", ex, this); } } }
public void start() { for (Connection aConnection : mConnections.values()) { try { aConnection.start(); LoggerAdapter.debug("Adapter for "+mProviderURL + " started for client "+aConnection.getClientID(), this); } catch (JMSException ex) { LoggerAdapter.error(MessageKey.JMS_CONNECTION_START_ERROR.getLocalizedMessage(), ex, this); } } }
1,121,100
protected void setUp() throws Exception { System.out.println("DeletionSyncTest.setUp()"); super.setUp(); makeFriends(); setupTestFolder(SyncProfile.MANUAL_DOWNLOAD); }
protected void setUp() throws Exception { System.out.println("DeletionSyncTest.setUp()"); super.setUp(); makeFriends(); joinTestFolder(SyncProfile.MANUAL_DOWNLOAD); }
1,121,101
public void setUp() throws Exception { // Remove directries FileUtils.deleteDirectory(new File(location)); super.setUp(); FolderInfo testFolder = new FolderInfo("testFolder", IdGenerator .makeId(), true); folder = getController().getFolderRepository().createFolder(testFolder, new File(location)); File localbase = folder.getLocalBase(); File testFile = new File(localbase, "test.txt"); if (testFile.exists()) { testFile.delete(); } assertTrue(testFile.createNewFile()); FileWriter writer = new FileWriter(testFile); writer .write("This is the test text.\n\nl;fjk sdl;fkjs dfljkdsf ljds flsfjd lsjdf lsfjdoi;ureffd dshf\nhjfkluhgfidgh kdfghdsi8yt ribnv.,jbnfd kljhfdlkghes98o jkkfdgh klh8iesyt"); writer.close(); folder.scanLocalFiles(true); }
public void setUp() throws Exception { // Remove directries FileUtils.deleteDirectory(new File(location)); super.setUp(); FolderInfo testFolder = new FolderInfo("testFolder", IdGenerator .makeId(), true); folder = getController().getFolderRepository().createFolder(testFolder, new File(location)); File localbase = folder.getLocalBase(); File testFile = new File(localbase, "test.txt"); if (testFile.exists()) { testFile.delete(); } assertTrue(testFile.createNewFile()); FileWriter writer = new FileWriter(testFile); writer .write("This is the test text.\n\nl;fjk sdl;fkjs dfljkdsf ljds flsfjd lsjdf lsfjdoi;ureffd dshf\nhjfkluhgfidgh kdfghdsi8yt ribnv.,jbnfd kljhfdlkghes98o jkkfdgh klh8iesyt"); writer.close(); folder.forceScanOnNextMaintenance(); folder.maintain(); }
1,121,102
public void analyseConnection() { if (getRemoteAddress() != null && getRemoteAddress().getAddress() != null) { // The NetworkHelper class supports only windows atm if (OSUtil.isWindowsSystem()) { try { //FIXME Bytekeeper please fix!!! //this will set OnLan to false if loading of dll fails! //previous implementaion seams to be better... now setOnLAN(NetworkUtil.isOnAnySubnet((Inet4Address) getRemoteAddress().getAddress())); } catch (UnsatisfiedLinkError usle ) { log().error(usle); setOnLAN(NetworkUtil.isOnLanOrLoopback(getRemoteAddress() .getAddress())); } } else { setOnLAN(NetworkUtil.isOnLanOrLoopback(getRemoteAddress() .getAddress())); } // Check if the remote address is one of this machine's // interfaces. try { omitBandwidthLimit = NetworkUtil.getAllLocalNetworkAddresses() .containsKey(socket.getInetAddress()); } catch (SocketException e) { log().error("Omitting bandwidth", e); } } if (!onLAN && !getController().isSilentMode()) { // testConnection(); } }
public void analyseConnection() { if (getRemoteAddress() != null && getRemoteAddress().getAddress() != null) { // The NetworkHelper class supports only windows atm if (OSUtil.isWindowsSystem()) { try { //FIXME Bytekeeper please fix!!! //this will set OnLan to false if loading of dll fails! //previous implementaion seams to be better... now Inet4Address addr = (Inet4Address) getRemoteAddress().getAddress(); setOnLAN(NetworkUtil.isOnAnySubnet(addr) || NetworkUtil.isOnLanOrLoopback(addr)); } catch (UnsatisfiedLinkError usle ) { log().error(usle); setOnLAN(NetworkUtil.isOnLanOrLoopback(getRemoteAddress() .getAddress())); } } else { setOnLAN(NetworkUtil.isOnLanOrLoopback(getRemoteAddress() .getAddress())); } // Check if the remote address is one of this machine's // interfaces. try { omitBandwidthLimit = NetworkUtil.getAllLocalNetworkAddresses() .containsKey(socket.getInetAddress()); } catch (SocketException e) { log().error("Omitting bandwidth", e); } } if (!onLAN && !getController().isSilentMode()) { // testConnection(); } }
1,121,103
public FIXMatcher(int fixField, T value) { matcherFIXField = fixField; matcherValue = value; }
public FIXMatcher(int fixField, T value) { matcherFIXField = fixField; matcherValue = value; }
1,121,105
public ShowHeartbeatsAction(FIXMessagesView view) { this.view = view; setId(ID); setText("&Show heartbeats"); setToolTipText("Show heartbeats"); setImageDescriptor(PhotonPlugin.getImageDescriptor(IImageKeys.SHOW_HEARTBEATS)); setChecked(true); }
public ShowHeartbeatsAction(FIXMessagesView view) { this.view = view; setId(ID); setText("&Show heartbeats"); setToolTipText("Show heartbeats"); setImageDescriptor(PhotonPlugin.getImageDescriptor(IImageKeys.SHOW_HEARTBEATS)); setChecked(false); }
1,121,106
public String getCookiesAsHTTPString(String host) { if (getCookies() == null) { return null; } String cookiesString = ""; // insert all cookies for (String name : getCookies().keySet()) { String value = getCookies().get(name); Calendar calNow = new GregorianCalendar(); calNow.add(Calendar.HOUR, 24); // one day expiration DateFormat formatter = new SimpleDateFormat( HTTPConstants.COOKIE_EXPIRATION_DATE_FORMAT, Locale.US); String expirationDate = formatter.format(calNow.getTime()); String cookie = "Set-Cookie: " + name + "=" + value + "; expires=" + expirationDate + "; path=/; domain=" + host + new String(HTTPConstants.EOL); cookiesString += cookie; } log().debug(cookiesString); return cookiesString; }
public String getCookiesAsHTTPString(String host) { if (getCookies() == null) { return null; } String cookiesString = ""; // insert all cookies for (String name : getCookies().keySet()) { String value = getCookies().get(name); Calendar calNow = new GregorianCalendar(); calNow.add(Calendar.HOUR, 24); // one day expiration DateFormat formatter = new SimpleDateFormat( HTTPConstants.COOKIE_EXPIRATION_DATE_FORMAT, Locale.US); String expirationDate = formatter.format(calNow.getTime()); String cookie = "Set-Cookie: " + name + "=" + value + "; expires=" + expirationDate + "; path=/; domain=" + host + new String(HTTPConstants.EOL); cookiesString += cookie; } return cookiesString; }
1,121,107
public String getDyndnsViaHTTP() { String ipAddr = ""; try { URL dyndns = new URL("http://checkip.dyndns.org/"); URLConnection urlConn = dyndns.openConnection(); int length = urlConn.getContentLength(); ByteArrayOutputStream tempBuffer; if (length < 0) { tempBuffer = new ByteArrayOutputStream(); } else { tempBuffer = new ByteArrayOutputStream(length); } InputStream inStream = urlConn.getInputStream(); int ch; while ((ch = inStream.read()) >= 0) { tempBuffer.write(ch); } String ipText = tempBuffer.toString(); Logger.getLogger(ConnectionListener.class).warn( "Received '" + ipText + "' from " + dyndns); ipAddr = filterIPs(ipText); } catch (IOException e) { } // return the ip address or empty string if none is found return ipAddr; }
public String getDyndnsViaHTTP() { String ipAddr = ""; try { URL dyndns = new URL("http://checkip.dyndns.org/"); URLConnection urlConn = dyndns.openConnection(); int length = urlConn.getContentLength(); ByteArrayOutputStream tempBuffer; if (length < 0) { tempBuffer = new ByteArrayOutputStream(); } else { tempBuffer = new ByteArrayOutputStream(length); } InputStream inStream = urlConn.getInputStream(); int ch; while ((ch = inStream.read()) >= 0) { tempBuffer.write(ch); } String ipText = tempBuffer.toString(); Logger.getLogger(ConnectionListener.class).warn( "Received '" + ipText + "' from " + dyndns); ipAddr = filterIPs(ipText); } catch (IOException e) { } // return the ip address or empty string if none is found return ipAddr; }
1,121,108
public void testDuplicateRequestedUpload() throws ConnectionException { // Create a 10 megs file TestHelper.createRandomFile(folderBart.getLocalBase(), 10000000); folderBart.forceScanOnNextMaintenance(); folderBart.maintain(); // wait for 1 active upload TestHelper.waitForCondition(2, new TestHelper.Condition() { public boolean reached() { return getContollerBart().getTransferManager() .getActiveUploads().length >= 1; } }); TestHelper.waitMilliSeconds(500); // Fake another request of the file FileInfo testFile = folderBart.getFiles()[0]; Member bartAtLisa = getContollerLisa().getNodeManager().getNode( getContollerBart().getMySelf().getId()); assertTrue(bartAtLisa.isCompleteyConnected()); bartAtLisa.sendMessage(new RequestDownload(testFile)); TestHelper.waitMilliSeconds(1000); TestHelper.waitForCondition(10, new TestHelper.Condition() { public boolean reached() { return getContollerBart().getTransferManager() .getActiveUploads().length == 0 && getContollerBart().getTransferManager() .getQueuedUploads().length == 0; } }); // Model should be empty assertEquals(0, bartModel.getRowCount()); getContollerLisa().getTransferManager().getActiveDownload(testFile) .abortAndCleanup(); }
public void testDuplicateRequestedUpload() throws ConnectionException { // Create a 10 megs file TestHelper.createRandomFile(folderBart.getLocalBase(), 10000000); folderBart.forceScanOnNextMaintenance(); folderBart.maintain(); // wait for 1 active upload TestHelper.waitForCondition(2, new TestHelper.Condition() { public boolean reached() { return getContollerBart().getTransferManager() .getActiveUploads().length >= 1; } }); TestHelper.waitMilliSeconds(500); // Fake another request of the file FileInfo testFile = folderBart.getFiles()[0]; Member bartAtLisa = getContollerLisa().getNodeManager().getNode( getContollerBart().getMySelf().getId()); assertTrue(bartAtLisa.isCompleteyConnected()); bartAtLisa.sendMessage(new RequestDownload(testFile)); TestHelper.waitMilliSeconds(1000); TestHelper.waitForCondition(10, new TestHelper.Condition() { public boolean reached() { return getContollerBart().getTransferManager() .getActiveUploads().length == 0 && getContollerBart().getTransferManager() .getQueuedUploads().length == 0; } }); // Model should be empty assertEquals(0, bartModel.getRowCount()); getContollerLisa().getTransferManager().getActiveDownload(testFile) .abortAndCleanup(); }
1,121,109
public static com.liferay.portal.model.Group getGroup( java.lang.String companyId, java.lang.String name) throws com.liferay.portal.PortalException, com.liferay.portal.SystemException { try { GroupLocalService groupLocalService = GroupLocalServiceFactory.getService(); return groupLocalService.getGroup(companyId, name); } catch (com.liferay.portal.PortalException pe) { throw pe; } catch (com.liferay.portal.SystemException se) { throw se; } catch (Exception e) { throw new com.liferay.portal.SystemException(e); } }
public static com.liferay.portal.model.Group getGroup( java.lang.String groupId) throws com.liferay.portal.PortalException, com.liferay.portal.SystemException { try { GroupLocalService groupLocalService = GroupLocalServiceFactory.getService(); return groupLocalService.getGroup(companyId, name); } catch (com.liferay.portal.PortalException pe) { throw pe; } catch (com.liferay.portal.SystemException se) { throw se; } catch (Exception e) { throw new com.liferay.portal.SystemException(e); } }
1,121,110
public static com.liferay.portal.model.Group getGroup( java.lang.String companyId, java.lang.String name) throws com.liferay.portal.PortalException, com.liferay.portal.SystemException { try { GroupLocalService groupLocalService = GroupLocalServiceFactory.getService(); return groupLocalService.getGroup(companyId, name); } catch (com.liferay.portal.PortalException pe) { throw pe; } catch (com.liferay.portal.SystemException se) { throw se; } catch (Exception e) { throw new com.liferay.portal.SystemException(e); } }
public static com.liferay.portal.model.Group getGroup( java.lang.String companyId, java.lang.String name) throws com.liferay.portal.PortalException, com.liferay.portal.SystemException { try { GroupLocalService groupLocalService = GroupLocalServiceFactory.getService(); return groupLocalService.getGroup(groupId); } catch (com.liferay.portal.PortalException pe) { throw pe; } catch (com.liferay.portal.SystemException se) { throw se; } catch (Exception e) { throw new com.liferay.portal.SystemException(e); } }
1,121,111
private Component getProblemComponent(FileInfo fileInfo) { // display only first problem FilenameProblem problem = scanResult.getProblemFiles() .get(fileInfo).get(0); JLabel label = SimpleComponentFactory.createLabel(problem .shortDescription()); label.setBackground(Color.WHITE); VisualLinkLabel detailsLabel = new VisualLinkLabel("details"); FormLayout layout = new FormLayout("pref:grow", "pref, pref"); CellConstraints cc = new CellConstraints(); PanelBuilder builder = new PanelBuilder(layout); builder.add(label, cc.xy(1, 1)); builder.add(detailsLabel, cc.xy(1, 2)); JPanel panel = builder.getPanel(); panel.setToolTipText(getTooltip(fileInfo)); panel.setBorder(new EmptyBorder(4, 4, 4, 4)); panel.setBackground(Color.WHITE); return panel; }
private Component getProblemComponent(FileInfo fileInfo) { // display only first problem FilenameProblem problem = scanResult.getProblemFiles() .get(fileInfo).get(0); JLabel label = SimpleComponentFactory.createLabel(problem .shortDescription()); label.setBackground(Color.WHITE); VisualLinkLabel detailsLabel = new VisualLinkLabel("details"); FormLayout layout = new FormLayout("pref:grow", "pref, pref"); CellConstraints cc = new CellConstraints(); PanelBuilder builder = new PanelBuilder(layout); builder.add(label, cc.xy(1, 1)); builder.add(detailsLabel, cc.xy(1, 2)); JPanel panel = builder.getPanel(); panel.setToolTipText(getTooltip(fileInfo)); panel .setBorder(Borders.createEmptyBorder("3dlu, 3dlu, 3dlu, 3dlu")); panel.setBackground(Color.WHITE); return panel; }
1,121,112
private Component getSolutionComponent(final FileInfo fileInfo) { if (solutionsPanelCache.containsKey(fileInfo)) { return solutionsPanelCache.get(fileInfo); } JRadioButton nothingRadioButton = new JRadioButton(Translation .getTranslation("filenameproblem.dialog.do_nothing")); JRadioButton renameRadioButton = new JRadioButton(Translation .getTranslation("filenameproblem.dialog.automatic_rename")); renameRadioButton .setToolTipText(Translation .getTranslation("filenameproblem.dialog.automatic_rename.explained")); JRadioButton addToIgnoreRadioButton = new JRadioButton(Translation .getTranslation("filenameproblem.dialog.add_to_ignore")); addToIgnoreRadioButton .setToolTipText(Translation .getTranslation("filenameproblem.dialog.add_to_ignore.explained")); nothingRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { solutionsMap.put(fileInfo, Solution.NOTHING); } }); renameRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { solutionsMap.put(fileInfo, Solution.RENAME); } }); addToIgnoreRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { solutionsMap.put(fileInfo, Solution.ADD_TO_IGNORE); } }); nothingRadioButton.setSelected(true); nothingRadioButton.setBackground(Color.WHITE); renameRadioButton.setBackground(Color.WHITE); addToIgnoreRadioButton.setBackground(Color.WHITE); ButtonGroup group = new ButtonGroup(); group.add(nothingRadioButton); group.add(renameRadioButton); group.add(addToIgnoreRadioButton); FormLayout layout = new FormLayout("pref", "pref, pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.add(nothingRadioButton, cc.xy(1, 1)); builder.add(renameRadioButton, cc.xy(1, 2)); builder.add(addToIgnoreRadioButton, cc.xy(1, 3)); JPanel panel = builder.getPanel(); panel.setBorder(new EmptyBorder(4, 4, 4, 4)); panel.setBackground(Color.WHITE); solutionsPanelCache.put(fileInfo, panel); return panel; }
private Component getSolutionComponent(final FileInfo fileInfo) { if (solutionsPanelCache.containsKey(fileInfo)) { return solutionsPanelCache.get(fileInfo); } JRadioButton nothingRadioButton = new JRadioButton(Translation .getTranslation("filenameproblem.dialog.do_nothing")); JRadioButton renameRadioButton = new JRadioButton(Translation .getTranslation("filenameproblem.dialog.automatic_rename")); renameRadioButton .setToolTipText(Translation .getTranslation("filenameproblem.dialog.automatic_rename.explained")); JRadioButton addToIgnoreRadioButton = new JRadioButton(Translation .getTranslation("filenameproblem.dialog.add_to_ignore")); addToIgnoreRadioButton .setToolTipText(Translation .getTranslation("filenameproblem.dialog.add_to_ignore.explained")); nothingRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { solutionsMap.put(fileInfo, Solution.NOTHING); } }); renameRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { solutionsMap.put(fileInfo, Solution.RENAME); } }); addToIgnoreRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { solutionsMap.put(fileInfo, Solution.ADD_TO_IGNORE); } }); nothingRadioButton.setSelected(true); nothingRadioButton.setBackground(Color.WHITE); renameRadioButton.setBackground(Color.WHITE); addToIgnoreRadioButton.setBackground(Color.WHITE); ButtonGroup group = new ButtonGroup(); group.add(nothingRadioButton); group.add(renameRadioButton); group.add(addToIgnoreRadioButton); FormLayout layout = new FormLayout("pref", "pref, pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.add(nothingRadioButton, cc.xy(1, 1)); builder.add(renameRadioButton, cc.xy(1, 2)); builder.add(addToIgnoreRadioButton, cc.xy(1, 3)); JPanel panel = builder.getPanel(); panel .setBorder(Borders.createEmptyBorder("3dlu, 3dlu, 3dlu, 3dlu")); panel.setBackground(Color.WHITE); solutionsPanelCache.put(fileInfo, panel); return panel; }
1,121,113
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { FileInfo fileInfo = (FileInfo)value; switch (column) { case FILENAME_COLUMN : { JLabel label = new JLabel(fileInfo.getName()); label.setBorder(new EmptyBorder(4, 4, 4, 4)); label.setToolTipText(fileInfo.getName()); return label; } case PROBLEM_COLUMN : { return getProblemComponent(fileInfo); } case SOLUTION_COLUMN : { return getSolutionComponent(fileInfo); } } return null; }
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { FileInfo fileInfo = (FileInfo)value; switch (column) { case FILENAME_COLUMN : { JLabel label = new JLabel(fileInfo.getName()); label.setBorder(Borders .createEmptyBorder("3dlu, 3dlu, 3dlu, 3dlu")); label.setToolTipText(fileInfo.getName()); return label; } case PROBLEM_COLUMN : { return getProblemComponent(fileInfo); } case SOLUTION_COLUMN : { return getSolutionComponent(fileInfo); } } return null; }
1,121,114
private JPanel createToolbar() { JButton cancel = new JButton(Translation .getTranslation("general.cancel")); cancel.setMnemonic(Translation.getTranslation("general.cancel.key") .trim().charAt(0)); JButton ok = new JButton(Translation.getTranslation("general.ok")); ok.setMnemonic(Translation.getTranslation("general.ok.key").trim() .charAt(0)); JPanel buttons = ButtonBarFactory.buildRightAlignedBar(cancel, ok); buttons.setBorder(new EmptyBorder(10, 10, 10, 10)); buttons.setOpaque(false); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); dialog.dispose(); dialog = null; } }); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSolutions(); dialog.setVisible(false); dialog.dispose(); dialog = null; } }); return buttons; }
private JPanel createToolbar() { JButton cancel = new JButton(Translation .getTranslation("general.cancel")); cancel.setMnemonic(Translation.getTranslation("general.cancel.key") .trim().charAt(0)); JButton ok = new JButton(Translation.getTranslation("general.ok")); ok.setMnemonic(Translation.getTranslation("general.ok.key").trim() .charAt(0)); JPanel buttons = ButtonBarFactory.buildRightAlignedBar(cancel, ok); buttons.setBorder(Borders.createEmptyBorder("7dlu, 7dlu, 7dlu, 7dlu")); buttons.setOpaque(false); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); dialog.dispose(); dialog = null; } }); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSolutions(); dialog.setVisible(false); dialog.dispose(); dialog = null; } }); return buttons; }
1,121,115
private Component getUIComponent() { if (panel == null) { initComponents(); FormLayout layout = new FormLayout("fill:pref:grow", "7dlu, pref, 7dlu, fill:pref:grow, pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); JLabel jLabel = SimpleComponentFactory .createBigTextLabel(Translation .getTranslation("filenameproblem.dialog.description")); builder.add(jLabel, cc.xy(1, 2)); builder.add(tableScroller, cc.xy(1, 4)); builder.addSeparator(null, cc.xy(1, 5)); builder.add(toolbar, cc.xy(1, 6)); panel = builder.getPanel(); } return panel; }
private JComponent getUIComponent() { if (panel == null) { initComponents(); FormLayout layout = new FormLayout("fill:pref:grow", "7dlu, pref, 7dlu, fill:pref:grow, pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); JLabel jLabel = SimpleComponentFactory .createBigTextLabel(Translation .getTranslation("filenameproblem.dialog.description")); builder.add(jLabel, cc.xy(1, 2)); builder.add(tableScroller, cc.xy(1, 4)); builder.addSeparator(null, cc.xy(1, 5)); builder.add(toolbar, cc.xy(1, 6)); panel = builder.getPanel(); } return panel; }
1,121,116
private Component getUIComponent() { if (panel == null) { initComponents(); FormLayout layout = new FormLayout("fill:pref:grow", "7dlu, pref, 7dlu, fill:pref:grow, pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); JLabel jLabel = SimpleComponentFactory .createBigTextLabel(Translation .getTranslation("filenameproblem.dialog.description")); builder.add(jLabel, cc.xy(1, 2)); builder.add(tableScroller, cc.xy(1, 4)); builder.addSeparator(null, cc.xy(1, 5)); builder.add(toolbar, cc.xy(1, 6)); panel = builder.getPanel(); } return panel; }
private Component getUIComponent() { if (panel == null) { initComponents(); FormLayout layout = new FormLayout("fill:pref:grow", "7dlu, pref, 7dlu, fill:pref:grow, pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); JLabel jLabel = SimpleComponentFactory .createBigTextLabel(Translation .getTranslation("filenameproblem.dialog.description")); builder.add(jLabel, cc.xy(1, 2)); builder.add(tableScroller, cc.xy(1, 4)); builder.addSeparator(null, cc.xy(1, 5)); builder.add(toolbar, cc.xy(1, 6)); panel = builder.getPanel(); } return panel; }
1,121,117
private Component getUIComponent() { if (panel == null) { initComponents(); FormLayout layout = new FormLayout("fill:pref:grow", "7dlu, pref, 7dlu, fill:pref:grow, pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); JLabel jLabel = SimpleComponentFactory .createBigTextLabel(Translation .getTranslation("filenameproblem.dialog.description")); builder.add(jLabel, cc.xy(1, 2)); builder.add(tableScroller, cc.xy(1, 4)); builder.addSeparator(null, cc.xy(1, 5)); builder.add(toolbar, cc.xy(1, 6)); panel = builder.getPanel(); } return panel; }
private Component getUIComponent() { if (panel == null) { initComponents(); FormLayout layout = new FormLayout("fill:pref:grow", "7dlu, pref, 7dlu, fill:pref:grow, pref, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); JLabel jLabel = SimpleComponentFactory .createBigTextLabel(Translation .getTranslation("filenameproblem.dialog.description")); builder.add(jLabel, cc.xy(1, 2)); builder.add(tableScroller, cc.xy(1, 4)); builder.addSeparator(null, cc.xy(1, 5)); builder.add(toolbar, cc.xy(1, 6)); panel = builder.getPanel(); } return panel; }
1,121,118
private void initComponents() { table = new JTable(new ProblemTableModel()); ProblemTableCellRenderer problemTableCellRenderer = new ProblemTableCellRenderer(); table.setDefaultRenderer(Object.class, problemTableCellRenderer); table.setDefaultEditor(Object.class, problemTableCellRenderer); table.getTableHeader().setReorderingAllowed(false); tableScroller = new JScrollPane(table); toolbar = createToolbar(); setColumnSizes(table); UIUtil.whiteStripTable(table); UIUtil.removeBorder(tableScroller); }
private void initComponents() { table = new JTable(new ProblemTableModel()); ProblemTableCellRenderer problemTableCellRenderer = new ProblemTableCellRenderer(); table.setDefaultRenderer(Object.class, problemTableCellRenderer); table.setDefaultEditor(Object.class, problemTableCellRenderer); table.getTableHeader().setReorderingAllowed(false); tableScroller = new JScrollPane(table); toolbar = createToolbar(); setColumnSizes(table); UIUtil.whiteStripTable(table); UIUtil.removeBorder(tableScroller); }
1,121,119
private void initComponents() { table = new JTable(new ProblemTableModel()); ProblemTableCellRenderer problemTableCellRenderer = new ProblemTableCellRenderer(); table.setDefaultRenderer(Object.class, problemTableCellRenderer); table.setDefaultEditor(Object.class, problemTableCellRenderer); table.getTableHeader().setReorderingAllowed(false); tableScroller = new JScrollPane(table); toolbar = createToolbar(); setColumnSizes(table); UIUtil.whiteStripTable(table); UIUtil.removeBorder(tableScroller); }
private void initComponents() { table = new JTable(new ProblemTableModel()); ProblemTableCellRenderer problemTableCellRenderer = new ProblemTableCellRenderer(); table.setDefaultRenderer(Object.class, problemTableCellRenderer); table.setDefaultEditor(Object.class, problemTableCellRenderer); table.getTableHeader().setReorderingAllowed(false); tableScroller = new JScrollPane(table); toolbar = createToolbar(); setColumnSizes(table); UIUtil.whiteStripTable(table); tableScroller.setPreferredSize(new Dimension(500, rowHeigth * problemList.size() + table.getTableHeader().getHeight())); }
1,121,120
public void open() { dialog = new JDialog(getUIController().getMainFrame().getUIComponent(), Translation.getTranslation("filenameproblem.dialog.title"), true); // modal dialog.getContentPane().add(getUIComponent()); dialog.pack(); dialog.setVisible(true); }
public void open() { dialog = new JDialog(getUIController().getMainFrame().getUIComponent(), Translation.getTranslation("filenameproblem.dialog.title"), true); // modal dialog.setContentPane(getUIComponent()); dialog.pack(); dialog.setVisible(true); }
1,121,121
private void setColumnSizes(JTable table) { table.setRowHeight(65); // otherwise the table header may not be visible: table.getTableHeader().setPreferredSize(new Dimension(600, 20)); TableColumn column = table.getColumn(table.getColumnName(0)); column.setPreferredWidth(150); column = table.getColumn(table.getColumnName(1)); column.setPreferredWidth(500); column = table.getColumn(table.getColumnName(2)); column.setPreferredWidth(150); }
private void setColumnSizes(JTable table) { table.setRowHeight(65); // otherwise the table header may not be visible: table.getTableHeader().setPreferredSize(new Dimension(600, 20)); TableColumn column = table.getColumn(table.getColumnName(0)); column.setPreferredWidth(150); column = table.getColumn(table.getColumnName(1)); column.setPreferredWidth(500); column = table.getColumn(table.getColumnName(2)); column.setPreferredWidth(150); }
1,121,123
public final String describeProblem() { switch (problemType) { case CONTAINS_ILLEGAL_LINUX_CHARS : return "The filename contains characters that may cause problems on Unix/Linux computers.\nThe character / is not allowed on those computers"; case CONTAINS_ILLEGAL_MACOSX_CHARS : return "The filename contains characters that may cause problems on Mac OSX computers.\nThe characters / and : are not allowed on those computers"; case CONTAINS_ILLEGAL_WINDOWS_CHARS : return "The filename contains characters that may cause problems on Windows computers.\nThe characters |\\?*<\":>/ and \"controll\" characters (ASCII code 0 till 31)\nare not allowed on those computers"; case ENDS_WITH_ILLEGAL_WINDOWS_CHARS : return "The filename ends with characters that may cause problems on Windows computers.\nThe characters . and space ( ) are not allowed as last\ncharacters on those computers"; case IS_RESERVED_WINDOWS_WORD : return "The filename is a reserved filename on Windows,\nit is recommended not to use this names on windows:\n CON, PRN, AUX, CLOCK$, NUL COM0, COM1, COM2, COM3,\nCOM4, COM5,COM6, COM7, COM8, COM9, LPT0, LPT1,\nLPT2, LPT3, LPT4,LPT5, LPT6, LPT7, LPT8, and LPT9."; case TO_LONG : return "The filename is longer than 255 characters,\nthis in know to cause problems on Windows, Mac OSX and Unix/Linux computers."; case DUPLICATE_FOUND : return "A filename with the same name is found but it has a differend case:\n" + fileInfoDupe.getName() + "\nthis causes problems on windows computers"; } throw new IllegalStateException("invalid problemType: " + problemType); }
public String describeProblem() { switch (problemType) { case CONTAINS_ILLEGAL_LINUX_CHARS : return "The filename contains characters that may cause problems on Unix/Linux computers.\nThe character / is not allowed on those computers"; case CONTAINS_ILLEGAL_MACOSX_CHARS : return "The filename contains characters that may cause problems on Mac OSX computers.\nThe characters / and : are not allowed on those computers"; case CONTAINS_ILLEGAL_WINDOWS_CHARS : return "The filename contains characters that may cause problems on Windows computers.\nThe characters |\\?*<\":>/ and \"controll\" characters (ASCII code 0 till 31)\nare not allowed on those computers"; case ENDS_WITH_ILLEGAL_WINDOWS_CHARS : return "The filename ends with characters that may cause problems on Windows computers.\nThe characters . and space ( ) are not allowed as last\ncharacters on those computers"; case IS_RESERVED_WINDOWS_WORD : return "The filename is a reserved filename on Windows,\nit is recommended not to use this names on windows:\n CON, PRN, AUX, CLOCK$, NUL COM0, COM1, COM2, COM3,\nCOM4, COM5,COM6, COM7, COM8, COM9, LPT0, LPT1,\nLPT2, LPT3, LPT4,LPT5, LPT6, LPT7, LPT8, and LPT9."; case TO_LONG : return "The filename is longer than 255 characters,\nthis in know to cause problems on Windows, Mac OSX and Unix/Linux computers."; case DUPLICATE_FOUND : return "A filename with the same name is found but it has a differend case:\n" + fileInfoDupe.getName() + "\nthis causes problems on windows computers"; } throw new IllegalStateException("invalid problemType: " + problemType); }
1,121,124
public final String describeProblem() { switch (problemType) { case CONTAINS_ILLEGAL_LINUX_CHARS : return "The filename contains characters that may cause problems on Unix/Linux computers.\nThe character / is not allowed on those computers"; case CONTAINS_ILLEGAL_MACOSX_CHARS : return "The filename contains characters that may cause problems on Mac OSX computers.\nThe characters / and : are not allowed on those computers"; case CONTAINS_ILLEGAL_WINDOWS_CHARS : return "The filename contains characters that may cause problems on Windows computers.\nThe characters |\\?*<\":>/ and \"controll\" characters (ASCII code 0 till 31)\nare not allowed on those computers"; case ENDS_WITH_ILLEGAL_WINDOWS_CHARS : return "The filename ends with characters that may cause problems on Windows computers.\nThe characters . and space ( ) are not allowed as last\ncharacters on those computers"; case IS_RESERVED_WINDOWS_WORD : return "The filename is a reserved filename on Windows,\nit is recommended not to use this names on windows:\n CON, PRN, AUX, CLOCK$, NUL COM0, COM1, COM2, COM3,\nCOM4, COM5,COM6, COM7, COM8, COM9, LPT0, LPT1,\nLPT2, LPT3, LPT4,LPT5, LPT6, LPT7, LPT8, and LPT9."; case TO_LONG : return "The filename is longer than 255 characters,\nthis in know to cause problems on Windows, Mac OSX and Unix/Linux computers."; case DUPLICATE_FOUND : return "A filename with the same name is found but it has a differend case:\n" + fileInfoDupe.getName() + "\nthis causes problems on windows computers"; } throw new IllegalStateException("invalid problemType: " + problemType); }
public final String describeProblem() { switch (problemType) { case CONTAINS_ILLEGAL_LINUX_CHARS : return "The filename contains characters that may cause problems on Unix/Linux computers.\nThe character / is not allowed on those computers"; case CONTAINS_ILLEGAL_MACOSX_CHARS : return "The filename contains characters that may cause problems on Mac OSX computers.\nThe characters / and : are not allowed on those computers"; case CONTAINS_ILLEGAL_WINDOWS_CHARS : return "The filename contains characters that may cause problems on Windows computers.\nThe characters |\\?*<\":>/ and \"controll\" characters (ASCII code 0 till 31)\nare not allowed on those computers"; case ENDS_WITH_ILLEGAL_WINDOWS_CHARS : return "The filename ends with characters that may cause problems on Windows computers.\nThe characters . and space ( ) are not allowed as last characters on those computers"; case IS_RESERVED_WINDOWS_WORD : return "The filename is a reserved filename on Windows,\nit is recommended not to use this names on windows:\n CON, PRN, AUX, CLOCK$, NUL COM0, COM1, COM2, COM3,\nCOM4, COM5,COM6, COM7, COM8, COM9, LPT0, LPT1,\nLPT2, LPT3, LPT4,LPT5, LPT6, LPT7, LPT8, and LPT9."; case TO_LONG : return "The filename is longer than 255 characters,\nthis in know to cause problems on Windows, Mac OSX and Unix/Linux computers."; case DUPLICATE_FOUND : return "A filename with the same name is found but it has a differend case:\n" + fileInfoDupe.getName() + "\nthis causes problems on windows computers"; } throw new IllegalStateException("invalid problemType: " + problemType); }
1,121,125
public Message getLatestMessageForFields(FieldMap fields) { for (int i = messageList.size() - 1; i >= 0; i--) { MessageHolder holder = messageList.get(i); Message message = holder.getMessage(); Iterator fieldMapIterator = fields.iterator(); boolean found = true; while (fieldMapIterator.hasNext()) { Field specifiedField = (Field) fieldMapIterator.next(); try { String messageFieldValue = message.getString(specifiedField.getField()); if (!messageFieldValue.equals( specifiedField.getObject().toString())) { found = false; break; } } catch (FieldNotFound e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (found){ return message; } } return null; }
public Message getLatestMessageForFields(FieldMap fields) { for (int i = messageList.size() - 1; i >= 0; i--) { MessageHolder holder = messageList.get(i); Message message = holder.getMessage(); Iterator fieldMapIterator = fields.iterator(); boolean found = true; while (fieldMapIterator.hasNext()) { Field specifiedField = (Field) fieldMapIterator.next(); try { String messageFieldValue = message.getString(specifiedField.getField()); if (!messageFieldValue.equals( specifiedField.getObject().toString())) { found = false; break; } } catch (FieldNotFound e) { // TODO Auto-generated catch block } } if (found){ return message; } } return null; }
1,121,126
public ConcreteMarker getMarker(int index) { return markers[index]; }
public ConcreteMarker getMarker(int index) { return markers[index]; }
1,121,127
private static void addDetailInfo(StringBuffer b, Member m) { if (b == null || m == null) { return; } if (m.isMySelf()) { b.append("(myself) "); } else if (m.isConnected()) { if (m.isOnLAN()) { b.append("(local) "); } else { b.append("(i-net) "); } } else if (m.isConnectedToNetwork()) { b.append("(online) "); } else { b.append("(offl.) "); } if (m.getInfo().isSupernode) { b.append("(s) "); } b.append(m); Identity id = m.getIdentity(); b.append(", ver. " + (id != null ? id.programVersion : "-") + ", ID: " + m.getId()); b.append(", reconnect address " + m.getReconnectAddress()); }
private static void addDetailInfo(StringBuffer b, Member m) { if (b == null || m == null) { return; } if (m.isMySelf()) { b.append("(myself) "); } else if (m.isConnected()) { if (m.isOnLAN()) { b.append("(local) "); } else { b.append("(i-net) "); } } else if (m.isConnectedToNetwork()) { b.append("(online) "); } else { b.append("(offl.) "); } if (m.getInfo().isSupernode) { b.append("(s) "); } b.append(m); Identity id = m.getIdentity(); b.append(", ver. " + (id != null ? id.programVersion : "-") + ", ID: " + m.getId()); b.append(", reconnect address " + m.getReconnectAddress()); }
1,121,128
public void verbose(Object str) { log(VERBOSE, str == null ? null : str.toString(), null); }
public void verbose(Object str) { log(VERBOSE, str == null ? null : str.toString(), null); }
1,121,130
public void testCancelOrder() throws ParserException, NoMoreIDsException, FieldNotFound{ Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String command; command = "C 12345"; aParser.setInput(command); Message aMessage = (Message)aParser.command().mResults.get(0); assertEquals(MsgType.ORDER_CANCEL_REQUEST, aMessage.getHeader().getString(MsgType.FIELD)); assertEquals("12345", aMessage.getString(OrigClOrdID.FIELD)); command = "C 12345 12345"; aParser.setInput(command); for (Object loopMessage : aParser.command().mResults){ assertEquals(MsgType.ORDER_CANCEL_REQUEST, ((Message)loopMessage).getHeader().getString(MsgType.FIELD)); assertEquals("12345", ((Message)loopMessage).getString(OrigClOrdID.FIELD)); } (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerCommand = "C 12345 ASDF"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerCommand); innerParser.command(); } }).run();}
public void testCancelOrder() throws ParserException, NoMoreIDsException, FieldNotFound{ Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String command; command = "C 12345"; aParser.setInput(command); Message aMessage = (Message)aParser.command().mResults.get(0); assertEquals(MsgType.ORDER_CANCEL_REQUEST, aMessage.getHeader().getString(MsgType.FIELD)); assertEquals("12345", aMessage.getString(OrigClOrdID.FIELD)); command = "C 12345 12345"; aParser.setInput(command); for (Object loopMessage : aParser.command().mResults){ assertEquals(MsgType.ORDER_CANCEL_REQUEST, ((Message)loopMessage).getHeader().getString(MsgType.FIELD)); assertEquals("12345", ((Message)loopMessage).getString(OrigClOrdID.FIELD)); } (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerCommand = "C 12345 ASDF"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerCommand); innerParser.command(); } }).run();}
1,121,131
public void testCancelOrder() throws ParserException, NoMoreIDsException, FieldNotFound{ Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String command; command = "C 12345"; aParser.setInput(command); Message aMessage = (Message)aParser.command().mResults.get(0); assertEquals(MsgType.ORDER_CANCEL_REQUEST, aMessage.getHeader().getString(MsgType.FIELD)); assertEquals("12345", aMessage.getString(OrigClOrdID.FIELD)); command = "C 12345 12345"; aParser.setInput(command); for (Object loopMessage : aParser.command().mResults){ assertEquals(MsgType.ORDER_CANCEL_REQUEST, ((Message)loopMessage).getHeader().getString(MsgType.FIELD)); assertEquals("12345", ((Message)loopMessage).getString(OrigClOrdID.FIELD)); } (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerCommand = "C 12345 ASDF"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerCommand); innerParser.command(); } }).run();}
public void testCancelOrder() throws ParserException, NoMoreIDsException, FieldNotFound{ Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String command; command = "C 12345"; aParser.setInput(command); Message aMessage = (Message)aParser.command().mResults.get(0); assertEquals(MsgType.ORDER_CANCEL_REQUEST, aMessage.getHeader().getString(MsgType.FIELD)); assertEquals("12345", aMessage.getString(OrigClOrdID.FIELD)); command = "C 12345 12345"; aParser.setInput(command); for (Object loopMessage : aParser.command().mResults){ assertEquals(MsgType.ORDER_CANCEL_REQUEST, ((Message)loopMessage).getHeader().getString(MsgType.FIELD)); assertEquals("12345", ((Message)loopMessage).getString(OrigClOrdID.FIELD)); } (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerCommand = "C 12345 ASDF"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerCommand); innerParser.command(); } }).run();}
1,121,132
public void testCancelOrder() throws ParserException, NoMoreIDsException, FieldNotFound{ Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String command; command = "C 12345"; aParser.setInput(command); Message aMessage = (Message)aParser.command().mResults.get(0); assertEquals(MsgType.ORDER_CANCEL_REQUEST, aMessage.getHeader().getString(MsgType.FIELD)); assertEquals("12345", aMessage.getString(OrigClOrdID.FIELD)); command = "C 12345 12345"; aParser.setInput(command); for (Object loopMessage : aParser.command().mResults){ assertEquals(MsgType.ORDER_CANCEL_REQUEST, ((Message)loopMessage).getHeader().getString(MsgType.FIELD)); assertEquals("12345", ((Message)loopMessage).getString(OrigClOrdID.FIELD)); } (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerCommand = "C 12345 ASDF"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerCommand); innerParser.command(); } }).run();}
public void testCancelOrder() throws ParserException, NoMoreIDsException, FieldNotFound{ Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String command; command = "C 12345"; aParser.setInput(command); Message aMessage = (Message)aParser.command().mResults.get(0); assertEquals(MsgType.ORDER_CANCEL_REQUEST, aMessage.getHeader().getString(MsgType.FIELD)); assertEquals("12345", aMessage.getString(OrigClOrdID.FIELD)); command = "C 12345 12345"; aParser.setInput(command); for (Object loopMessage : aParser.command().mResults){ assertEquals(MsgType.ORDER_CANCEL_REQUEST, ((Message)loopMessage).getHeader().getString(MsgType.FIELD)); assertEquals("12345", ((Message)loopMessage).getString(OrigClOrdID.FIELD)); } (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerCommand = "C 12345 ASDF"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerCommand); innerParser.command(); } }).run();}
1,121,133
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,134
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,135
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,136
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,137
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,138
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,139
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,140
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,141
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,142
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,143
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,144
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,145
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,146
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
public void testNewOrder() throws ParserException, NoMoreIDsException, FieldNotFound { Parser aParser = new Parser(); aParser.init(new InMemoryIDFactory(10)); String order; order = "B 100 IBM 1"; aParser.setInput(order); ParsedCommand command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("1"), TimeInForce.DAY, null); order = "SS 1234 IBM 1.8"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("1234"), "IBM", new BigDecimal("1.8"), TimeInForce.DAY, null); order = "SSE 999 IBM .7"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT_EXEMPT, new BigDecimal("999"), "IBM", new BigDecimal(".7"), TimeInForce.DAY, null); order = "S 0 IBM 0.0"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL, new BigDecimal("0"), "IBM", new BigDecimal("0.0"), TimeInForce.DAY, null); order = "B 100 IBM 94.8\tDAY"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, null); order = "B 100 IBM 94.8 OPG"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_OPENING, null); order = "B 100 IBM 94.8 CLO"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.AT_THE_CLOSE, null); order = "B 100 IBM 94.8 FOK"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.FILL_OR_KILL, null); order = "B 100 IBM 94.8 IOC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.IMMEDIATE_OR_CANCEL, null); order = "B 100 IBM 94.8 GTC"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.GOOD_TILL_CANCEL, null); order = "SS 100 IBM 94.8 DAY 123.45"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.SELL_SHORT, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "123.45"); order = "B 100 IBM 94.8 DAY AAA?A/a-A"; aParser.setInput(order); command = aParser.command(); assertEquals(MsgType.ORDER_SINGLE, command.mCommandType); verifyNewOrder((Message)(command.mResults.get(0)), Side.BUY, new BigDecimal("100"), "IBM", new BigDecimal("94.8"), TimeInForce.DAY, "AAA?A/a-A"); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM XXX DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM 123.45 ASDF AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100 IBM "; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); (new ExpectedTestFailure(ParserException.class) { protected void execute() throws Throwable { String innerOrder = "SS 100.0 IBM 123.45"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); } }).run(); }
1,121,147
protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); }
protected void execute() throws Throwable { String innerOrder = "A 100 IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); }
1,121,148
protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); }
protected void execute() throws Throwable { String innerOrder = "SS A IBM 94.8 DAY AAA?A/a-A"; Parser innerParser = new Parser(); innerParser.init(new InMemoryIDFactory(10)); innerParser.setInput(innerOrder); innerParser.command(); }
1,121,149