repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
Turksat/ESign | ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/run/StartFrame.java | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/GUIManager.java
// public class GUIManager {
// public static RootPaneContainer mainContainer;
// public static JPanel curPane;
//
// /**
// * Removes old screen with given pane.
// *
// * @param pane
// */
// public static void changeScreen(JPanel pane) {
// mainContainer.getContentPane().remove(curPane);
// curPane = pane;
// mainContainer.getContentPane().add(pane);
// mainContainer.getContentPane().repaint();
// GUIHelper.requestFocus(pane);
// }
//
// /**
// * Searches pane with given name inside current panel.
// * If pane is found, replaces old pane with new pane.
// *
// * @param oldPaneName
// * @param newPane
// */
// public static void replacePane(String oldPaneName, JPanel newPane) {
// Component[] components = curPane.getComponents();
// JPanel oldPane = null;
// for(Component comp: components) {
// if(comp.getName()!=null&&comp.getName().equals(oldPaneName)&&comp instanceof JPanel) {
// oldPane = (JPanel) comp;
// break;
// }
// }
// if(oldPane==null) {
// GUIManager.showErrMsg("Component "+oldPaneName+ " not found");
// } else {
// newPane.setLocation(oldPane.getX(),oldPane.getY());
// newPane.setSize(oldPane.getWidth(),oldPane.getHeight());
// curPane.remove(oldPane);
// curPane.add(newPane);
// curPane.repaint();
// GUIHelper.requestFocus(newPane);
// }
// }
//
// /**
// * Initialize main container as RootPaneContainer(such as japplet or jframe)
// * @param container
// */
// public static void init(RootPaneContainer container) {
// mainContainer = container;
// curPane = new CardSelectScreen();
// mainContainer.getContentPane().add(curPane);
// ((Container)mainContainer).setVisible(true);
// }
//
// /**
// * Destroys main container.
// */
// public static void destroy() {
// if(mainContainer instanceof Window) {
// ((Window)mainContainer).dispose();
// } else {
// //do nothing
// }
// }
//
// /**
// * Shows error message to user.
// * @param msg
// */
// public static void showErrMsg(String msg) {
// JOptionPane.showMessageDialog((Container)mainContainer, msg);
// }
//
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/view/container/MainFrame.java
// public class MainFrame extends javax.swing.JFrame {
//
// /**
// * Creates new form Main
// */
// public MainFrame() {
// initComponents();
// setBounds(Config.FRAME_STARTING_X, Config.FRAME_STARTING_Y, Config.FRAME_WIDTH, Config.FRAME_HEIGHT);
// }
//
// /**
// * This method is called from within the constructor to initialize the form.
// * WARNING: Do NOT modify this code. The content of this method is always
// * regenerated by the Form Editor.
// */
// @SuppressWarnings("unchecked")
// // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
// private void initComponents() {
//
// setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
// setTitle("ESignUI-SwingAPP");
// getContentPane().setLayout(null);
//
// pack();
// }// </editor-fold>//GEN-END:initComponents
//
// // Variables declaration - do not modify//GEN-BEGIN:variables
// // End of variables declaration//GEN-END:variables
//
// }
| import tr.gov.turkiye.esignuidesk.view.container.MainFrame;
import tr.gov.turkiye.esignuidesk.controller.GUIManager; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.run;
/**
* Runs application on JFrame.
*
* @author iakpolat
*/
public class StartFrame {
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) { | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/GUIManager.java
// public class GUIManager {
// public static RootPaneContainer mainContainer;
// public static JPanel curPane;
//
// /**
// * Removes old screen with given pane.
// *
// * @param pane
// */
// public static void changeScreen(JPanel pane) {
// mainContainer.getContentPane().remove(curPane);
// curPane = pane;
// mainContainer.getContentPane().add(pane);
// mainContainer.getContentPane().repaint();
// GUIHelper.requestFocus(pane);
// }
//
// /**
// * Searches pane with given name inside current panel.
// * If pane is found, replaces old pane with new pane.
// *
// * @param oldPaneName
// * @param newPane
// */
// public static void replacePane(String oldPaneName, JPanel newPane) {
// Component[] components = curPane.getComponents();
// JPanel oldPane = null;
// for(Component comp: components) {
// if(comp.getName()!=null&&comp.getName().equals(oldPaneName)&&comp instanceof JPanel) {
// oldPane = (JPanel) comp;
// break;
// }
// }
// if(oldPane==null) {
// GUIManager.showErrMsg("Component "+oldPaneName+ " not found");
// } else {
// newPane.setLocation(oldPane.getX(),oldPane.getY());
// newPane.setSize(oldPane.getWidth(),oldPane.getHeight());
// curPane.remove(oldPane);
// curPane.add(newPane);
// curPane.repaint();
// GUIHelper.requestFocus(newPane);
// }
// }
//
// /**
// * Initialize main container as RootPaneContainer(such as japplet or jframe)
// * @param container
// */
// public static void init(RootPaneContainer container) {
// mainContainer = container;
// curPane = new CardSelectScreen();
// mainContainer.getContentPane().add(curPane);
// ((Container)mainContainer).setVisible(true);
// }
//
// /**
// * Destroys main container.
// */
// public static void destroy() {
// if(mainContainer instanceof Window) {
// ((Window)mainContainer).dispose();
// } else {
// //do nothing
// }
// }
//
// /**
// * Shows error message to user.
// * @param msg
// */
// public static void showErrMsg(String msg) {
// JOptionPane.showMessageDialog((Container)mainContainer, msg);
// }
//
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/view/container/MainFrame.java
// public class MainFrame extends javax.swing.JFrame {
//
// /**
// * Creates new form Main
// */
// public MainFrame() {
// initComponents();
// setBounds(Config.FRAME_STARTING_X, Config.FRAME_STARTING_Y, Config.FRAME_WIDTH, Config.FRAME_HEIGHT);
// }
//
// /**
// * This method is called from within the constructor to initialize the form.
// * WARNING: Do NOT modify this code. The content of this method is always
// * regenerated by the Form Editor.
// */
// @SuppressWarnings("unchecked")
// // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
// private void initComponents() {
//
// setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
// setTitle("ESignUI-SwingAPP");
// getContentPane().setLayout(null);
//
// pack();
// }// </editor-fold>//GEN-END:initComponents
//
// // Variables declaration - do not modify//GEN-BEGIN:variables
// // End of variables declaration//GEN-END:variables
//
// }
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/run/StartFrame.java
import tr.gov.turkiye.esignuidesk.view.container.MainFrame;
import tr.gov.turkiye.esignuidesk.controller.GUIManager;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.run;
/**
* Runs application on JFrame.
*
* @author iakpolat
*/
public class StartFrame {
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) { | java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); |
Turksat/ESign | ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/run/StartFrame.java | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/GUIManager.java
// public class GUIManager {
// public static RootPaneContainer mainContainer;
// public static JPanel curPane;
//
// /**
// * Removes old screen with given pane.
// *
// * @param pane
// */
// public static void changeScreen(JPanel pane) {
// mainContainer.getContentPane().remove(curPane);
// curPane = pane;
// mainContainer.getContentPane().add(pane);
// mainContainer.getContentPane().repaint();
// GUIHelper.requestFocus(pane);
// }
//
// /**
// * Searches pane with given name inside current panel.
// * If pane is found, replaces old pane with new pane.
// *
// * @param oldPaneName
// * @param newPane
// */
// public static void replacePane(String oldPaneName, JPanel newPane) {
// Component[] components = curPane.getComponents();
// JPanel oldPane = null;
// for(Component comp: components) {
// if(comp.getName()!=null&&comp.getName().equals(oldPaneName)&&comp instanceof JPanel) {
// oldPane = (JPanel) comp;
// break;
// }
// }
// if(oldPane==null) {
// GUIManager.showErrMsg("Component "+oldPaneName+ " not found");
// } else {
// newPane.setLocation(oldPane.getX(),oldPane.getY());
// newPane.setSize(oldPane.getWidth(),oldPane.getHeight());
// curPane.remove(oldPane);
// curPane.add(newPane);
// curPane.repaint();
// GUIHelper.requestFocus(newPane);
// }
// }
//
// /**
// * Initialize main container as RootPaneContainer(such as japplet or jframe)
// * @param container
// */
// public static void init(RootPaneContainer container) {
// mainContainer = container;
// curPane = new CardSelectScreen();
// mainContainer.getContentPane().add(curPane);
// ((Container)mainContainer).setVisible(true);
// }
//
// /**
// * Destroys main container.
// */
// public static void destroy() {
// if(mainContainer instanceof Window) {
// ((Window)mainContainer).dispose();
// } else {
// //do nothing
// }
// }
//
// /**
// * Shows error message to user.
// * @param msg
// */
// public static void showErrMsg(String msg) {
// JOptionPane.showMessageDialog((Container)mainContainer, msg);
// }
//
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/view/container/MainFrame.java
// public class MainFrame extends javax.swing.JFrame {
//
// /**
// * Creates new form Main
// */
// public MainFrame() {
// initComponents();
// setBounds(Config.FRAME_STARTING_X, Config.FRAME_STARTING_Y, Config.FRAME_WIDTH, Config.FRAME_HEIGHT);
// }
//
// /**
// * This method is called from within the constructor to initialize the form.
// * WARNING: Do NOT modify this code. The content of this method is always
// * regenerated by the Form Editor.
// */
// @SuppressWarnings("unchecked")
// // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
// private void initComponents() {
//
// setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
// setTitle("ESignUI-SwingAPP");
// getContentPane().setLayout(null);
//
// pack();
// }// </editor-fold>//GEN-END:initComponents
//
// // Variables declaration - do not modify//GEN-BEGIN:variables
// // End of variables declaration//GEN-END:variables
//
// }
| import tr.gov.turkiye.esignuidesk.view.container.MainFrame;
import tr.gov.turkiye.esignuidesk.controller.GUIManager; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.run;
/**
* Runs application on JFrame.
*
* @author iakpolat
*/
public class StartFrame {
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() { | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/GUIManager.java
// public class GUIManager {
// public static RootPaneContainer mainContainer;
// public static JPanel curPane;
//
// /**
// * Removes old screen with given pane.
// *
// * @param pane
// */
// public static void changeScreen(JPanel pane) {
// mainContainer.getContentPane().remove(curPane);
// curPane = pane;
// mainContainer.getContentPane().add(pane);
// mainContainer.getContentPane().repaint();
// GUIHelper.requestFocus(pane);
// }
//
// /**
// * Searches pane with given name inside current panel.
// * If pane is found, replaces old pane with new pane.
// *
// * @param oldPaneName
// * @param newPane
// */
// public static void replacePane(String oldPaneName, JPanel newPane) {
// Component[] components = curPane.getComponents();
// JPanel oldPane = null;
// for(Component comp: components) {
// if(comp.getName()!=null&&comp.getName().equals(oldPaneName)&&comp instanceof JPanel) {
// oldPane = (JPanel) comp;
// break;
// }
// }
// if(oldPane==null) {
// GUIManager.showErrMsg("Component "+oldPaneName+ " not found");
// } else {
// newPane.setLocation(oldPane.getX(),oldPane.getY());
// newPane.setSize(oldPane.getWidth(),oldPane.getHeight());
// curPane.remove(oldPane);
// curPane.add(newPane);
// curPane.repaint();
// GUIHelper.requestFocus(newPane);
// }
// }
//
// /**
// * Initialize main container as RootPaneContainer(such as japplet or jframe)
// * @param container
// */
// public static void init(RootPaneContainer container) {
// mainContainer = container;
// curPane = new CardSelectScreen();
// mainContainer.getContentPane().add(curPane);
// ((Container)mainContainer).setVisible(true);
// }
//
// /**
// * Destroys main container.
// */
// public static void destroy() {
// if(mainContainer instanceof Window) {
// ((Window)mainContainer).dispose();
// } else {
// //do nothing
// }
// }
//
// /**
// * Shows error message to user.
// * @param msg
// */
// public static void showErrMsg(String msg) {
// JOptionPane.showMessageDialog((Container)mainContainer, msg);
// }
//
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/view/container/MainFrame.java
// public class MainFrame extends javax.swing.JFrame {
//
// /**
// * Creates new form Main
// */
// public MainFrame() {
// initComponents();
// setBounds(Config.FRAME_STARTING_X, Config.FRAME_STARTING_Y, Config.FRAME_WIDTH, Config.FRAME_HEIGHT);
// }
//
// /**
// * This method is called from within the constructor to initialize the form.
// * WARNING: Do NOT modify this code. The content of this method is always
// * regenerated by the Form Editor.
// */
// @SuppressWarnings("unchecked")
// // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
// private void initComponents() {
//
// setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
// setTitle("ESignUI-SwingAPP");
// getContentPane().setLayout(null);
//
// pack();
// }// </editor-fold>//GEN-END:initComponents
//
// // Variables declaration - do not modify//GEN-BEGIN:variables
// // End of variables declaration//GEN-END:variables
//
// }
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/run/StartFrame.java
import tr.gov.turkiye.esignuidesk.view.container.MainFrame;
import tr.gov.turkiye.esignuidesk.controller.GUIManager;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.run;
/**
* Runs application on JFrame.
*
* @author iakpolat
*/
public class StartFrame {
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() { | GUIManager.init(new MainFrame()); |
Turksat/ESign | ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/support/AnnotationHelper.java | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/LogManager.java
// public class LogManager {
// /**
// * Handles error and shows message pane if desired.
// * In addition message of message pane can be set if msg parameter is given.
// * If its null then throwable message is used.
// *
// * @param e
// * @param showMsgPane
// * @param msg
// */
// public static void handleError(Throwable e, boolean showMsgPane, String msg) {
// if(e!=null)
// catchErrMsg(e);
// if(showMsgPane) {
// if(msg!=null)
// GUIManager.showErrMsg(msg);
// else
// if(e!=null)
// GUIManager.showErrMsg(e.getMessage());
// }
// }
//
// /**
// * Catches exception and treats according to developer's wish.
// * @param e
// */
// private static void catchErrMsg(Throwable e) {
// if(Config.DEBUG_TYPE==1) {
// printConsoleErrMsg(e);
// } else if(Config.DEBUG_TYPE==2){
// printConsoleErrMsg(e.getLocalizedMessage());
// } else if(Config.DEBUG_TYPE==3) {
// //Should be handled if wanna be used
// }
// }
//
// /**
// * Print stack trace to console.
// * @param e
// */
// private static void printConsoleErrMsg(Throwable e) {
// e.printStackTrace();
// }
//
// /**
// * Prints error message to console.
// * @param msg
// */
// private static void printConsoleErrMsg(String msg) {
// System.out.println(msg);
// }
// }
| import java.lang.reflect.Method;
import tr.gov.turkiye.esignuidesk.annotation.FocusOwner;
import tr.gov.turkiye.esignuidesk.controller.LogManager;
import java.awt.Component; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.support;
/**
*
* @author iakpolat
*/
public class AnnotationHelper {
/**
* FocusOwner component must return component otherwise its accepted that given class has no focus owner.
* @param comp
* @return
*/
public static Component getFocusableComponent(Component comp) {
Method[] methods = comp.getClass().getMethods();
for(Method method: methods) {
if(method.getAnnotation(FocusOwner.class)!=null) {
try {
return (Component) method.invoke(comp);
} catch (Throwable ex) { | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/LogManager.java
// public class LogManager {
// /**
// * Handles error and shows message pane if desired.
// * In addition message of message pane can be set if msg parameter is given.
// * If its null then throwable message is used.
// *
// * @param e
// * @param showMsgPane
// * @param msg
// */
// public static void handleError(Throwable e, boolean showMsgPane, String msg) {
// if(e!=null)
// catchErrMsg(e);
// if(showMsgPane) {
// if(msg!=null)
// GUIManager.showErrMsg(msg);
// else
// if(e!=null)
// GUIManager.showErrMsg(e.getMessage());
// }
// }
//
// /**
// * Catches exception and treats according to developer's wish.
// * @param e
// */
// private static void catchErrMsg(Throwable e) {
// if(Config.DEBUG_TYPE==1) {
// printConsoleErrMsg(e);
// } else if(Config.DEBUG_TYPE==2){
// printConsoleErrMsg(e.getLocalizedMessage());
// } else if(Config.DEBUG_TYPE==3) {
// //Should be handled if wanna be used
// }
// }
//
// /**
// * Print stack trace to console.
// * @param e
// */
// private static void printConsoleErrMsg(Throwable e) {
// e.printStackTrace();
// }
//
// /**
// * Prints error message to console.
// * @param msg
// */
// private static void printConsoleErrMsg(String msg) {
// System.out.println(msg);
// }
// }
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/support/AnnotationHelper.java
import java.lang.reflect.Method;
import tr.gov.turkiye.esignuidesk.annotation.FocusOwner;
import tr.gov.turkiye.esignuidesk.controller.LogManager;
import java.awt.Component;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.support;
/**
*
* @author iakpolat
*/
public class AnnotationHelper {
/**
* FocusOwner component must return component otherwise its accepted that given class has no focus owner.
* @param comp
* @return
*/
public static Component getFocusableComponent(Component comp) {
Method[] methods = comp.getClass().getMethods();
for(Method method: methods) {
if(method.getAnnotation(FocusOwner.class)!=null) {
try {
return (Component) method.invoke(comp);
} catch (Throwable ex) { | LogManager.handleError(ex, false, null); |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/util/Util.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
| import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.util;
/**
*
* @author sercan
*/
public class Util {
/**
* Gets bytes of file
*
* @param fileName
* @return bytes of file.
* @throws FileNotFoundException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public static byte[] getContent(String fileName) throws FileNotFoundException, NoSuchAlgorithmException, IOException {
InputStream dataInputStream = new FileInputStream(fileName);
// we buffer the content to have it after hashing for the PKCS#7 content
ByteArrayOutputStream contentBuffer = new ByteArrayOutputStream();
byte[] dataBuffer = new byte[1024];
int bytesRead;
// feed all data from the input stream to the message digest
while ((bytesRead = dataInputStream.read(dataBuffer)) >= 0) {
// and buffer the data
contentBuffer.write(dataBuffer, 0, bytesRead);
}
contentBuffer.close();
return contentBuffer.toByteArray();
}
/**
* writes bytes to file.
*
* @param fileName
* @param content
* @throws FileNotFoundException
* @throws IOException
*/
public static void writeContent(String fileName, byte[] content) throws FileNotFoundException, IOException {
OutputStream signatureOutput = new FileOutputStream(fileName);
signatureOutput.write(content);
signatureOutput.flush();
signatureOutput.close();
}
/**
* Performs a final update on the digest using the specified array of bytes,
* then completes the digest computation.
*
* @param input the input to be updated before the digest is completed.
* @return the array of bytes for the resulting hash value
* @throws tr.gov.turkiye.esign.exception.SmartCardException
*/ | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/util/Util.java
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.util;
/**
*
* @author sercan
*/
public class Util {
/**
* Gets bytes of file
*
* @param fileName
* @return bytes of file.
* @throws FileNotFoundException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public static byte[] getContent(String fileName) throws FileNotFoundException, NoSuchAlgorithmException, IOException {
InputStream dataInputStream = new FileInputStream(fileName);
// we buffer the content to have it after hashing for the PKCS#7 content
ByteArrayOutputStream contentBuffer = new ByteArrayOutputStream();
byte[] dataBuffer = new byte[1024];
int bytesRead;
// feed all data from the input stream to the message digest
while ((bytesRead = dataInputStream.read(dataBuffer)) >= 0) {
// and buffer the data
contentBuffer.write(dataBuffer, 0, bytesRead);
}
contentBuffer.close();
return contentBuffer.toByteArray();
}
/**
* writes bytes to file.
*
* @param fileName
* @param content
* @throws FileNotFoundException
* @throws IOException
*/
public static void writeContent(String fileName, byte[] content) throws FileNotFoundException, IOException {
OutputStream signatureOutput = new FileOutputStream(fileName);
signatureOutput.write(content);
signatureOutput.flush();
signatureOutput.close();
}
/**
* Performs a final update on the digest using the specified array of bytes,
* then completes the digest computation.
*
* @param input the input to be updated before the digest is completed.
* @return the array of bytes for the resulting hash value
* @throws tr.gov.turkiye.esign.exception.SmartCardException
*/ | public static byte[] digestSHA256(byte[] input) throws SmartCardException { |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/util/Util.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
| import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.util;
/**
*
* @author sercan
*/
public class Util {
/**
* Gets bytes of file
*
* @param fileName
* @return bytes of file.
* @throws FileNotFoundException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public static byte[] getContent(String fileName) throws FileNotFoundException, NoSuchAlgorithmException, IOException {
InputStream dataInputStream = new FileInputStream(fileName);
// we buffer the content to have it after hashing for the PKCS#7 content
ByteArrayOutputStream contentBuffer = new ByteArrayOutputStream();
byte[] dataBuffer = new byte[1024];
int bytesRead;
// feed all data from the input stream to the message digest
while ((bytesRead = dataInputStream.read(dataBuffer)) >= 0) {
// and buffer the data
contentBuffer.write(dataBuffer, 0, bytesRead);
}
contentBuffer.close();
return contentBuffer.toByteArray();
}
/**
* writes bytes to file.
*
* @param fileName
* @param content
* @throws FileNotFoundException
* @throws IOException
*/
public static void writeContent(String fileName, byte[] content) throws FileNotFoundException, IOException {
OutputStream signatureOutput = new FileOutputStream(fileName);
signatureOutput.write(content);
signatureOutput.flush();
signatureOutput.close();
}
/**
* Performs a final update on the digest using the specified array of bytes,
* then completes the digest computation.
*
* @param input the input to be updated before the digest is completed.
* @return the array of bytes for the resulting hash value
* @throws tr.gov.turkiye.esign.exception.SmartCardException
*/
public static byte[] digestSHA256(byte[] input) throws SmartCardException {
// we do digesting outside the card, because some cards do not support on-card hashing
MessageDigest digestEngine;
try {
digestEngine = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) { | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/util/Util.java
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.util;
/**
*
* @author sercan
*/
public class Util {
/**
* Gets bytes of file
*
* @param fileName
* @return bytes of file.
* @throws FileNotFoundException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public static byte[] getContent(String fileName) throws FileNotFoundException, NoSuchAlgorithmException, IOException {
InputStream dataInputStream = new FileInputStream(fileName);
// we buffer the content to have it after hashing for the PKCS#7 content
ByteArrayOutputStream contentBuffer = new ByteArrayOutputStream();
byte[] dataBuffer = new byte[1024];
int bytesRead;
// feed all data from the input stream to the message digest
while ((bytesRead = dataInputStream.read(dataBuffer)) >= 0) {
// and buffer the data
contentBuffer.write(dataBuffer, 0, bytesRead);
}
contentBuffer.close();
return contentBuffer.toByteArray();
}
/**
* writes bytes to file.
*
* @param fileName
* @param content
* @throws FileNotFoundException
* @throws IOException
*/
public static void writeContent(String fileName, byte[] content) throws FileNotFoundException, IOException {
OutputStream signatureOutput = new FileOutputStream(fileName);
signatureOutput.write(content);
signatureOutput.flush();
signatureOutput.close();
}
/**
* Performs a final update on the digest using the specified array of bytes,
* then completes the digest computation.
*
* @param input the input to be updated before the digest is completed.
* @return the array of bytes for the resulting hash value
* @throws tr.gov.turkiye.esign.exception.SmartCardException
*/
public static byte[] digestSHA256(byte[] input) throws SmartCardException {
// we do digesting outside the card, because some cards do not support on-card hashing
MessageDigest digestEngine;
try {
digestEngine = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) { | throw new SmartCardException(ExceptionSupport.getValue("NoSuchAlgorithmException"), ex); |
Turksat/ESign | ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/props/ScreenProperties.java | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
| import tr.gov.turkiye.esignuidesk.config.Config;
import java.util.ResourceBundle; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.props;
/**
*
* @author iakpolat
*/
public class ScreenProperties {
private static ResourceBundle bundle;
public static String getValue(final String key) {
if (bundle == null) { | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/props/ScreenProperties.java
import tr.gov.turkiye.esignuidesk.config.Config;
import java.util.ResourceBundle;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.props;
/**
*
* @author iakpolat
*/
public class ScreenProperties {
private static ResourceBundle bundle;
public static String getValue(final String key) {
if (bundle == null) { | bundle = ResourceBundle.getBundle("screen_values", Config.locale); |
Turksat/ESign | ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/support/Utils.java | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/LogManager.java
// public class LogManager {
// /**
// * Handles error and shows message pane if desired.
// * In addition message of message pane can be set if msg parameter is given.
// * If its null then throwable message is used.
// *
// * @param e
// * @param showMsgPane
// * @param msg
// */
// public static void handleError(Throwable e, boolean showMsgPane, String msg) {
// if(e!=null)
// catchErrMsg(e);
// if(showMsgPane) {
// if(msg!=null)
// GUIManager.showErrMsg(msg);
// else
// if(e!=null)
// GUIManager.showErrMsg(e.getMessage());
// }
// }
//
// /**
// * Catches exception and treats according to developer's wish.
// * @param e
// */
// private static void catchErrMsg(Throwable e) {
// if(Config.DEBUG_TYPE==1) {
// printConsoleErrMsg(e);
// } else if(Config.DEBUG_TYPE==2){
// printConsoleErrMsg(e.getLocalizedMessage());
// } else if(Config.DEBUG_TYPE==3) {
// //Should be handled if wanna be used
// }
// }
//
// /**
// * Print stack trace to console.
// * @param e
// */
// private static void printConsoleErrMsg(Throwable e) {
// e.printStackTrace();
// }
//
// /**
// * Prints error message to console.
// * @param msg
// */
// private static void printConsoleErrMsg(String msg) {
// System.out.println(msg);
// }
// }
| import java.awt.Component;
import java.awt.Point;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JButton;
import tr.gov.turkiye.esignuidesk.config.Config;
import tr.gov.turkiye.esignuidesk.controller.LogManager; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.support;
/**
*
* @author iakpolat
*/
public class Utils {
/**
* Takes number from button name.
* @param btn
* @return
*/
public static int getButtonNumber(JButton btn) {
int value = -1;
String svalue = btn.getText();
try {
value = Integer.parseInt(svalue);
} catch(NumberFormatException nfe) {
}
return value;
}
/**
* Puts component to different positions.
*
* @param list ArrayList(Component)
* @param colCount Max how many columns there will be on a row.
* @param x Starting x position
* @param y Starting y position
* @param width Width of component
* @param height Height of component
*/
public static void randomizePositions(ArrayList list, int colCount, int x, int y, int width, int height) {
ArrayList<Component> tmpList;
try {
tmpList = (ArrayList<Component>) list.clone();
} catch(Exception e) { //If a cast error is occurred | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/LogManager.java
// public class LogManager {
// /**
// * Handles error and shows message pane if desired.
// * In addition message of message pane can be set if msg parameter is given.
// * If its null then throwable message is used.
// *
// * @param e
// * @param showMsgPane
// * @param msg
// */
// public static void handleError(Throwable e, boolean showMsgPane, String msg) {
// if(e!=null)
// catchErrMsg(e);
// if(showMsgPane) {
// if(msg!=null)
// GUIManager.showErrMsg(msg);
// else
// if(e!=null)
// GUIManager.showErrMsg(e.getMessage());
// }
// }
//
// /**
// * Catches exception and treats according to developer's wish.
// * @param e
// */
// private static void catchErrMsg(Throwable e) {
// if(Config.DEBUG_TYPE==1) {
// printConsoleErrMsg(e);
// } else if(Config.DEBUG_TYPE==2){
// printConsoleErrMsg(e.getLocalizedMessage());
// } else if(Config.DEBUG_TYPE==3) {
// //Should be handled if wanna be used
// }
// }
//
// /**
// * Print stack trace to console.
// * @param e
// */
// private static void printConsoleErrMsg(Throwable e) {
// e.printStackTrace();
// }
//
// /**
// * Prints error message to console.
// * @param msg
// */
// private static void printConsoleErrMsg(String msg) {
// System.out.println(msg);
// }
// }
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/support/Utils.java
import java.awt.Component;
import java.awt.Point;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JButton;
import tr.gov.turkiye.esignuidesk.config.Config;
import tr.gov.turkiye.esignuidesk.controller.LogManager;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.support;
/**
*
* @author iakpolat
*/
public class Utils {
/**
* Takes number from button name.
* @param btn
* @return
*/
public static int getButtonNumber(JButton btn) {
int value = -1;
String svalue = btn.getText();
try {
value = Integer.parseInt(svalue);
} catch(NumberFormatException nfe) {
}
return value;
}
/**
* Puts component to different positions.
*
* @param list ArrayList(Component)
* @param colCount Max how many columns there will be on a row.
* @param x Starting x position
* @param y Starting y position
* @param width Width of component
* @param height Height of component
*/
public static void randomizePositions(ArrayList list, int colCount, int x, int y, int width, int height) {
ArrayList<Component> tmpList;
try {
tmpList = (ArrayList<Component>) list.clone();
} catch(Exception e) { //If a cast error is occurred | LogManager.handleError(e, true, null); |
Turksat/ESign | ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/support/Utils.java | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/LogManager.java
// public class LogManager {
// /**
// * Handles error and shows message pane if desired.
// * In addition message of message pane can be set if msg parameter is given.
// * If its null then throwable message is used.
// *
// * @param e
// * @param showMsgPane
// * @param msg
// */
// public static void handleError(Throwable e, boolean showMsgPane, String msg) {
// if(e!=null)
// catchErrMsg(e);
// if(showMsgPane) {
// if(msg!=null)
// GUIManager.showErrMsg(msg);
// else
// if(e!=null)
// GUIManager.showErrMsg(e.getMessage());
// }
// }
//
// /**
// * Catches exception and treats according to developer's wish.
// * @param e
// */
// private static void catchErrMsg(Throwable e) {
// if(Config.DEBUG_TYPE==1) {
// printConsoleErrMsg(e);
// } else if(Config.DEBUG_TYPE==2){
// printConsoleErrMsg(e.getLocalizedMessage());
// } else if(Config.DEBUG_TYPE==3) {
// //Should be handled if wanna be used
// }
// }
//
// /**
// * Print stack trace to console.
// * @param e
// */
// private static void printConsoleErrMsg(Throwable e) {
// e.printStackTrace();
// }
//
// /**
// * Prints error message to console.
// * @param msg
// */
// private static void printConsoleErrMsg(String msg) {
// System.out.println(msg);
// }
// }
| import java.awt.Component;
import java.awt.Point;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JButton;
import tr.gov.turkiye.esignuidesk.config.Config;
import tr.gov.turkiye.esignuidesk.controller.LogManager; | * @param list
* @param colCount
* @param x
* @param y
* @param width
* @param height
*/
public static void setComponentPositions(ArrayList list, int colCount, int x, int y, int width, int height) {
Point point = new Point(x, y-height);
for(int i=0; i<list.size(); i++) {
if(list.get(i) instanceof Component) {
if((i)%colCount==0) {
point.setLocation(x, point.y+height);
} else {
point.setLocation(point.x+width, point.y);
}
((Component)list.get(i)).setLocation(point);
} else {
System.out.println("Object must extends component.");
return;
}
}
}
/**
* Formats date in default format of program.
* @param date
* @return
*/
public static String formatDate(Date date) { | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/LogManager.java
// public class LogManager {
// /**
// * Handles error and shows message pane if desired.
// * In addition message of message pane can be set if msg parameter is given.
// * If its null then throwable message is used.
// *
// * @param e
// * @param showMsgPane
// * @param msg
// */
// public static void handleError(Throwable e, boolean showMsgPane, String msg) {
// if(e!=null)
// catchErrMsg(e);
// if(showMsgPane) {
// if(msg!=null)
// GUIManager.showErrMsg(msg);
// else
// if(e!=null)
// GUIManager.showErrMsg(e.getMessage());
// }
// }
//
// /**
// * Catches exception and treats according to developer's wish.
// * @param e
// */
// private static void catchErrMsg(Throwable e) {
// if(Config.DEBUG_TYPE==1) {
// printConsoleErrMsg(e);
// } else if(Config.DEBUG_TYPE==2){
// printConsoleErrMsg(e.getLocalizedMessage());
// } else if(Config.DEBUG_TYPE==3) {
// //Should be handled if wanna be used
// }
// }
//
// /**
// * Print stack trace to console.
// * @param e
// */
// private static void printConsoleErrMsg(Throwable e) {
// e.printStackTrace();
// }
//
// /**
// * Prints error message to console.
// * @param msg
// */
// private static void printConsoleErrMsg(String msg) {
// System.out.println(msg);
// }
// }
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/support/Utils.java
import java.awt.Component;
import java.awt.Point;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JButton;
import tr.gov.turkiye.esignuidesk.config.Config;
import tr.gov.turkiye.esignuidesk.controller.LogManager;
* @param list
* @param colCount
* @param x
* @param y
* @param width
* @param height
*/
public static void setComponentPositions(ArrayList list, int colCount, int x, int y, int width, int height) {
Point point = new Point(x, y-height);
for(int i=0; i<list.size(); i++) {
if(list.get(i) instanceof Component) {
if((i)%colCount==0) {
point.setLocation(x, point.y+height);
} else {
point.setLocation(point.x+width, point.y);
}
((Component)list.get(i)).setLocation(point);
} else {
System.out.println("Object must extends component.");
return;
}
}
}
/**
* Formats date in default format of program.
* @param date
* @return
*/
public static String formatDate(Date date) { | SimpleDateFormat format = new SimpleDateFormat(Config.dateSFormat); |
Turksat/ESign | ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/LogManager.java | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
| import tr.gov.turkiye.esignuidesk.config.Config; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.controller;
/**
*
* This class should be used to handle log messages.
* As method of this class could be used as a skeleton structure, it can also be used directly.
*
* @author iakpolat
*/
public class LogManager {
/**
* Handles error and shows message pane if desired.
* In addition message of message pane can be set if msg parameter is given.
* If its null then throwable message is used.
*
* @param e
* @param showMsgPane
* @param msg
*/
public static void handleError(Throwable e, boolean showMsgPane, String msg) {
if(e!=null)
catchErrMsg(e);
if(showMsgPane) {
if(msg!=null)
GUIManager.showErrMsg(msg);
else
if(e!=null)
GUIManager.showErrMsg(e.getMessage());
}
}
/**
* Catches exception and treats according to developer's wish.
* @param e
*/
private static void catchErrMsg(Throwable e) { | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/controller/LogManager.java
import tr.gov.turkiye.esignuidesk.config.Config;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.controller;
/**
*
* This class should be used to handle log messages.
* As method of this class could be used as a skeleton structure, it can also be used directly.
*
* @author iakpolat
*/
public class LogManager {
/**
* Handles error and shows message pane if desired.
* In addition message of message pane can be set if msg parameter is given.
* If its null then throwable message is used.
*
* @param e
* @param showMsgPane
* @param msg
*/
public static void handleError(Throwable e, boolean showMsgPane, String msg) {
if(e!=null)
catchErrMsg(e);
if(showMsgPane) {
if(msg!=null)
GUIManager.showErrMsg(msg);
else
if(e!=null)
GUIManager.showErrMsg(e.getMessage());
}
}
/**
* Catches exception and treats according to developer's wish.
* @param e
*/
private static void catchErrMsg(Throwable e) { | if(Config.DEBUG_TYPE==1) { |
Turksat/ESign | ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/run/StartApplet.java | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/view/container/MainApplet.java
// public class MainApplet extends JApplet {
//
// private JPanel curPane;
//
// /**
// * Initialization method that will be called after the applet is loaded into
// * the browser.
// */
// @Override
// public void init() {
// try {
// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
// if ("Nimbus".equals(info.getName())) {
// javax.swing.UIManager.setLookAndFeel(info.getClassName());
// break;
// }
// }
// } catch (ClassNotFoundException ex) {
// java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (InstantiationException ex) {
// java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (IllegalAccessException ex) {
// java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (javax.swing.UnsupportedLookAndFeelException ex) {
// java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// }
//
// java.awt.EventQueue.invokeLater(new Runnable() {
// @Override
// public void run() {
// setLayout(null);
// setBounds(0,0,530,250);
// GUIManager.init(MainApplet.this);
// setVisible(true);
//
// }
// });
// // TODO start asynchronous download of heavy resources
//
// }
//
// // TODO overwrite start(), stop() and destroy() methods
//
// public JPanel getCurPane() {
// return curPane;
// }
//
// public void setCurPane(JPanel curPane) {
// this.curPane = curPane;
// }
//
// public void dispose() {
// //do nothing
// }
// }
| import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import tr.gov.turkiye.esignuidesk.config.Config;
import tr.gov.turkiye.esignuidesk.view.container.MainApplet; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.run;
/**
*
* This class is used to test whether applet could start successfully or not.
*
* @author iakpolat
*/
public class StartApplet {
private static MainApplet applet;
public static void init(MainApplet app) {
applet = app;
}
public static void run() {
JFrame frame = new JFrame(); | // Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/config/Config.java
// public class Config {
// //Main frame configuration
// public static final int FRAME_WIDTH = 530;
// public static final int FRAME_HEIGHT = 275;
// public static final int FRAME_STARTING_X = 30;
// public static final int FRAME_STARTING_Y = 30;
//
// //Main panel configuration
// public static final int DEF_PANEL_WIDTH = FRAME_WIDTH;
// public static final int DEF_PANEL_HEIGHT = FRAME_HEIGHT-25;
// public static final int DEF_PANEL_STARTING_X = 0;
// public static final int DEF_PANEL_STARTING_Y = 0;
//
// public static final Locale locale = new Locale("tr","TR");
// // public static final Locale locale = new Locale("en","EN");
//
// //Screen ids are used on logic manager to interpret where requests are coming from.
// public static final int CARD_SELECT_SCREEN_ID = 1;
// public static final int CERT_SHOW_SCREEN_ID = 2;
// public static final int PIN_PANE_ID = 3;
// public static final int DONE_PANE_ID = 4;
//
// public static final int DEBUG_TYPE = 1; //0=do nothing,1=print stack trace to console,2=print localized message to console, 3=send to server etc.
//
// public static final String certInfoPaneName = "certInfoPane";
// public static final String certPaneName = "certPane";
// public static final String pinPaneName = "pinPane";
//
// public static final Point pinBtnStartPoint = new Point(20, 60);
// public static final Dimension numberBtnSize = new Dimension(40,40);
//
// public static final String defaultFileName = "signed_document_";
//
// public static final String dateSFormat = "dd.MM.yyyy";
// public static final String timeSFormat = "dd-MM-yyyy_hh_mm_ss";
// }
//
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/view/container/MainApplet.java
// public class MainApplet extends JApplet {
//
// private JPanel curPane;
//
// /**
// * Initialization method that will be called after the applet is loaded into
// * the browser.
// */
// @Override
// public void init() {
// try {
// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
// if ("Nimbus".equals(info.getName())) {
// javax.swing.UIManager.setLookAndFeel(info.getClassName());
// break;
// }
// }
// } catch (ClassNotFoundException ex) {
// java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (InstantiationException ex) {
// java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (IllegalAccessException ex) {
// java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// } catch (javax.swing.UnsupportedLookAndFeelException ex) {
// java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
// }
//
// java.awt.EventQueue.invokeLater(new Runnable() {
// @Override
// public void run() {
// setLayout(null);
// setBounds(0,0,530,250);
// GUIManager.init(MainApplet.this);
// setVisible(true);
//
// }
// });
// // TODO start asynchronous download of heavy resources
//
// }
//
// // TODO overwrite start(), stop() and destroy() methods
//
// public JPanel getCurPane() {
// return curPane;
// }
//
// public void setCurPane(JPanel curPane) {
// this.curPane = curPane;
// }
//
// public void dispose() {
// //do nothing
// }
// }
// Path: ESignUI/src/main/java/tr/gov/turkiye/esignuidesk/run/StartApplet.java
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import tr.gov.turkiye.esignuidesk.config.Config;
import tr.gov.turkiye.esignuidesk.view.container.MainApplet;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esignuidesk.run;
/**
*
* This class is used to test whether applet could start successfully or not.
*
* @author iakpolat
*/
public class StartApplet {
private static MainApplet applet;
public static void init(MainApplet app) {
applet = app;
}
public static void run() {
JFrame frame = new JFrame(); | frame.setSize(Config.FRAME_WIDTH, Config.FRAME_HEIGHT); |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/cms/SignedData.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
| import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.DERTaggedObject;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.cms;
/**
* The class identifies the signed-data content.<br>
* <br>
* SignedData ::= DERSequence {<br>
* version CMSVersion,<br>
* digestAlgorithms DigestAlgorithmIdentifiers,<br>
* encapContentInfo EncapsulatedContentInfo,<br>
* certificates [0] IMPLICIT CertificateSet OPTIONAL,<br>
* signerInfos SignerInfos }<br>
* <br>
* DigestAlgorithmIdentifiers ::= DERSet OF DigestAlgorithmIdentifier<br>
* <br>
* EncapsulatedContentInfo ::= DERSequence {<br>
eContentType ContentType,<br>
eContent [0] EXPLICIT DEROctetString OPTIONAL }<br>
* <br>
ContentType ::= ASN1ObjectIdentifier
* <br>
* CertificateSet ::= DERSet OF CertificateChoices<br>
* <br>
* CertificateChoices ::= CHOICE {<br>
* certificate Certificate<br>
* }<br>
* <br>
* <br>
* SignerInfos ::= DERSet OF SignerInfo<br>
*
* @author sercan
*/
public class SignedData implements CMSObject {
/**
* the bytes of content to be signed.
*/
private byte[] content;
/**
* list of signer certificates
*/
private List<Certificate> certs;
/**
* list of signer infos
*/
private List<SignerInfo> signerInfos;
/**
* the hash algorithms used by the signers for digesting the content data is SHA256 or not
*/
private boolean isSHA256;
/**
* Creates instance of SignerData
* @param content the bytes of content to be signed.
* @param isSHA256 the hash algorithms used by the signers for digesting the content data is SHA256 or not
*/
public SignedData(byte[] content, boolean isSHA256) {
signerInfos = new ArrayList<>();
certs = new ArrayList<>();
this.content = content;
this.isSHA256 = isSHA256;
}
@Override | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/cms/SignedData.java
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.DERTaggedObject;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.cms;
/**
* The class identifies the signed-data content.<br>
* <br>
* SignedData ::= DERSequence {<br>
* version CMSVersion,<br>
* digestAlgorithms DigestAlgorithmIdentifiers,<br>
* encapContentInfo EncapsulatedContentInfo,<br>
* certificates [0] IMPLICIT CertificateSet OPTIONAL,<br>
* signerInfos SignerInfos }<br>
* <br>
* DigestAlgorithmIdentifiers ::= DERSet OF DigestAlgorithmIdentifier<br>
* <br>
* EncapsulatedContentInfo ::= DERSequence {<br>
eContentType ContentType,<br>
eContent [0] EXPLICIT DEROctetString OPTIONAL }<br>
* <br>
ContentType ::= ASN1ObjectIdentifier
* <br>
* CertificateSet ::= DERSet OF CertificateChoices<br>
* <br>
* CertificateChoices ::= CHOICE {<br>
* certificate Certificate<br>
* }<br>
* <br>
* <br>
* SignerInfos ::= DERSet OF SignerInfo<br>
*
* @author sercan
*/
public class SignedData implements CMSObject {
/**
* the bytes of content to be signed.
*/
private byte[] content;
/**
* list of signer certificates
*/
private List<Certificate> certs;
/**
* list of signer infos
*/
private List<SignerInfo> signerInfos;
/**
* the hash algorithms used by the signers for digesting the content data is SHA256 or not
*/
private boolean isSHA256;
/**
* Creates instance of SignerData
* @param content the bytes of content to be signed.
* @param isSHA256 the hash algorithms used by the signers for digesting the content data is SHA256 or not
*/
public SignedData(byte[] content, boolean isSHA256) {
signerInfos = new ArrayList<>();
certs = new ArrayList<>();
this.content = content;
this.isSHA256 = isSHA256;
}
@Override | public ASN1Object toASN1Object() throws SmartCardException { |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/cms/SignedData.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
| import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.DERTaggedObject;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport; | /**
* It is the signed content, consisting of a content
type identifier and the content itself
* @param content the bytes of content to be signed.
* @return DERSequence instance
*/
private ASN1Encodable getContentInfo(byte[] content) {
final ASN1EncodableVector v = new ASN1EncodableVector();
v.add(ObjectID.pkcs7_data);
DEROctetString ds = new DEROctetString(content);
DERTaggedObject to = new DERTaggedObject(true, 0, ds);
v.add(to);
DERSequence ddd = new DERSequence(v);
return ddd;
}
/**
* collection of certificates
* @return DERSet instance
* @throws SmartCardException
*/
private ASN1Encodable getCertificates() throws SmartCardException {
ASN1EncodableVector v = new ASN1EncodableVector();
for (Certificate cert : certs) {
try {
byte[] encodedCertificate = cert.getEncoded();
ASN1InputStream tempstream = new ASN1InputStream(new ByteArrayInputStream(encodedCertificate));
ASN1Primitive dob = tempstream.readObject();
v.add(dob);
}catch (CertificateEncodingException ex) { | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/cms/SignedData.java
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.DERTaggedObject;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport;
/**
* It is the signed content, consisting of a content
type identifier and the content itself
* @param content the bytes of content to be signed.
* @return DERSequence instance
*/
private ASN1Encodable getContentInfo(byte[] content) {
final ASN1EncodableVector v = new ASN1EncodableVector();
v.add(ObjectID.pkcs7_data);
DEROctetString ds = new DEROctetString(content);
DERTaggedObject to = new DERTaggedObject(true, 0, ds);
v.add(to);
DERSequence ddd = new DERSequence(v);
return ddd;
}
/**
* collection of certificates
* @return DERSet instance
* @throws SmartCardException
*/
private ASN1Encodable getCertificates() throws SmartCardException {
ASN1EncodableVector v = new ASN1EncodableVector();
for (Certificate cert : certs) {
try {
byte[] encodedCertificate = cert.getEncoded();
ASN1InputStream tempstream = new ASN1InputStream(new ByteArrayInputStream(encodedCertificate));
ASN1Primitive dob = tempstream.readObject();
v.add(dob);
}catch (CertificateEncodingException ex) { | throw new SmartCardException(ExceptionSupport.getValue("CertificateEncodingException"), ex); |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/cms/ContentInfo.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
| import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DEROutputStream;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.cms;
/**
* ContentInfo ::= DERSequence {<br>
contentType ContentType,<br>
content <br>
[0] EXPLICIT ANY DEFINED BY contentType }<br>
<br>
ContentType ::= ASN1ObjectIdentifier<br>
* <br>
* @author sercan
*/
public class ContentInfo implements CMSObject{
/**
* content type of data
*/
private ASN1ObjectIdentifier contentType;
/**
* content (SignedData instance)
*/
private SignedData signedData;
/**
* Creates ContentInfo instance
* @param contentType content type of data
* @param signedData content (SignedData instance)
*/
public ContentInfo(ASN1ObjectIdentifier contentType,SignedData signedData ){
this.signedData = signedData;
this.contentType = contentType;
}
/**
* Gets encoded bytes of this object
* @return the bytes of ContentInfo
* @throws SmartCardException
*/ | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/cms/ContentInfo.java
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DEROutputStream;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.cms;
/**
* ContentInfo ::= DERSequence {<br>
contentType ContentType,<br>
content <br>
[0] EXPLICIT ANY DEFINED BY contentType }<br>
<br>
ContentType ::= ASN1ObjectIdentifier<br>
* <br>
* @author sercan
*/
public class ContentInfo implements CMSObject{
/**
* content type of data
*/
private ASN1ObjectIdentifier contentType;
/**
* content (SignedData instance)
*/
private SignedData signedData;
/**
* Creates ContentInfo instance
* @param contentType content type of data
* @param signedData content (SignedData instance)
*/
public ContentInfo(ASN1ObjectIdentifier contentType,SignedData signedData ){
this.signedData = signedData;
this.contentType = contentType;
}
/**
* Gets encoded bytes of this object
* @return the bytes of ContentInfo
* @throws SmartCardException
*/ | public byte[] getEncoded() throws SmartCardException { |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/cms/ContentInfo.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
| import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DEROutputStream;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.cms;
/**
* ContentInfo ::= DERSequence {<br>
contentType ContentType,<br>
content <br>
[0] EXPLICIT ANY DEFINED BY contentType }<br>
<br>
ContentType ::= ASN1ObjectIdentifier<br>
* <br>
* @author sercan
*/
public class ContentInfo implements CMSObject{
/**
* content type of data
*/
private ASN1ObjectIdentifier contentType;
/**
* content (SignedData instance)
*/
private SignedData signedData;
/**
* Creates ContentInfo instance
* @param contentType content type of data
* @param signedData content (SignedData instance)
*/
public ContentInfo(ASN1ObjectIdentifier contentType,SignedData signedData ){
this.signedData = signedData;
this.contentType = contentType;
}
/**
* Gets encoded bytes of this object
* @return the bytes of ContentInfo
* @throws SmartCardException
*/
public byte[] getEncoded() throws SmartCardException {
try {
final ByteArrayOutputStream bOut = new ByteArrayOutputStream();
final DEROutputStream dout = new DEROutputStream(bOut);
dout.writeObject(toASN1Object());
dout.close();
return bOut.toByteArray();
} catch (IOException ex) { | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/exception/SmartCardException.java
// public class SmartCardException extends Exception {
//
// public SmartCardException(String s, Throwable t) {
// super(s, t);
// }
// }
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/support/ExceptionSupport.java
// public class ExceptionSupport {
//
// private static ResourceBundle bundle = null;
//
// public static String getValue(final String key) {
// if (bundle == null) {
// Locale locale = new Locale("tr", "TR");
// bundle = ResourceBundle.getBundle("exception/SmartCardExceptions", locale);
// }
// return bundle.getString(key);
// }
//
// }
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/cms/ContentInfo.java
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DEROutputStream;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
import tr.gov.turkiye.esign.exception.SmartCardException;
import tr.gov.turkiye.esign.support.ExceptionSupport;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.cms;
/**
* ContentInfo ::= DERSequence {<br>
contentType ContentType,<br>
content <br>
[0] EXPLICIT ANY DEFINED BY contentType }<br>
<br>
ContentType ::= ASN1ObjectIdentifier<br>
* <br>
* @author sercan
*/
public class ContentInfo implements CMSObject{
/**
* content type of data
*/
private ASN1ObjectIdentifier contentType;
/**
* content (SignedData instance)
*/
private SignedData signedData;
/**
* Creates ContentInfo instance
* @param contentType content type of data
* @param signedData content (SignedData instance)
*/
public ContentInfo(ASN1ObjectIdentifier contentType,SignedData signedData ){
this.signedData = signedData;
this.contentType = contentType;
}
/**
* Gets encoded bytes of this object
* @return the bytes of ContentInfo
* @throws SmartCardException
*/
public byte[] getEncoded() throws SmartCardException {
try {
final ByteArrayOutputStream bOut = new ByteArrayOutputStream();
final DEROutputStream dout = new DEROutputStream(bOut);
dout.writeObject(toASN1Object());
dout.close();
return bOut.toByteArray();
} catch (IOException ex) { | throw new SmartCardException(ExceptionSupport.getValue("IOException"), ex); |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/statics/OS.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSVersion.java
// public enum OSVersion {SPARC, SPARC_V9};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSNames.java
// public enum OSNames {WINDOWS, LINUX, MACOS, OTHER, SOLARIS};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSArch.java
// public enum OSArch {_32BIT, _64BIT};
| import tr.gov.turkiye.esign.enums.OSNames;
import tr.gov.turkiye.esign.enums.OSArch;
import java.util.Locale;
import tr.gov.turkiye.esign.enums.OSVersion; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.statics;
/**
*
* Includes supported operating systems.
*
* @author sercan
*/
public class OS {
final private static String WINDOWS = "windows";
final private static String LINUX = "linux";
final private static String MACOS = "mac";
final private static String SOLARIS = "solaris";
/**
* Gets user operating system.
*
* @return Return corresponding OS name. If user operation system is not supported returns OSNames.OTHER
*/ | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSVersion.java
// public enum OSVersion {SPARC, SPARC_V9};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSNames.java
// public enum OSNames {WINDOWS, LINUX, MACOS, OTHER, SOLARIS};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSArch.java
// public enum OSArch {_32BIT, _64BIT};
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/statics/OS.java
import tr.gov.turkiye.esign.enums.OSNames;
import tr.gov.turkiye.esign.enums.OSArch;
import java.util.Locale;
import tr.gov.turkiye.esign.enums.OSVersion;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.statics;
/**
*
* Includes supported operating systems.
*
* @author sercan
*/
public class OS {
final private static String WINDOWS = "windows";
final private static String LINUX = "linux";
final private static String MACOS = "mac";
final private static String SOLARIS = "solaris";
/**
* Gets user operating system.
*
* @return Return corresponding OS name. If user operation system is not supported returns OSNames.OTHER
*/ | public static OSNames getSystemOS() { |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/statics/OS.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSVersion.java
// public enum OSVersion {SPARC, SPARC_V9};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSNames.java
// public enum OSNames {WINDOWS, LINUX, MACOS, OTHER, SOLARIS};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSArch.java
// public enum OSArch {_32BIT, _64BIT};
| import tr.gov.turkiye.esign.enums.OSNames;
import tr.gov.turkiye.esign.enums.OSArch;
import java.util.Locale;
import tr.gov.turkiye.esign.enums.OSVersion; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.statics;
/**
*
* Includes supported operating systems.
*
* @author sercan
*/
public class OS {
final private static String WINDOWS = "windows";
final private static String LINUX = "linux";
final private static String MACOS = "mac";
final private static String SOLARIS = "solaris";
/**
* Gets user operating system.
*
* @return Return corresponding OS name. If user operation system is not supported returns OSNames.OTHER
*/
public static OSNames getSystemOS() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (osName.contains(WINDOWS)) {
return OSNames.WINDOWS;
} else if (osName.contains(LINUX)) {
return OSNames.LINUX;
} else if (osName.contains(MACOS)) {
return OSNames.MACOS;
} else if(osName.contains(SOLARIS)){
return OSNames.SOLARIS;
}else{
return OSNames.OTHER;
}
}
/**
* Gets bits of operating system.
*
* @return
*/ | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSVersion.java
// public enum OSVersion {SPARC, SPARC_V9};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSNames.java
// public enum OSNames {WINDOWS, LINUX, MACOS, OTHER, SOLARIS};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSArch.java
// public enum OSArch {_32BIT, _64BIT};
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/statics/OS.java
import tr.gov.turkiye.esign.enums.OSNames;
import tr.gov.turkiye.esign.enums.OSArch;
import java.util.Locale;
import tr.gov.turkiye.esign.enums.OSVersion;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.statics;
/**
*
* Includes supported operating systems.
*
* @author sercan
*/
public class OS {
final private static String WINDOWS = "windows";
final private static String LINUX = "linux";
final private static String MACOS = "mac";
final private static String SOLARIS = "solaris";
/**
* Gets user operating system.
*
* @return Return corresponding OS name. If user operation system is not supported returns OSNames.OTHER
*/
public static OSNames getSystemOS() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (osName.contains(WINDOWS)) {
return OSNames.WINDOWS;
} else if (osName.contains(LINUX)) {
return OSNames.LINUX;
} else if (osName.contains(MACOS)) {
return OSNames.MACOS;
} else if(osName.contains(SOLARIS)){
return OSNames.SOLARIS;
}else{
return OSNames.OTHER;
}
}
/**
* Gets bits of operating system.
*
* @return
*/ | public static OSArch getSystemOSArch() { |
Turksat/ESign | ESignCore/src/main/java/tr/gov/turkiye/esign/statics/OS.java | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSVersion.java
// public enum OSVersion {SPARC, SPARC_V9};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSNames.java
// public enum OSNames {WINDOWS, LINUX, MACOS, OTHER, SOLARIS};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSArch.java
// public enum OSArch {_32BIT, _64BIT};
| import tr.gov.turkiye.esign.enums.OSNames;
import tr.gov.turkiye.esign.enums.OSArch;
import java.util.Locale;
import tr.gov.turkiye.esign.enums.OSVersion; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.statics;
/**
*
* Includes supported operating systems.
*
* @author sercan
*/
public class OS {
final private static String WINDOWS = "windows";
final private static String LINUX = "linux";
final private static String MACOS = "mac";
final private static String SOLARIS = "solaris";
/**
* Gets user operating system.
*
* @return Return corresponding OS name. If user operation system is not supported returns OSNames.OTHER
*/
public static OSNames getSystemOS() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (osName.contains(WINDOWS)) {
return OSNames.WINDOWS;
} else if (osName.contains(LINUX)) {
return OSNames.LINUX;
} else if (osName.contains(MACOS)) {
return OSNames.MACOS;
} else if(osName.contains(SOLARIS)){
return OSNames.SOLARIS;
}else{
return OSNames.OTHER;
}
}
/**
* Gets bits of operating system.
*
* @return
*/
public static OSArch getSystemOSArch() {
String osAcrh = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH);
if (osAcrh.contains("64")) {
return OSArch._64BIT;
} else {
return OSArch._32BIT;
}
}
/**
* Gets system version from Solaris operation system.
*
* @return
*/ | // Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSVersion.java
// public enum OSVersion {SPARC, SPARC_V9};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSNames.java
// public enum OSNames {WINDOWS, LINUX, MACOS, OTHER, SOLARIS};
//
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/enums/OSArch.java
// public enum OSArch {_32BIT, _64BIT};
// Path: ESignCore/src/main/java/tr/gov/turkiye/esign/statics/OS.java
import tr.gov.turkiye.esign.enums.OSNames;
import tr.gov.turkiye.esign.enums.OSArch;
import java.util.Locale;
import tr.gov.turkiye.esign.enums.OSVersion;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tr.gov.turkiye.esign.statics;
/**
*
* Includes supported operating systems.
*
* @author sercan
*/
public class OS {
final private static String WINDOWS = "windows";
final private static String LINUX = "linux";
final private static String MACOS = "mac";
final private static String SOLARIS = "solaris";
/**
* Gets user operating system.
*
* @return Return corresponding OS name. If user operation system is not supported returns OSNames.OTHER
*/
public static OSNames getSystemOS() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (osName.contains(WINDOWS)) {
return OSNames.WINDOWS;
} else if (osName.contains(LINUX)) {
return OSNames.LINUX;
} else if (osName.contains(MACOS)) {
return OSNames.MACOS;
} else if(osName.contains(SOLARIS)){
return OSNames.SOLARIS;
}else{
return OSNames.OTHER;
}
}
/**
* Gets bits of operating system.
*
* @return
*/
public static OSArch getSystemOSArch() {
String osAcrh = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH);
if (osAcrh.contains("64")) {
return OSArch._64BIT;
} else {
return OSArch._32BIT;
}
}
/**
* Gets system version from Solaris operation system.
*
* @return
*/ | public static OSVersion getSystemOSVersionForSolaris() { |
leocadiotine/Dumbledroid | EclipsePlugin/plugin/src/io/leocad/dumbledroidplugin/wizards/NewModelWizard.java | // Path: EclipsePlugin/plugin/src/io/leocad/dumbledroidplugin/core/DumbledroidClassCreator.java
// public class DumbledroidClassCreator {
//
// public static void create(String urlAddress, boolean isPojo, long cacheDuration, IFile file, IProgressMonitor monitor) throws UnsupportedContentTypeException, InvalidUrlException, InvalidContentException {
//
// monitor.beginTask("Validating URL…", 2);
// URL url = null;
// try {
// url = new URL(urlAddress);
// } catch (MalformedURLException e1) {
// e1.printStackTrace();
// // Will never happen. The URL was already validated on UrlInputPage
// }
//
// HttpURLConnection connection;
// try {
// connection = (HttpURLConnection) url.openConnection();
// connection.connect();
// } catch (IOException e2) {
// // e.printStackTrace();
// throw new InvalidUrlException();
// }
//
// boolean isJson = isJson(connection);
// monitor.worked(1);
//
// monitor.setTaskName("Writing files…");
//
// InputStream is;
// try {
// is = connection.getInputStream();
// } catch (IOException e) {
// throw new InvalidUrlException();
// }
//
// if (isJson) {
// JsonReverseReflector.parseJsonToFiles(is, urlAddress, url.getQuery(), isPojo, cacheDuration, file);
// } else {
// XmlReverseReflector.parseXmlToFiles(is, urlAddress, url.getQuery(), isPojo, cacheDuration, file);
// }
//
// monitor.worked(1);
// }
//
// private static boolean isJson(HttpURLConnection connection) throws UnsupportedContentTypeException {
//
// String contentType = connection.getContentType();
//
// if (contentType.contains("json") || contentType.contains("javascript")) {
// return true;
// } else if (contentType.contains("xml")) {
// return false;
// }
//
// throw new UnsupportedContentTypeException(contentType);
// }
// }
| import io.leocad.dumbledroidplugin.core.DumbledroidClassCreator;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE; | package io.leocad.dumbledroidplugin.wizards;
public class NewModelWizard extends Wizard implements INewWizard {
private IStructuredSelection mSelection;
public NewModelWizard() {
setNeedsProgressMonitor(true);
}
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
mSelection = selection;
}
@Override
public void addPages() {
addPage(new DataInputPage(mSelection));
addPage(new FileCreationPage(mSelection));
}
/**
* This method is called when 'Finish' button is pressed in the wizard. We
* will create an operation and run it using wizard as execution context.
*/
public boolean performFinish() {
DataInputPage dataPage = (DataInputPage) getPage(DataInputPage.PAGE_NAME);
final String url = dataPage.getUrl();
final boolean isPojo = dataPage.getIsPojo();
final long cacheDuration = dataPage.getCacheDuration();
FileCreationPage filePage = (FileCreationPage) getPage(FileCreationPage.PAGE_NAME);
final IFile newFile = filePage.createNewFile();
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try { | // Path: EclipsePlugin/plugin/src/io/leocad/dumbledroidplugin/core/DumbledroidClassCreator.java
// public class DumbledroidClassCreator {
//
// public static void create(String urlAddress, boolean isPojo, long cacheDuration, IFile file, IProgressMonitor monitor) throws UnsupportedContentTypeException, InvalidUrlException, InvalidContentException {
//
// monitor.beginTask("Validating URL…", 2);
// URL url = null;
// try {
// url = new URL(urlAddress);
// } catch (MalformedURLException e1) {
// e1.printStackTrace();
// // Will never happen. The URL was already validated on UrlInputPage
// }
//
// HttpURLConnection connection;
// try {
// connection = (HttpURLConnection) url.openConnection();
// connection.connect();
// } catch (IOException e2) {
// // e.printStackTrace();
// throw new InvalidUrlException();
// }
//
// boolean isJson = isJson(connection);
// monitor.worked(1);
//
// monitor.setTaskName("Writing files…");
//
// InputStream is;
// try {
// is = connection.getInputStream();
// } catch (IOException e) {
// throw new InvalidUrlException();
// }
//
// if (isJson) {
// JsonReverseReflector.parseJsonToFiles(is, urlAddress, url.getQuery(), isPojo, cacheDuration, file);
// } else {
// XmlReverseReflector.parseXmlToFiles(is, urlAddress, url.getQuery(), isPojo, cacheDuration, file);
// }
//
// monitor.worked(1);
// }
//
// private static boolean isJson(HttpURLConnection connection) throws UnsupportedContentTypeException {
//
// String contentType = connection.getContentType();
//
// if (contentType.contains("json") || contentType.contains("javascript")) {
// return true;
// } else if (contentType.contains("xml")) {
// return false;
// }
//
// throw new UnsupportedContentTypeException(contentType);
// }
// }
// Path: EclipsePlugin/plugin/src/io/leocad/dumbledroidplugin/wizards/NewModelWizard.java
import io.leocad.dumbledroidplugin.core.DumbledroidClassCreator;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
package io.leocad.dumbledroidplugin.wizards;
public class NewModelWizard extends Wizard implements INewWizard {
private IStructuredSelection mSelection;
public NewModelWizard() {
setNeedsProgressMonitor(true);
}
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
mSelection = selection;
}
@Override
public void addPages() {
addPage(new DataInputPage(mSelection));
addPage(new FileCreationPage(mSelection));
}
/**
* This method is called when 'Finish' button is pressed in the wizard. We
* will create an operation and run it using wizard as execution context.
*/
public boolean performFinish() {
DataInputPage dataPage = (DataInputPage) getPage(DataInputPage.PAGE_NAME);
final String url = dataPage.getUrl();
final boolean isPojo = dataPage.getIsPojo();
final long cacheDuration = dataPage.getCacheDuration();
FileCreationPage filePage = (FileCreationPage) getPage(FileCreationPage.PAGE_NAME);
final IFile newFile = filePage.createNewFile();
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try { | DumbledroidClassCreator.create(url, isPojo, cacheDuration, newFile, monitor); |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/models/Sith.java | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
// public abstract class AbstractModel implements Serializable {
//
// private static final long serialVersionUID = -889584042617358518L;
//
// private static final String DEFAULT_ENCODING = HTTP.UTF_8;
//
// public String url;
// public String encoding;
// public String error;
//
// public long cacheDuration;
//
// protected abstract DataType getDataType();
//
// protected AbstractModel(String url) {
// this(url, DEFAULT_ENCODING, -1L);
// }
//
// protected AbstractModel(String _url, long _cacheDuration) {
// this(_url, DEFAULT_ENCODING, _cacheDuration);
// }
//
// protected AbstractModel(String _url, String _encoding) {
// this(_url, _encoding, -1L);
// }
//
// protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
// url = _url;
// encoding = _encoding;
// cacheDuration = _cacheDuration;
// }
//
// public void load(Context ctx) throws Exception {
// load(ctx, null, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params) throws Exception {
// load(ctx, params, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
// DataController.load(ctx, this, getDataType(), params, method);
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/DataType.java
// public enum DataType {
// JSON, XML
// }
| import io.leocad.dumbledroid.data.AbstractModel;
import io.leocad.dumbledroid.data.DataType;
import java.util.List; | package io.leocad.dumbledoreexample.models;
public class Sith extends AbstractModel {
private static final long serialVersionUID = 7828325552043546133L;
private String side;
private List<String> names;
private Suit suit;
private int kills;
public Sith() {
super("https://dl.dropbox.com/u/5135185/dumbledroid/sith.xml", 15 * 60 * 1000); //15 min cache
}
@Override | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
// public abstract class AbstractModel implements Serializable {
//
// private static final long serialVersionUID = -889584042617358518L;
//
// private static final String DEFAULT_ENCODING = HTTP.UTF_8;
//
// public String url;
// public String encoding;
// public String error;
//
// public long cacheDuration;
//
// protected abstract DataType getDataType();
//
// protected AbstractModel(String url) {
// this(url, DEFAULT_ENCODING, -1L);
// }
//
// protected AbstractModel(String _url, long _cacheDuration) {
// this(_url, DEFAULT_ENCODING, _cacheDuration);
// }
//
// protected AbstractModel(String _url, String _encoding) {
// this(_url, _encoding, -1L);
// }
//
// protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
// url = _url;
// encoding = _encoding;
// cacheDuration = _cacheDuration;
// }
//
// public void load(Context ctx) throws Exception {
// load(ctx, null, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params) throws Exception {
// load(ctx, params, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
// DataController.load(ctx, this, getDataType(), params, method);
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/DataType.java
// public enum DataType {
// JSON, XML
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Sith.java
import io.leocad.dumbledroid.data.AbstractModel;
import io.leocad.dumbledroid.data.DataType;
import java.util.List;
package io.leocad.dumbledoreexample.models;
public class Sith extends AbstractModel {
private static final long serialVersionUID = 7828325552043546133L;
private String side;
private List<String> names;
private Suit suit;
private int kills;
public Sith() {
super("https://dl.dropbox.com/u/5135185/dumbledroid/sith.xml", 15 * 60 * 1000); //15 min cache
}
@Override | protected DataType getDataType() { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/activities/SithActivity.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Sith.java
// public class Sith extends AbstractModel {
//
// private static final long serialVersionUID = 7828325552043546133L;
//
// private String side;
// private List<String> names;
// private Suit suit;
// private int kills;
//
// public Sith() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/sith.xml", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.XML;
// }
//
// public String getSide() {
// return side;
// }
//
// public void setSide(String side) {
// this.side = side;
// }
//
// public String getNames() {
//
// StringBuffer sb = new StringBuffer();
//
// for (String name : names) {
// sb.append(name)
// .append(", ");
// }
//
// //Remove the last comma and space (", ")
// int sbLength = sb.length();
// sb.delete(sbLength-2, sbLength);
//
// return sb.toString();
// }
//
// public void setNames(List<String> names) {
// this.names = names;
// }
//
// public Suit getSuit() {
// return suit;
// }
//
// public void setSuit(Suit suit) {
// this.suit = suit;
// }
//
// public int getKills() {
// return kills;
// }
//
// public void setKills(int kills) {
// this.kills = kills;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Suit.java
// public class Suit implements Serializable {
//
// private static final long serialVersionUID = 3422767378715300945L;
//
// private String color;
// private boolean cloak;
//
// public String getColor() {
// return color;
// }
//
// public void setColor(String color) {
// this.color = color;
// }
//
// public boolean hasCloak() {
// return cloak;
// }
//
// public void setCloak(boolean cloak) {
// this.cloak = cloak;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Sith;
import io.leocad.dumbledoreexample.models.Suit;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView; | package io.leocad.dumbledoreexample.activities;
public class SithActivity extends BaseActivity {
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sith);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
loadContent();
}
private void loadContent() { | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Sith.java
// public class Sith extends AbstractModel {
//
// private static final long serialVersionUID = 7828325552043546133L;
//
// private String side;
// private List<String> names;
// private Suit suit;
// private int kills;
//
// public Sith() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/sith.xml", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.XML;
// }
//
// public String getSide() {
// return side;
// }
//
// public void setSide(String side) {
// this.side = side;
// }
//
// public String getNames() {
//
// StringBuffer sb = new StringBuffer();
//
// for (String name : names) {
// sb.append(name)
// .append(", ");
// }
//
// //Remove the last comma and space (", ")
// int sbLength = sb.length();
// sb.delete(sbLength-2, sbLength);
//
// return sb.toString();
// }
//
// public void setNames(List<String> names) {
// this.names = names;
// }
//
// public Suit getSuit() {
// return suit;
// }
//
// public void setSuit(Suit suit) {
// this.suit = suit;
// }
//
// public int getKills() {
// return kills;
// }
//
// public void setKills(int kills) {
// this.kills = kills;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Suit.java
// public class Suit implements Serializable {
//
// private static final long serialVersionUID = 3422767378715300945L;
//
// private String color;
// private boolean cloak;
//
// public String getColor() {
// return color;
// }
//
// public void setColor(String color) {
// this.color = color;
// }
//
// public boolean hasCloak() {
// return cloak;
// }
//
// public void setCloak(boolean cloak) {
// this.cloak = cloak;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/activities/SithActivity.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Sith;
import io.leocad.dumbledoreexample.models.Suit;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView;
package io.leocad.dumbledoreexample.activities;
public class SithActivity extends BaseActivity {
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sith);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
loadContent();
}
private void loadContent() { | new AsyncTask<Void, Void, Sith>() { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/activities/SithActivity.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Sith.java
// public class Sith extends AbstractModel {
//
// private static final long serialVersionUID = 7828325552043546133L;
//
// private String side;
// private List<String> names;
// private Suit suit;
// private int kills;
//
// public Sith() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/sith.xml", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.XML;
// }
//
// public String getSide() {
// return side;
// }
//
// public void setSide(String side) {
// this.side = side;
// }
//
// public String getNames() {
//
// StringBuffer sb = new StringBuffer();
//
// for (String name : names) {
// sb.append(name)
// .append(", ");
// }
//
// //Remove the last comma and space (", ")
// int sbLength = sb.length();
// sb.delete(sbLength-2, sbLength);
//
// return sb.toString();
// }
//
// public void setNames(List<String> names) {
// this.names = names;
// }
//
// public Suit getSuit() {
// return suit;
// }
//
// public void setSuit(Suit suit) {
// this.suit = suit;
// }
//
// public int getKills() {
// return kills;
// }
//
// public void setKills(int kills) {
// this.kills = kills;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Suit.java
// public class Suit implements Serializable {
//
// private static final long serialVersionUID = 3422767378715300945L;
//
// private String color;
// private boolean cloak;
//
// public String getColor() {
// return color;
// }
//
// public void setColor(String color) {
// this.color = color;
// }
//
// public boolean hasCloak() {
// return cloak;
// }
//
// public void setCloak(boolean cloak) {
// this.cloak = cloak;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Sith;
import io.leocad.dumbledoreexample.models.Suit;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView; | package io.leocad.dumbledoreexample.activities;
public class SithActivity extends BaseActivity {
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sith);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
loadContent();
}
private void loadContent() {
new AsyncTask<Void, Void, Sith>() {
@Override
protected void onPreExecute() {
mDialog = ProgressDialog.show(SithActivity.this, null, "Loading…");
};
@Override
protected Sith doInBackground(Void... params) {
try {
Sith sith = new Sith();
sith.load(SithActivity.this);
return sith;
| // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Sith.java
// public class Sith extends AbstractModel {
//
// private static final long serialVersionUID = 7828325552043546133L;
//
// private String side;
// private List<String> names;
// private Suit suit;
// private int kills;
//
// public Sith() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/sith.xml", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.XML;
// }
//
// public String getSide() {
// return side;
// }
//
// public void setSide(String side) {
// this.side = side;
// }
//
// public String getNames() {
//
// StringBuffer sb = new StringBuffer();
//
// for (String name : names) {
// sb.append(name)
// .append(", ");
// }
//
// //Remove the last comma and space (", ")
// int sbLength = sb.length();
// sb.delete(sbLength-2, sbLength);
//
// return sb.toString();
// }
//
// public void setNames(List<String> names) {
// this.names = names;
// }
//
// public Suit getSuit() {
// return suit;
// }
//
// public void setSuit(Suit suit) {
// this.suit = suit;
// }
//
// public int getKills() {
// return kills;
// }
//
// public void setKills(int kills) {
// this.kills = kills;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Suit.java
// public class Suit implements Serializable {
//
// private static final long serialVersionUID = 3422767378715300945L;
//
// private String color;
// private boolean cloak;
//
// public String getColor() {
// return color;
// }
//
// public void setColor(String color) {
// this.color = color;
// }
//
// public boolean hasCloak() {
// return cloak;
// }
//
// public void setCloak(boolean cloak) {
// this.cloak = cloak;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/activities/SithActivity.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Sith;
import io.leocad.dumbledoreexample.models.Suit;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView;
package io.leocad.dumbledoreexample.activities;
public class SithActivity extends BaseActivity {
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sith);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
loadContent();
}
private void loadContent() {
new AsyncTask<Void, Void, Sith>() {
@Override
protected void onPreExecute() {
mDialog = ProgressDialog.show(SithActivity.this, null, "Loading…");
};
@Override
protected Sith doInBackground(Void... params) {
try {
Sith sith = new Sith();
sith.load(SithActivity.this);
return sith;
| } catch (NoConnectionException e) { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/activities/SithActivity.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Sith.java
// public class Sith extends AbstractModel {
//
// private static final long serialVersionUID = 7828325552043546133L;
//
// private String side;
// private List<String> names;
// private Suit suit;
// private int kills;
//
// public Sith() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/sith.xml", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.XML;
// }
//
// public String getSide() {
// return side;
// }
//
// public void setSide(String side) {
// this.side = side;
// }
//
// public String getNames() {
//
// StringBuffer sb = new StringBuffer();
//
// for (String name : names) {
// sb.append(name)
// .append(", ");
// }
//
// //Remove the last comma and space (", ")
// int sbLength = sb.length();
// sb.delete(sbLength-2, sbLength);
//
// return sb.toString();
// }
//
// public void setNames(List<String> names) {
// this.names = names;
// }
//
// public Suit getSuit() {
// return suit;
// }
//
// public void setSuit(Suit suit) {
// this.suit = suit;
// }
//
// public int getKills() {
// return kills;
// }
//
// public void setKills(int kills) {
// this.kills = kills;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Suit.java
// public class Suit implements Serializable {
//
// private static final long serialVersionUID = 3422767378715300945L;
//
// private String color;
// private boolean cloak;
//
// public String getColor() {
// return color;
// }
//
// public void setColor(String color) {
// this.color = color;
// }
//
// public boolean hasCloak() {
// return cloak;
// }
//
// public void setCloak(boolean cloak) {
// this.cloak = cloak;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Sith;
import io.leocad.dumbledoreexample.models.Suit;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView; |
try {
Sith sith = new Sith();
sith.load(SithActivity.this);
return sith;
} catch (NoConnectionException e) {
onConnectionError();
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(Sith sith) {
if (sith != null) {
printContent(sith);
}
mDialog.dismiss();
}
}.execute();
}
private void printContent(Sith sith) {
((TextView) findViewById(R.id.tv_side)).setText( sith.getSide() );
((TextView) findViewById(R.id.tv_names)).setText( sith.getNames() ); | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Sith.java
// public class Sith extends AbstractModel {
//
// private static final long serialVersionUID = 7828325552043546133L;
//
// private String side;
// private List<String> names;
// private Suit suit;
// private int kills;
//
// public Sith() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/sith.xml", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.XML;
// }
//
// public String getSide() {
// return side;
// }
//
// public void setSide(String side) {
// this.side = side;
// }
//
// public String getNames() {
//
// StringBuffer sb = new StringBuffer();
//
// for (String name : names) {
// sb.append(name)
// .append(", ");
// }
//
// //Remove the last comma and space (", ")
// int sbLength = sb.length();
// sb.delete(sbLength-2, sbLength);
//
// return sb.toString();
// }
//
// public void setNames(List<String> names) {
// this.names = names;
// }
//
// public Suit getSuit() {
// return suit;
// }
//
// public void setSuit(Suit suit) {
// this.suit = suit;
// }
//
// public int getKills() {
// return kills;
// }
//
// public void setKills(int kills) {
// this.kills = kills;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Suit.java
// public class Suit implements Serializable {
//
// private static final long serialVersionUID = 3422767378715300945L;
//
// private String color;
// private boolean cloak;
//
// public String getColor() {
// return color;
// }
//
// public void setColor(String color) {
// this.color = color;
// }
//
// public boolean hasCloak() {
// return cloak;
// }
//
// public void setCloak(boolean cloak) {
// this.cloak = cloak;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/activities/SithActivity.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Sith;
import io.leocad.dumbledoreexample.models.Suit;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView;
try {
Sith sith = new Sith();
sith.load(SithActivity.this);
return sith;
} catch (NoConnectionException e) {
onConnectionError();
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(Sith sith) {
if (sith != null) {
printContent(sith);
}
mDialog.dismiss();
}
}.execute();
}
private void printContent(Sith sith) {
((TextView) findViewById(R.id.tv_side)).setText( sith.getSide() );
((TextView) findViewById(R.id.tv_names)).setText( sith.getNames() ); | Suit suit = sith.getSuit(); |
leocadiotine/Dumbledroid | Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/cache/ModelHolder.java | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
// public abstract class AbstractModel implements Serializable {
//
// private static final long serialVersionUID = -889584042617358518L;
//
// private static final String DEFAULT_ENCODING = HTTP.UTF_8;
//
// public String url;
// public String encoding;
// public String error;
//
// public long cacheDuration;
//
// protected abstract DataType getDataType();
//
// protected AbstractModel(String url) {
// this(url, DEFAULT_ENCODING, -1L);
// }
//
// protected AbstractModel(String _url, long _cacheDuration) {
// this(_url, DEFAULT_ENCODING, _cacheDuration);
// }
//
// protected AbstractModel(String _url, String _encoding) {
// this(_url, _encoding, -1L);
// }
//
// protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
// url = _url;
// encoding = _encoding;
// cacheDuration = _cacheDuration;
// }
//
// public void load(Context ctx) throws Exception {
// load(ctx, null, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params) throws Exception {
// load(ctx, params, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
// DataController.load(ctx, this, getDataType(), params, method);
// }
// }
| import io.leocad.dumbledroid.data.AbstractModel;
import java.io.Serializable; | package io.leocad.dumbledroid.data.cache;
public class ModelHolder implements Serializable {
private static final long serialVersionUID = -884696290834846261L;
| // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
// public abstract class AbstractModel implements Serializable {
//
// private static final long serialVersionUID = -889584042617358518L;
//
// private static final String DEFAULT_ENCODING = HTTP.UTF_8;
//
// public String url;
// public String encoding;
// public String error;
//
// public long cacheDuration;
//
// protected abstract DataType getDataType();
//
// protected AbstractModel(String url) {
// this(url, DEFAULT_ENCODING, -1L);
// }
//
// protected AbstractModel(String _url, long _cacheDuration) {
// this(_url, DEFAULT_ENCODING, _cacheDuration);
// }
//
// protected AbstractModel(String _url, String _encoding) {
// this(_url, _encoding, -1L);
// }
//
// protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
// url = _url;
// encoding = _encoding;
// cacheDuration = _cacheDuration;
// }
//
// public void load(Context ctx) throws Exception {
// load(ctx, null, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params) throws Exception {
// load(ctx, params, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
// DataController.load(ctx, this, getDataType(), params, method);
// }
// }
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/cache/ModelHolder.java
import io.leocad.dumbledroid.data.AbstractModel;
import java.io.Serializable;
package io.leocad.dumbledroid.data.cache;
public class ModelHolder implements Serializable {
private static final long serialVersionUID = -884696290834846261L;
| public AbstractModel model; |
leocadiotine/Dumbledroid | Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/cache/ObjectCopier.java | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/ReflectionHelper.java
// public class ReflectionHelper {
//
//
// public static Field getField(Class<?> fieldClass, String fieldName) throws NoSuchFieldException {
// final Field field = fieldClass.getDeclaredField(fieldName);
// field.setAccessible(true);
// return field;
// }
//
// public static Field getFieldInHierarchy(Class<?> fieldClass, String fieldName) throws NoSuchFieldException {
// try {
// return getField(fieldClass, fieldName);
// } catch (NoSuchFieldException e) {
// final Class<?> superClass = fieldClass.getSuperclass();
// if(superClass == null) {
// throw e;
// }
// return getFieldInHierarchy(superClass, fieldName);
// }
// }
//
// public static Field[] getAllFields(Class<?> fieldClass) {
// final Field[] fields = fieldClass.getDeclaredFields();
// for(final Field field : fields) {
// field.setAccessible(true);
// }
// return fields;
// }
// }
| import io.leocad.dumbledroid.data.ReflectionHelper;
import java.lang.reflect.Field; | package io.leocad.dumbledroid.data.cache;
public class ObjectCopier {
public static boolean copy(Object src, Object dest) {
return copyAux(src, dest, src.getClass(), dest.getClass());
}
public static boolean copyAux(Object src, Object dest, Class<?> srcClass, Class<?> destClass) {
if(srcClass != destClass) {
return false;
}
| // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/ReflectionHelper.java
// public class ReflectionHelper {
//
//
// public static Field getField(Class<?> fieldClass, String fieldName) throws NoSuchFieldException {
// final Field field = fieldClass.getDeclaredField(fieldName);
// field.setAccessible(true);
// return field;
// }
//
// public static Field getFieldInHierarchy(Class<?> fieldClass, String fieldName) throws NoSuchFieldException {
// try {
// return getField(fieldClass, fieldName);
// } catch (NoSuchFieldException e) {
// final Class<?> superClass = fieldClass.getSuperclass();
// if(superClass == null) {
// throw e;
// }
// return getFieldInHierarchy(superClass, fieldName);
// }
// }
//
// public static Field[] getAllFields(Class<?> fieldClass) {
// final Field[] fields = fieldClass.getDeclaredFields();
// for(final Field field : fields) {
// field.setAccessible(true);
// }
// return fields;
// }
// }
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/cache/ObjectCopier.java
import io.leocad.dumbledroid.data.ReflectionHelper;
import java.lang.reflect.Field;
package io.leocad.dumbledroid.data.cache;
public class ObjectCopier {
public static boolean copy(Object src, Object dest) {
return copyAux(src, dest, src.getClass(), dest.getClass());
}
public static boolean copyAux(Object src, Object dest, Class<?> srcClass, Class<?> destClass) {
if(srcClass != destClass) {
return false;
}
| final Field[] srcFields = ReflectionHelper.getAllFields(srcClass); |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/PhotoItem.java
// public class PhotoItem implements Serializable {
//
// private static final long serialVersionUID = 3532242486609895942L;
//
// public String title;
// public Media media;
// public String author;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledoreexample.models.PhotoItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WebCachedImageView;
import android.widget.BaseAdapter;
import android.widget.TextView; | package io.leocad.dumbledoreexample.adapters;
public class FlickrAdapter extends BaseAdapter {
private LayoutInflater mInflater; | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/PhotoItem.java
// public class PhotoItem implements Serializable {
//
// private static final long serialVersionUID = 3532242486609895942L;
//
// public String title;
// public Media media;
// public String author;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledoreexample.models.PhotoItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WebCachedImageView;
import android.widget.BaseAdapter;
import android.widget.TextView;
package io.leocad.dumbledoreexample.adapters;
public class FlickrAdapter extends BaseAdapter {
private LayoutInflater mInflater; | private FlickrPhotos mPhotos; |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/PhotoItem.java
// public class PhotoItem implements Serializable {
//
// private static final long serialVersionUID = 3532242486609895942L;
//
// public String title;
// public Media media;
// public String author;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledoreexample.models.PhotoItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WebCachedImageView;
import android.widget.BaseAdapter;
import android.widget.TextView; | public Object getItem(int arg0) {
return null;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.flickr_result_row, parent, false);
holder = new ViewHolder();
holder.image = (WebCachedImageView) convertView.findViewById(R.id.iv);
holder.title = (TextView) convertView.findViewById(R.id.tv_title);
holder.author = (TextView) convertView.findViewById(R.id.tv_author);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
| // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/PhotoItem.java
// public class PhotoItem implements Serializable {
//
// private static final long serialVersionUID = 3532242486609895942L;
//
// public String title;
// public Media media;
// public String author;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledoreexample.models.PhotoItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WebCachedImageView;
import android.widget.BaseAdapter;
import android.widget.TextView;
public Object getItem(int arg0) {
return null;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.flickr_result_row, parent, false);
holder = new ViewHolder();
holder.image = (WebCachedImageView) convertView.findViewById(R.id.iv);
holder.title = (TextView) convertView.findViewById(R.id.tv_title);
holder.author = (TextView) convertView.findViewById(R.id.tv_author);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
| PhotoItem item = mPhotos.items.get(position); |
leocadiotine/Dumbledroid | Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/HttpMethod.java
// public enum HttpMethod {
// GET, POST
// }
| import io.leocad.dumbledroid.net.HttpMethod;
import java.io.Serializable;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.protocol.HTTP;
import android.content.Context; | package io.leocad.dumbledroid.data;
public abstract class AbstractModel implements Serializable {
private static final long serialVersionUID = -889584042617358518L;
private static final String DEFAULT_ENCODING = HTTP.UTF_8;
public String url;
public String encoding;
public String error;
public long cacheDuration;
protected abstract DataType getDataType();
protected AbstractModel(String url) {
this(url, DEFAULT_ENCODING, -1L);
}
protected AbstractModel(String _url, long _cacheDuration) {
this(_url, DEFAULT_ENCODING, _cacheDuration);
}
protected AbstractModel(String _url, String _encoding) {
this(_url, _encoding, -1L);
}
protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
url = _url;
encoding = _encoding;
cacheDuration = _cacheDuration;
}
public void load(Context ctx) throws Exception {
load(ctx, null, null);
}
protected void load(Context ctx, List<NameValuePair> params) throws Exception {
load(ctx, params, null);
}
| // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/HttpMethod.java
// public enum HttpMethod {
// GET, POST
// }
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
import io.leocad.dumbledroid.net.HttpMethod;
import java.io.Serializable;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.protocol.HTTP;
import android.content.Context;
package io.leocad.dumbledroid.data;
public abstract class AbstractModel implements Serializable {
private static final long serialVersionUID = -889584042617358518L;
private static final String DEFAULT_ENCODING = HTTP.UTF_8;
public String url;
public String encoding;
public String error;
public long cacheDuration;
protected abstract DataType getDataType();
protected AbstractModel(String url) {
this(url, DEFAULT_ENCODING, -1L);
}
protected AbstractModel(String _url, long _cacheDuration) {
this(_url, DEFAULT_ENCODING, _cacheDuration);
}
protected AbstractModel(String _url, String _encoding) {
this(_url, _encoding, -1L);
}
protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
url = _url;
encoding = _encoding;
cacheDuration = _cacheDuration;
}
public void load(Context ctx) throws Exception {
load(ctx, null, null);
}
protected void load(Context ctx, List<NameValuePair> params) throws Exception {
load(ctx, params, null);
}
| protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/activities/FlickrActivity.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java
// public class FlickrAdapter extends BaseAdapter {
//
// private LayoutInflater mInflater;
// private FlickrPhotos mPhotos;
//
// public FlickrAdapter(Context ctx, FlickrPhotos photos) {
// mInflater = LayoutInflater.from(ctx);
// mPhotos = photos;
// }
//
// @Override
// public int getCount() {
//
// return mPhotos.items.size();
// }
//
// @Override
// public Object getItem(int arg0) {
//
// return null;
// }
//
// @Override
// public long getItemId(int position) {
//
// return position;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
//
// ViewHolder holder;
//
// if (convertView == null) {
// convertView = mInflater.inflate(R.layout.flickr_result_row, parent, false);
// holder = new ViewHolder();
//
// holder.image = (WebCachedImageView) convertView.findViewById(R.id.iv);
// holder.title = (TextView) convertView.findViewById(R.id.tv_title);
// holder.author = (TextView) convertView.findViewById(R.id.tv_author);
//
// convertView.setTag(holder);
//
// } else {
// holder = (ViewHolder) convertView.getTag();
// }
//
// PhotoItem item = mPhotos.items.get(position);
// holder.title.setText(item.title);
// holder.author.setText(item.author);
// holder.image.setImageUrl(item.media.m);
//
// return convertView;
// }
//
// @Override
// public boolean isEnabled(int position) {
//
// return false;
// }
//
// static class ViewHolder {
// WebCachedImageView image;
// TextView title;
// TextView author;
// }
//
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.adapters.FlickrAdapter;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.ViewFlipper; | package io.leocad.dumbledoreexample.activities;
public class FlickrActivity extends BaseActivity {
private ViewFlipper mViewFlipper;
private TextView mResultsTitle;
private ListView mListView;
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.flickr);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
mViewFlipper = (ViewFlipper) findViewById(R.id.vf);
mResultsTitle = (TextView) findViewById(R.id.tv_results_title);
mListView = (ListView) findViewById(R.id.lv);
}
public void onSearchClicked(View v) {
//Hide the soft keyboard
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
String query = ((EditText) findViewById(R.id.et_query)).getText().toString();
loadContent(query);
}
private void loadContent(String query) { | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java
// public class FlickrAdapter extends BaseAdapter {
//
// private LayoutInflater mInflater;
// private FlickrPhotos mPhotos;
//
// public FlickrAdapter(Context ctx, FlickrPhotos photos) {
// mInflater = LayoutInflater.from(ctx);
// mPhotos = photos;
// }
//
// @Override
// public int getCount() {
//
// return mPhotos.items.size();
// }
//
// @Override
// public Object getItem(int arg0) {
//
// return null;
// }
//
// @Override
// public long getItemId(int position) {
//
// return position;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
//
// ViewHolder holder;
//
// if (convertView == null) {
// convertView = mInflater.inflate(R.layout.flickr_result_row, parent, false);
// holder = new ViewHolder();
//
// holder.image = (WebCachedImageView) convertView.findViewById(R.id.iv);
// holder.title = (TextView) convertView.findViewById(R.id.tv_title);
// holder.author = (TextView) convertView.findViewById(R.id.tv_author);
//
// convertView.setTag(holder);
//
// } else {
// holder = (ViewHolder) convertView.getTag();
// }
//
// PhotoItem item = mPhotos.items.get(position);
// holder.title.setText(item.title);
// holder.author.setText(item.author);
// holder.image.setImageUrl(item.media.m);
//
// return convertView;
// }
//
// @Override
// public boolean isEnabled(int position) {
//
// return false;
// }
//
// static class ViewHolder {
// WebCachedImageView image;
// TextView title;
// TextView author;
// }
//
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/activities/FlickrActivity.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.adapters.FlickrAdapter;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.ViewFlipper;
package io.leocad.dumbledoreexample.activities;
public class FlickrActivity extends BaseActivity {
private ViewFlipper mViewFlipper;
private TextView mResultsTitle;
private ListView mListView;
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.flickr);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
mViewFlipper = (ViewFlipper) findViewById(R.id.vf);
mResultsTitle = (TextView) findViewById(R.id.tv_results_title);
mListView = (ListView) findViewById(R.id.lv);
}
public void onSearchClicked(View v) {
//Hide the soft keyboard
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
String query = ((EditText) findViewById(R.id.et_query)).getText().toString();
loadContent(query);
}
private void loadContent(String query) { | new AsyncTask<String, Void, FlickrPhotos>() { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/activities/FlickrActivity.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java
// public class FlickrAdapter extends BaseAdapter {
//
// private LayoutInflater mInflater;
// private FlickrPhotos mPhotos;
//
// public FlickrAdapter(Context ctx, FlickrPhotos photos) {
// mInflater = LayoutInflater.from(ctx);
// mPhotos = photos;
// }
//
// @Override
// public int getCount() {
//
// return mPhotos.items.size();
// }
//
// @Override
// public Object getItem(int arg0) {
//
// return null;
// }
//
// @Override
// public long getItemId(int position) {
//
// return position;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
//
// ViewHolder holder;
//
// if (convertView == null) {
// convertView = mInflater.inflate(R.layout.flickr_result_row, parent, false);
// holder = new ViewHolder();
//
// holder.image = (WebCachedImageView) convertView.findViewById(R.id.iv);
// holder.title = (TextView) convertView.findViewById(R.id.tv_title);
// holder.author = (TextView) convertView.findViewById(R.id.tv_author);
//
// convertView.setTag(holder);
//
// } else {
// holder = (ViewHolder) convertView.getTag();
// }
//
// PhotoItem item = mPhotos.items.get(position);
// holder.title.setText(item.title);
// holder.author.setText(item.author);
// holder.image.setImageUrl(item.media.m);
//
// return convertView;
// }
//
// @Override
// public boolean isEnabled(int position) {
//
// return false;
// }
//
// static class ViewHolder {
// WebCachedImageView image;
// TextView title;
// TextView author;
// }
//
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.adapters.FlickrAdapter;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.ViewFlipper; | mResultsTitle = (TextView) findViewById(R.id.tv_results_title);
mListView = (ListView) findViewById(R.id.lv);
}
public void onSearchClicked(View v) {
//Hide the soft keyboard
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
String query = ((EditText) findViewById(R.id.et_query)).getText().toString();
loadContent(query);
}
private void loadContent(String query) {
new AsyncTask<String, Void, FlickrPhotos>() {
@Override
protected void onPreExecute() {
mDialog = ProgressDialog.show(FlickrActivity.this, null, "Loading…");
};
@Override
protected FlickrPhotos doInBackground(String... params) {
try {
FlickrPhotos photos = new FlickrPhotos();
photos.load(FlickrActivity.this, params[0]);
return photos;
| // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java
// public class FlickrAdapter extends BaseAdapter {
//
// private LayoutInflater mInflater;
// private FlickrPhotos mPhotos;
//
// public FlickrAdapter(Context ctx, FlickrPhotos photos) {
// mInflater = LayoutInflater.from(ctx);
// mPhotos = photos;
// }
//
// @Override
// public int getCount() {
//
// return mPhotos.items.size();
// }
//
// @Override
// public Object getItem(int arg0) {
//
// return null;
// }
//
// @Override
// public long getItemId(int position) {
//
// return position;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
//
// ViewHolder holder;
//
// if (convertView == null) {
// convertView = mInflater.inflate(R.layout.flickr_result_row, parent, false);
// holder = new ViewHolder();
//
// holder.image = (WebCachedImageView) convertView.findViewById(R.id.iv);
// holder.title = (TextView) convertView.findViewById(R.id.tv_title);
// holder.author = (TextView) convertView.findViewById(R.id.tv_author);
//
// convertView.setTag(holder);
//
// } else {
// holder = (ViewHolder) convertView.getTag();
// }
//
// PhotoItem item = mPhotos.items.get(position);
// holder.title.setText(item.title);
// holder.author.setText(item.author);
// holder.image.setImageUrl(item.media.m);
//
// return convertView;
// }
//
// @Override
// public boolean isEnabled(int position) {
//
// return false;
// }
//
// static class ViewHolder {
// WebCachedImageView image;
// TextView title;
// TextView author;
// }
//
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/activities/FlickrActivity.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.adapters.FlickrAdapter;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.ViewFlipper;
mResultsTitle = (TextView) findViewById(R.id.tv_results_title);
mListView = (ListView) findViewById(R.id.lv);
}
public void onSearchClicked(View v) {
//Hide the soft keyboard
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
String query = ((EditText) findViewById(R.id.et_query)).getText().toString();
loadContent(query);
}
private void loadContent(String query) {
new AsyncTask<String, Void, FlickrPhotos>() {
@Override
protected void onPreExecute() {
mDialog = ProgressDialog.show(FlickrActivity.this, null, "Loading…");
};
@Override
protected FlickrPhotos doInBackground(String... params) {
try {
FlickrPhotos photos = new FlickrPhotos();
photos.load(FlickrActivity.this, params[0]);
return photos;
| } catch (NoConnectionException e) { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/activities/FlickrActivity.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java
// public class FlickrAdapter extends BaseAdapter {
//
// private LayoutInflater mInflater;
// private FlickrPhotos mPhotos;
//
// public FlickrAdapter(Context ctx, FlickrPhotos photos) {
// mInflater = LayoutInflater.from(ctx);
// mPhotos = photos;
// }
//
// @Override
// public int getCount() {
//
// return mPhotos.items.size();
// }
//
// @Override
// public Object getItem(int arg0) {
//
// return null;
// }
//
// @Override
// public long getItemId(int position) {
//
// return position;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
//
// ViewHolder holder;
//
// if (convertView == null) {
// convertView = mInflater.inflate(R.layout.flickr_result_row, parent, false);
// holder = new ViewHolder();
//
// holder.image = (WebCachedImageView) convertView.findViewById(R.id.iv);
// holder.title = (TextView) convertView.findViewById(R.id.tv_title);
// holder.author = (TextView) convertView.findViewById(R.id.tv_author);
//
// convertView.setTag(holder);
//
// } else {
// holder = (ViewHolder) convertView.getTag();
// }
//
// PhotoItem item = mPhotos.items.get(position);
// holder.title.setText(item.title);
// holder.author.setText(item.author);
// holder.image.setImageUrl(item.media.m);
//
// return convertView;
// }
//
// @Override
// public boolean isEnabled(int position) {
//
// return false;
// }
//
// static class ViewHolder {
// WebCachedImageView image;
// TextView title;
// TextView author;
// }
//
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.adapters.FlickrAdapter;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.ViewFlipper; | FlickrPhotos photos = new FlickrPhotos();
photos.load(FlickrActivity.this, params[0]);
return photos;
} catch (NoConnectionException e) {
onConnectionError();
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(FlickrPhotos photos) {
if (photos != null) {
printContent(photos);
}
mDialog.dismiss();
}
}.execute(query);
}
private void printContent(FlickrPhotos photos) {
mViewFlipper.setDisplayedChild(1);
mResultsTitle.setText(photos.title);
| // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/adapters/FlickrAdapter.java
// public class FlickrAdapter extends BaseAdapter {
//
// private LayoutInflater mInflater;
// private FlickrPhotos mPhotos;
//
// public FlickrAdapter(Context ctx, FlickrPhotos photos) {
// mInflater = LayoutInflater.from(ctx);
// mPhotos = photos;
// }
//
// @Override
// public int getCount() {
//
// return mPhotos.items.size();
// }
//
// @Override
// public Object getItem(int arg0) {
//
// return null;
// }
//
// @Override
// public long getItemId(int position) {
//
// return position;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
//
// ViewHolder holder;
//
// if (convertView == null) {
// convertView = mInflater.inflate(R.layout.flickr_result_row, parent, false);
// holder = new ViewHolder();
//
// holder.image = (WebCachedImageView) convertView.findViewById(R.id.iv);
// holder.title = (TextView) convertView.findViewById(R.id.tv_title);
// holder.author = (TextView) convertView.findViewById(R.id.tv_author);
//
// convertView.setTag(holder);
//
// } else {
// holder = (ViewHolder) convertView.getTag();
// }
//
// PhotoItem item = mPhotos.items.get(position);
// holder.title.setText(item.title);
// holder.author.setText(item.author);
// holder.image.setImageUrl(item.media.m);
//
// return convertView;
// }
//
// @Override
// public boolean isEnabled(int position) {
//
// return false;
// }
//
// static class ViewHolder {
// WebCachedImageView image;
// TextView title;
// TextView author;
// }
//
// }
//
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
// public class FlickrPhotos extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String title;
// public List<PhotoItem> items;
//
// public FlickrPhotos() {
// super("https://secure.flickr.com/services/feeds/photos_public.gne");
// }
//
// public void load(Context ctx, String query) throws Exception {
//
// List<NameValuePair> params = new Vector<NameValuePair>();
// params.add( new BasicNameValuePair("format", "json") );
// params.add( new BasicNameValuePair("nojsoncallback", "1") );
// params.add( new BasicNameValuePair("tags", query) );
//
// super.load(ctx, params);
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/activities/FlickrActivity.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.adapters.FlickrAdapter;
import io.leocad.dumbledoreexample.models.FlickrPhotos;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.ViewFlipper;
FlickrPhotos photos = new FlickrPhotos();
photos.load(FlickrActivity.this, params[0]);
return photos;
} catch (NoConnectionException e) {
onConnectionError();
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(FlickrPhotos photos) {
if (photos != null) {
printContent(photos);
}
mDialog.dismiss();
}
}.execute(query);
}
private void printContent(FlickrPhotos photos) {
mViewFlipper.setDisplayedChild(1);
mResultsTitle.setText(photos.title);
| FlickrAdapter adapter = new FlickrAdapter(this, photos); |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
// public abstract class AbstractModel implements Serializable {
//
// private static final long serialVersionUID = -889584042617358518L;
//
// private static final String DEFAULT_ENCODING = HTTP.UTF_8;
//
// public String url;
// public String encoding;
// public String error;
//
// public long cacheDuration;
//
// protected abstract DataType getDataType();
//
// protected AbstractModel(String url) {
// this(url, DEFAULT_ENCODING, -1L);
// }
//
// protected AbstractModel(String _url, long _cacheDuration) {
// this(_url, DEFAULT_ENCODING, _cacheDuration);
// }
//
// protected AbstractModel(String _url, String _encoding) {
// this(_url, _encoding, -1L);
// }
//
// protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
// url = _url;
// encoding = _encoding;
// cacheDuration = _cacheDuration;
// }
//
// public void load(Context ctx) throws Exception {
// load(ctx, null, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params) throws Exception {
// load(ctx, params, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
// DataController.load(ctx, this, getDataType(), params, method);
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/DataType.java
// public enum DataType {
// JSON, XML
// }
| import io.leocad.dumbledroid.data.AbstractModel;
import io.leocad.dumbledroid.data.DataType;
import java.util.List;
import java.util.Vector;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import android.content.Context; | package io.leocad.dumbledoreexample.models;
public class FlickrPhotos extends AbstractModel {
private static final long serialVersionUID = 1L;
public String title;
public List<PhotoItem> items;
public FlickrPhotos() {
super("https://secure.flickr.com/services/feeds/photos_public.gne");
}
public void load(Context ctx, String query) throws Exception {
List<NameValuePair> params = new Vector<NameValuePair>();
params.add( new BasicNameValuePair("format", "json") );
params.add( new BasicNameValuePair("nojsoncallback", "1") );
params.add( new BasicNameValuePair("tags", query) );
super.load(ctx, params);
}
@Override | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
// public abstract class AbstractModel implements Serializable {
//
// private static final long serialVersionUID = -889584042617358518L;
//
// private static final String DEFAULT_ENCODING = HTTP.UTF_8;
//
// public String url;
// public String encoding;
// public String error;
//
// public long cacheDuration;
//
// protected abstract DataType getDataType();
//
// protected AbstractModel(String url) {
// this(url, DEFAULT_ENCODING, -1L);
// }
//
// protected AbstractModel(String _url, long _cacheDuration) {
// this(_url, DEFAULT_ENCODING, _cacheDuration);
// }
//
// protected AbstractModel(String _url, String _encoding) {
// this(_url, _encoding, -1L);
// }
//
// protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
// url = _url;
// encoding = _encoding;
// cacheDuration = _cacheDuration;
// }
//
// public void load(Context ctx) throws Exception {
// load(ctx, null, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params) throws Exception {
// load(ctx, params, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
// DataController.load(ctx, this, getDataType(), params, method);
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/DataType.java
// public enum DataType {
// JSON, XML
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/FlickrPhotos.java
import io.leocad.dumbledroid.data.AbstractModel;
import io.leocad.dumbledroid.data.DataType;
import java.util.List;
import java.util.Vector;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import android.content.Context;
package io.leocad.dumbledoreexample.models;
public class FlickrPhotos extends AbstractModel {
private static final long serialVersionUID = 1L;
public String title;
public List<PhotoItem> items;
public FlickrPhotos() {
super("https://secure.flickr.com/services/feeds/photos_public.gne");
}
public void load(Context ctx, String query) throws Exception {
List<NameValuePair> params = new Vector<NameValuePair>();
params.add( new BasicNameValuePair("format", "json") );
params.add( new BasicNameValuePair("nojsoncallback", "1") );
params.add( new BasicNameValuePair("tags", query) );
super.load(ctx, params);
}
@Override | protected DataType getDataType() { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/models/Jedi.java | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
// public abstract class AbstractModel implements Serializable {
//
// private static final long serialVersionUID = -889584042617358518L;
//
// private static final String DEFAULT_ENCODING = HTTP.UTF_8;
//
// public String url;
// public String encoding;
// public String error;
//
// public long cacheDuration;
//
// protected abstract DataType getDataType();
//
// protected AbstractModel(String url) {
// this(url, DEFAULT_ENCODING, -1L);
// }
//
// protected AbstractModel(String _url, long _cacheDuration) {
// this(_url, DEFAULT_ENCODING, _cacheDuration);
// }
//
// protected AbstractModel(String _url, String _encoding) {
// this(_url, _encoding, -1L);
// }
//
// protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
// url = _url;
// encoding = _encoding;
// cacheDuration = _cacheDuration;
// }
//
// public void load(Context ctx) throws Exception {
// load(ctx, null, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params) throws Exception {
// load(ctx, params, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
// DataController.load(ctx, this, getDataType(), params, method);
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/DataType.java
// public enum DataType {
// JSON, XML
// }
| import io.leocad.dumbledroid.data.AbstractModel;
import io.leocad.dumbledroid.data.DataType; | package io.leocad.dumbledoreexample.models;
public class Jedi extends AbstractModel {
private static final long serialVersionUID = 1L;
public String name;
public String surname;
public String ability;
public String master;
public String father;
public Jedi() {
super("https://dl.dropbox.com/u/5135185/dumbledroid/jedi.json", 15 * 60 * 1000); //15 min cache
}
@Override | // Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/AbstractModel.java
// public abstract class AbstractModel implements Serializable {
//
// private static final long serialVersionUID = -889584042617358518L;
//
// private static final String DEFAULT_ENCODING = HTTP.UTF_8;
//
// public String url;
// public String encoding;
// public String error;
//
// public long cacheDuration;
//
// protected abstract DataType getDataType();
//
// protected AbstractModel(String url) {
// this(url, DEFAULT_ENCODING, -1L);
// }
//
// protected AbstractModel(String _url, long _cacheDuration) {
// this(_url, DEFAULT_ENCODING, _cacheDuration);
// }
//
// protected AbstractModel(String _url, String _encoding) {
// this(_url, _encoding, -1L);
// }
//
// protected AbstractModel(String _url, String _encoding, long _cacheDuration) {
// url = _url;
// encoding = _encoding;
// cacheDuration = _cacheDuration;
// }
//
// public void load(Context ctx) throws Exception {
// load(ctx, null, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params) throws Exception {
// load(ctx, params, null);
// }
//
// protected void load(Context ctx, List<NameValuePair> params, HttpMethod method) throws Exception {
// DataController.load(ctx, this, getDataType(), params, method);
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/data/DataType.java
// public enum DataType {
// JSON, XML
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Jedi.java
import io.leocad.dumbledroid.data.AbstractModel;
import io.leocad.dumbledroid.data.DataType;
package io.leocad.dumbledoreexample.models;
public class Jedi extends AbstractModel {
private static final long serialVersionUID = 1L;
public String name;
public String surname;
public String ability;
public String master;
public String father;
public Jedi() {
super("https://dl.dropbox.com/u/5135185/dumbledroid/jedi.json", 15 * 60 * 1000); //15 min cache
}
@Override | protected DataType getDataType() { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/activities/JediActivity.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Jedi.java
// public class Jedi extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String name;
// public String surname;
// public String ability;
// public String master;
// public String father;
//
// public Jedi() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/jedi.json", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Jedi;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView; | package io.leocad.dumbledoreexample.activities;
public class JediActivity extends BaseActivity {
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.jedi);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
loadContent();
}
private void loadContent() { | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Jedi.java
// public class Jedi extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String name;
// public String surname;
// public String ability;
// public String master;
// public String father;
//
// public Jedi() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/jedi.json", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/activities/JediActivity.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Jedi;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView;
package io.leocad.dumbledoreexample.activities;
public class JediActivity extends BaseActivity {
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.jedi);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
loadContent();
}
private void loadContent() { | new AsyncTask<Void, Void, Jedi>() { |
leocadiotine/Dumbledroid | DumbledroidExample/src/io/leocad/dumbledoreexample/activities/JediActivity.java | // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Jedi.java
// public class Jedi extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String name;
// public String surname;
// public String ability;
// public String master;
// public String father;
//
// public Jedi() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/jedi.json", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
| import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Jedi;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView; | package io.leocad.dumbledoreexample.activities;
public class JediActivity extends BaseActivity {
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.jedi);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
loadContent();
}
private void loadContent() {
new AsyncTask<Void, Void, Jedi>() {
@Override
protected void onPreExecute() {
mDialog = ProgressDialog.show(JediActivity.this, null, "Loading…");
};
@Override
protected Jedi doInBackground(Void... params) {
try {
Jedi jedi = new Jedi();
jedi.load(JediActivity.this);
return jedi;
| // Path: DumbledroidExample/src/io/leocad/dumbledoreexample/models/Jedi.java
// public class Jedi extends AbstractModel {
//
// private static final long serialVersionUID = 1L;
//
// public String name;
// public String surname;
// public String ability;
// public String master;
// public String father;
//
// public Jedi() {
// super("https://dl.dropbox.com/u/5135185/dumbledroid/jedi.json", 15 * 60 * 1000); //15 min cache
// }
//
// @Override
// protected DataType getDataType() {
// return DataType.JSON;
// }
// }
//
// Path: Dumbledroid/Dumbledroid/src/main/java/io/leocad/dumbledroid/net/NoConnectionException.java
// public class NoConnectionException extends Exception {
//
// private static final long serialVersionUID = -847063658214858858L;
//
// }
// Path: DumbledroidExample/src/io/leocad/dumbledoreexample/activities/JediActivity.java
import io.leocad.dumbledoreexample.R;
import io.leocad.dumbledoreexample.models.Jedi;
import io.leocad.dumbledroid.net.NoConnectionException;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView;
package io.leocad.dumbledoreexample.activities;
public class JediActivity extends BaseActivity {
private Dialog mDialog;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.jedi);
if (Build.VERSION.SDK_INT >= 11) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
loadContent();
}
private void loadContent() {
new AsyncTask<Void, Void, Jedi>() {
@Override
protected void onPreExecute() {
mDialog = ProgressDialog.show(JediActivity.this, null, "Loading…");
};
@Override
protected Jedi doInBackground(Void... params) {
try {
Jedi jedi = new Jedi();
jedi.load(JediActivity.this);
return jedi;
| } catch (NoConnectionException e) { |
UweTrottmann/Shopr | Android/Shopr/src/test/java/com/uwetrottmann/shopr/test/UtilsTest.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/utils/Utils.java
// public class Utils {
//
// /**
// * Returns the first http url out of the given array in the form of
// * "[http://abc,http://cde]".
// */
// public static String extractFirstUrl(String arrayAsString) {
// arrayAsString = arrayAsString.substring(1, arrayAsString.length() - 1);
// /*
// * Some eBay URLs sadly include commas (,), so really split by ",http".
// * We only want the first one anyhow.
// */
// String url = arrayAsString.split(",http")[0];
// return url;
// }
//
// }
| import static org.fest.assertions.api.Assertions.assertThat;
import com.uwetrottmann.shopr.utils.Utils;
import org.junit.Test; |
package com.uwetrottmann.shopr.test;
public class UtilsTest {
@Test
public void testExtractFirstUrl() {
// make sure those stupid ebay urls with , are split correctly | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/utils/Utils.java
// public class Utils {
//
// /**
// * Returns the first http url out of the given array in the form of
// * "[http://abc,http://cde]".
// */
// public static String extractFirstUrl(String arrayAsString) {
// arrayAsString = arrayAsString.substring(1, arrayAsString.length() - 1);
// /*
// * Some eBay URLs sadly include commas (,), so really split by ",http".
// * We only want the first one anyhow.
// */
// String url = arrayAsString.split(",http")[0];
// return url;
// }
//
// }
// Path: Android/Shopr/src/test/java/com/uwetrottmann/shopr/test/UtilsTest.java
import static org.fest.assertions.api.Assertions.assertThat;
import com.uwetrottmann.shopr.utils.Utils;
import org.junit.Test;
package com.uwetrottmann.shopr.test;
public class UtilsTest {
@Test
public void testExtractFirstUrl() {
// make sure those stupid ebay urls with , are split correctly | String actual = Utils |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
//
// public ShopLoader(Context context) {
// super(context);
// }
//
// @Override
// public List<Shop> loadInBackground() {
// final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
// new String[] {
// Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
// }, null, null,
// null);
//
// List<Shop> shops = Lists.newArrayList();
//
// if (query != null) {
// while (query.moveToNext()) {
// Shop shop = new Shop();
// shop.id(query.getInt(0));
// shop.name(query.getString(1));
// shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
// shops.add(shop);
// }
//
// query.close();
// }
//
// return shops;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
//
// public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
// public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
// public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
//
// public static int getMaxRecommendations(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getInt(
// KEY_MAX_RECOMMENDATIONS, 9);
// }
//
// public static boolean isUsingFakeLocation(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
// false);
// }
//
// public static boolean isUsingDiversity(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
// KEY_USING_DIVERSITY, true);
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
// /**
// * Holds a list of shop ids and how many recommendations are shown for
// * each shop.
// */
// Map<Integer, Integer> shopMap;
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }
| import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map; |
package com.uwetrottmann.shopr.ui;
public class ShopMapFragment extends SupportMapFragment implements LoaderCallbacks<List<Shop>> {
private static final int RADIUS_METERS = 2000;
private static final int ZOOM_LEVEL_INITIAL = 14;
public static final String TAG = "Shops Map";
private static final int LAODER_ID = 22;
public static ShopMapFragment newInstance() {
return new ShopMapFragment();
}
private List<Marker> mShopMarkers;
private boolean mIsInitialized;
private Map<Integer, Integer> mShopsWithItems;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mIsInitialized = false;
// enable my location feature | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
//
// public ShopLoader(Context context) {
// super(context);
// }
//
// @Override
// public List<Shop> loadInBackground() {
// final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
// new String[] {
// Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
// }, null, null,
// null);
//
// List<Shop> shops = Lists.newArrayList();
//
// if (query != null) {
// while (query.moveToNext()) {
// Shop shop = new Shop();
// shop.id(query.getInt(0));
// shop.name(query.getString(1));
// shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
// shops.add(shop);
// }
//
// query.close();
// }
//
// return shops;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
//
// public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
// public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
// public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
//
// public static int getMaxRecommendations(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getInt(
// KEY_MAX_RECOMMENDATIONS, 9);
// }
//
// public static boolean isUsingFakeLocation(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
// false);
// }
//
// public static boolean isUsingDiversity(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
// KEY_USING_DIVERSITY, true);
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
// /**
// * Holds a list of shop ids and how many recommendations are shown for
// * each shop.
// */
// Map<Integer, Integer> shopMap;
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map;
package com.uwetrottmann.shopr.ui;
public class ShopMapFragment extends SupportMapFragment implements LoaderCallbacks<List<Shop>> {
private static final int RADIUS_METERS = 2000;
private static final int ZOOM_LEVEL_INITIAL = 14;
public static final String TAG = "Shops Map";
private static final int LAODER_ID = 22;
public static ShopMapFragment newInstance() {
return new ShopMapFragment();
}
private List<Marker> mShopMarkers;
private boolean mIsInitialized;
private Map<Integer, Integer> mShopsWithItems;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mIsInitialized = false;
// enable my location feature | getMap().setMyLocationEnabled(!AppSettings.isUsingFakeLocation(getActivity())); |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
//
// public ShopLoader(Context context) {
// super(context);
// }
//
// @Override
// public List<Shop> loadInBackground() {
// final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
// new String[] {
// Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
// }, null, null,
// null);
//
// List<Shop> shops = Lists.newArrayList();
//
// if (query != null) {
// while (query.moveToNext()) {
// Shop shop = new Shop();
// shop.id(query.getInt(0));
// shop.name(query.getString(1));
// shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
// shops.add(shop);
// }
//
// query.close();
// }
//
// return shops;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
//
// public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
// public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
// public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
//
// public static int getMaxRecommendations(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getInt(
// KEY_MAX_RECOMMENDATIONS, 9);
// }
//
// public static boolean isUsingFakeLocation(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
// false);
// }
//
// public static boolean isUsingDiversity(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
// KEY_USING_DIVERSITY, true);
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
// /**
// * Holds a list of shop ids and how many recommendations are shown for
// * each shop.
// */
// Map<Integer, Integer> shopMap;
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }
| import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map; |
package com.uwetrottmann.shopr.ui;
public class ShopMapFragment extends SupportMapFragment implements LoaderCallbacks<List<Shop>> {
private static final int RADIUS_METERS = 2000;
private static final int ZOOM_LEVEL_INITIAL = 14;
public static final String TAG = "Shops Map";
private static final int LAODER_ID = 22;
public static ShopMapFragment newInstance() {
return new ShopMapFragment();
}
private List<Marker> mShopMarkers;
private boolean mIsInitialized;
private Map<Integer, Integer> mShopsWithItems;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mIsInitialized = false;
// enable my location feature
getMap().setMyLocationEnabled(!AppSettings.isUsingFakeLocation(getActivity()));
getLoaderManager().initLoader(LAODER_ID, null, this);
}
@Override
public void onStart() {
super.onStart();
EventBus.getDefault() | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
//
// public ShopLoader(Context context) {
// super(context);
// }
//
// @Override
// public List<Shop> loadInBackground() {
// final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
// new String[] {
// Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
// }, null, null,
// null);
//
// List<Shop> shops = Lists.newArrayList();
//
// if (query != null) {
// while (query.moveToNext()) {
// Shop shop = new Shop();
// shop.id(query.getInt(0));
// shop.name(query.getString(1));
// shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
// shops.add(shop);
// }
//
// query.close();
// }
//
// return shops;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
//
// public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
// public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
// public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
//
// public static int getMaxRecommendations(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getInt(
// KEY_MAX_RECOMMENDATIONS, 9);
// }
//
// public static boolean isUsingFakeLocation(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
// false);
// }
//
// public static boolean isUsingDiversity(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
// KEY_USING_DIVERSITY, true);
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
// /**
// * Holds a list of shop ids and how many recommendations are shown for
// * each shop.
// */
// Map<Integer, Integer> shopMap;
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map;
package com.uwetrottmann.shopr.ui;
public class ShopMapFragment extends SupportMapFragment implements LoaderCallbacks<List<Shop>> {
private static final int RADIUS_METERS = 2000;
private static final int ZOOM_LEVEL_INITIAL = 14;
public static final String TAG = "Shops Map";
private static final int LAODER_ID = 22;
public static ShopMapFragment newInstance() {
return new ShopMapFragment();
}
private List<Marker> mShopMarkers;
private boolean mIsInitialized;
private Map<Integer, Integer> mShopsWithItems;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mIsInitialized = false;
// enable my location feature
getMap().setMyLocationEnabled(!AppSettings.isUsingFakeLocation(getActivity()));
getLoaderManager().initLoader(LAODER_ID, null, this);
}
@Override
public void onStart() {
super.onStart();
EventBus.getDefault() | .registerSticky(this, LocationUpdateEvent.class, ShopUpdateEvent.class); |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
//
// public ShopLoader(Context context) {
// super(context);
// }
//
// @Override
// public List<Shop> loadInBackground() {
// final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
// new String[] {
// Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
// }, null, null,
// null);
//
// List<Shop> shops = Lists.newArrayList();
//
// if (query != null) {
// while (query.moveToNext()) {
// Shop shop = new Shop();
// shop.id(query.getInt(0));
// shop.name(query.getString(1));
// shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
// shops.add(shop);
// }
//
// query.close();
// }
//
// return shops;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
//
// public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
// public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
// public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
//
// public static int getMaxRecommendations(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getInt(
// KEY_MAX_RECOMMENDATIONS, 9);
// }
//
// public static boolean isUsingFakeLocation(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
// false);
// }
//
// public static boolean isUsingDiversity(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
// KEY_USING_DIVERSITY, true);
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
// /**
// * Holds a list of shop ids and how many recommendations are shown for
// * each shop.
// */
// Map<Integer, Integer> shopMap;
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }
| import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map; |
package com.uwetrottmann.shopr.ui;
public class ShopMapFragment extends SupportMapFragment implements LoaderCallbacks<List<Shop>> {
private static final int RADIUS_METERS = 2000;
private static final int ZOOM_LEVEL_INITIAL = 14;
public static final String TAG = "Shops Map";
private static final int LAODER_ID = 22;
public static ShopMapFragment newInstance() {
return new ShopMapFragment();
}
private List<Marker> mShopMarkers;
private boolean mIsInitialized;
private Map<Integer, Integer> mShopsWithItems;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mIsInitialized = false;
// enable my location feature
getMap().setMyLocationEnabled(!AppSettings.isUsingFakeLocation(getActivity()));
getLoaderManager().initLoader(LAODER_ID, null, this);
}
@Override
public void onStart() {
super.onStart();
EventBus.getDefault() | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
//
// public ShopLoader(Context context) {
// super(context);
// }
//
// @Override
// public List<Shop> loadInBackground() {
// final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
// new String[] {
// Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
// }, null, null,
// null);
//
// List<Shop> shops = Lists.newArrayList();
//
// if (query != null) {
// while (query.moveToNext()) {
// Shop shop = new Shop();
// shop.id(query.getInt(0));
// shop.name(query.getString(1));
// shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
// shops.add(shop);
// }
//
// query.close();
// }
//
// return shops;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
//
// public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
// public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
// public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
//
// public static int getMaxRecommendations(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getInt(
// KEY_MAX_RECOMMENDATIONS, 9);
// }
//
// public static boolean isUsingFakeLocation(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
// false);
// }
//
// public static boolean isUsingDiversity(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
// KEY_USING_DIVERSITY, true);
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
// /**
// * Holds a list of shop ids and how many recommendations are shown for
// * each shop.
// */
// Map<Integer, Integer> shopMap;
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map;
package com.uwetrottmann.shopr.ui;
public class ShopMapFragment extends SupportMapFragment implements LoaderCallbacks<List<Shop>> {
private static final int RADIUS_METERS = 2000;
private static final int ZOOM_LEVEL_INITIAL = 14;
public static final String TAG = "Shops Map";
private static final int LAODER_ID = 22;
public static ShopMapFragment newInstance() {
return new ShopMapFragment();
}
private List<Marker> mShopMarkers;
private boolean mIsInitialized;
private Map<Integer, Integer> mShopsWithItems;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mIsInitialized = false;
// enable my location feature
getMap().setMyLocationEnabled(!AppSettings.isUsingFakeLocation(getActivity()));
getLoaderManager().initLoader(LAODER_ID, null, this);
}
@Override
public void onStart() {
super.onStart();
EventBus.getDefault() | .registerSticky(this, LocationUpdateEvent.class, ShopUpdateEvent.class); |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
//
// public ShopLoader(Context context) {
// super(context);
// }
//
// @Override
// public List<Shop> loadInBackground() {
// final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
// new String[] {
// Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
// }, null, null,
// null);
//
// List<Shop> shops = Lists.newArrayList();
//
// if (query != null) {
// while (query.moveToNext()) {
// Shop shop = new Shop();
// shop.id(query.getInt(0));
// shop.name(query.getString(1));
// shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
// shops.add(shop);
// }
//
// query.close();
// }
//
// return shops;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
//
// public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
// public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
// public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
//
// public static int getMaxRecommendations(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getInt(
// KEY_MAX_RECOMMENDATIONS, 9);
// }
//
// public static boolean isUsingFakeLocation(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
// false);
// }
//
// public static boolean isUsingDiversity(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
// KEY_USING_DIVERSITY, true);
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
// /**
// * Holds a list of shop ids and how many recommendations are shown for
// * each shop.
// */
// Map<Integer, Integer> shopMap;
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }
| import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map; | color = BitmapDescriptorFactory.HUE_VIOLET;
} else {
itemCount = 0;
color = BitmapDescriptorFactory.HUE_AZURE;
}
// place marker
Marker marker = getMap().addMarker(
new MarkerOptions()
.position(shop.location())
.title(shop.name())
.snippet(getString(R.string.has_x_recommendations, itemCount))
.icon(BitmapDescriptorFactory.defaultMarker(color)));
shopMarkersNew.add(marker);
}
mShopMarkers = shopMarkersNew;
}
public void onEvent(LocationUpdateEvent event) {
onInitializeMap();
}
public void onEvent(ShopUpdateEvent event) {
mShopsWithItems = event.shopMap;
getLoaderManager().restartLoader(LAODER_ID, null, this);
}
@Override
public Loader<List<Shop>> onCreateLoader(int loaderId, Bundle args) { | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
// public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
//
// public ShopLoader(Context context) {
// super(context);
// }
//
// @Override
// public List<Shop> loadInBackground() {
// final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI,
// new String[] {
// Shops._ID, Shops.NAME, Shops.LAT, Shops.LONG
// }, null, null,
// null);
//
// List<Shop> shops = Lists.newArrayList();
//
// if (query != null) {
// while (query.moveToNext()) {
// Shop shop = new Shop();
// shop.id(query.getInt(0));
// shop.name(query.getString(1));
// shop.location(new LatLng(query.getDouble(2), query.getDouble(3)));
// shops.add(shop);
// }
//
// query.close();
// }
//
// return shops;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/settings/AppSettings.java
// public class AppSettings {
//
// public static final String KEY_MAX_RECOMMENDATIONS = "com.uwetrottmann.shopr.maxrecommendations";
// public static final String KEY_FAKE_LOCATION = "com.uwetrottmann.shopr.fakelocation";
// public static final String KEY_USING_DIVERSITY = "com.uwetrottmann.shopr.usingdiversity";
//
// public static int getMaxRecommendations(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getInt(
// KEY_MAX_RECOMMENDATIONS, 9);
// }
//
// public static boolean isUsingFakeLocation(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_FAKE_LOCATION,
// false);
// }
//
// public static boolean isUsingDiversity(Context context) {
// return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
// KEY_USING_DIVERSITY, true);
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ItemListFragment.java
// public class ShopUpdateEvent {
// /**
// * Holds a list of shop ids and how many recommendations are shown for
// * each shop.
// */
// Map<Integer, Integer> shopMap;
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/MainActivity.java
// public class LocationUpdateEvent {
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/ui/ShopMapFragment.java
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.loaders.ShopLoader;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.settings.AppSettings;
import com.uwetrottmann.shopr.ui.ItemListFragment.ShopUpdateEvent;
import com.uwetrottmann.shopr.ui.MainActivity.LocationUpdateEvent;
import de.greenrobot.event.EventBus;
import java.util.List;
import java.util.Map;
color = BitmapDescriptorFactory.HUE_VIOLET;
} else {
itemCount = 0;
color = BitmapDescriptorFactory.HUE_AZURE;
}
// place marker
Marker marker = getMap().addMarker(
new MarkerOptions()
.position(shop.location())
.title(shop.name())
.snippet(getString(R.string.has_x_recommendations, itemCount))
.icon(BitmapDescriptorFactory.defaultMarker(color)));
shopMarkersNew.add(marker);
}
mShopMarkers = shopMarkersNew;
}
public void onEvent(LocationUpdateEvent event) {
onInitializeMap();
}
public void onEvent(ShopUpdateEvent event) {
mShopsWithItems = event.shopMap;
getLoaderManager().restartLoader(LAODER_ID, null, this);
}
@Override
public Loader<List<Shop>> onCreateLoader(int loaderId, Bundle args) { | return new ShopLoader(getActivity()); |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/eval/Statistics.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_STATS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
//
// public static Uri buildStatUri(int statId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
// .build();
// }
//
// public static String getStatId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
| import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import com.google.analytics.tracking.android.EasyTracker;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats; | mCyclePositiveCount = 0;
}
/**
* Increases the recommendation cycle count by 1. Also the positive cycle
* count if isPositive is true.
*/
public synchronized void incrementCycleCount(boolean isPositive) {
mCycleCount++;
if (isPositive) {
mCyclePositiveCount++;
}
}
/**
* Stops the task and writes all data to the database.
*
* @return The {@link Uri} pointing to the new data set or {@code null} if
* {@link #startTask(String, boolean)} was not called before.
*/
public synchronized Uri finishTask(Context context) {
if (!mIsStarted) {
return null;
}
mIsStarted = false;
long duration = System.currentTimeMillis() - mStartTime;
// Write to database
ContentValues statValues = new ContentValues(); | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_STATS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
//
// public static Uri buildStatUri(int statId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
// .build();
// }
//
// public static String getStatId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/eval/Statistics.java
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import com.google.analytics.tracking.android.EasyTracker;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats;
mCyclePositiveCount = 0;
}
/**
* Increases the recommendation cycle count by 1. Also the positive cycle
* count if isPositive is true.
*/
public synchronized void incrementCycleCount(boolean isPositive) {
mCycleCount++;
if (isPositive) {
mCyclePositiveCount++;
}
}
/**
* Stops the task and writes all data to the database.
*
* @return The {@link Uri} pointing to the new data set or {@code null} if
* {@link #startTask(String, boolean)} was not called before.
*/
public synchronized Uri finishTask(Context context) {
if (!mIsStarted) {
return null;
}
mIsStarted = false;
long duration = System.currentTimeMillis() - mStartTime;
// Write to database
ContentValues statValues = new ContentValues(); | statValues.put(Stats.USERNAME, mUserName); |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/importer/CsvImportTask.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/utils/Utils.java
// public class Utils {
//
// /**
// * Returns the first http url out of the given array in the form of
// * "[http://abc,http://cde]".
// */
// public static String extractFirstUrl(String arrayAsString) {
// arrayAsString = arrayAsString.substring(1, arrayAsString.length() - 1);
// /*
// * Some eBay URLs sadly include commas (,), so really split by ",http".
// * We only want the first one anyhow.
// */
// String url = arrayAsString.split(",http")[0];
// return url;
// }
//
// }
| import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import au.com.bytecode.opencsv.CSVReader;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.utils.Utils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random; | return "Input stream is null.";
}
CSVReader reader = new CSVReader(new InputStreamReader(mInputStream));
// read shops line by line
Log.d(TAG, "Reading values.");
ArrayList<ContentValues> newValues = Lists.newArrayList();
try {
String[] firstLine = reader.readNext(); // skip first line
if (firstLine == null) {
return "No data.";
}
if ((mType == Type.IMPORT_ITEMS && firstLine.length != 9) ||
mType == Type.IMPORT_SHOPS && firstLine.length != 9) {
Log.d(TAG, "Invalid column count.");
return "Invalid column count.";
}
Log.d(TAG, "Importing the following CSV schema: " + Arrays.toString(firstLine));
String[] line;
Random random = new Random(123456); // seed to get fixed
// distribution
while ((line = reader.readNext()) != null) {
ContentValues values = new ContentValues();
switch (mType) {
case IMPORT_SHOPS:
// add values for one shop | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/utils/Utils.java
// public class Utils {
//
// /**
// * Returns the first http url out of the given array in the form of
// * "[http://abc,http://cde]".
// */
// public static String extractFirstUrl(String arrayAsString) {
// arrayAsString = arrayAsString.substring(1, arrayAsString.length() - 1);
// /*
// * Some eBay URLs sadly include commas (,), so really split by ",http".
// * We only want the first one anyhow.
// */
// String url = arrayAsString.split(",http")[0];
// return url;
// }
//
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/importer/CsvImportTask.java
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import au.com.bytecode.opencsv.CSVReader;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.utils.Utils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
return "Input stream is null.";
}
CSVReader reader = new CSVReader(new InputStreamReader(mInputStream));
// read shops line by line
Log.d(TAG, "Reading values.");
ArrayList<ContentValues> newValues = Lists.newArrayList();
try {
String[] firstLine = reader.readNext(); // skip first line
if (firstLine == null) {
return "No data.";
}
if ((mType == Type.IMPORT_ITEMS && firstLine.length != 9) ||
mType == Type.IMPORT_SHOPS && firstLine.length != 9) {
Log.d(TAG, "Invalid column count.");
return "Invalid column count.";
}
Log.d(TAG, "Importing the following CSV schema: " + Arrays.toString(firstLine));
String[] line;
Random random = new Random(123456); // seed to get fixed
// distribution
while ((line = reader.readNext()) != null) {
ContentValues values = new ContentValues();
switch (mType) {
case IMPORT_SHOPS:
// add values for one shop | values.put(Shops._ID, line[0]); |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/importer/CsvImportTask.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/utils/Utils.java
// public class Utils {
//
// /**
// * Returns the first http url out of the given array in the form of
// * "[http://abc,http://cde]".
// */
// public static String extractFirstUrl(String arrayAsString) {
// arrayAsString = arrayAsString.substring(1, arrayAsString.length() - 1);
// /*
// * Some eBay URLs sadly include commas (,), so really split by ",http".
// * We only want the first one anyhow.
// */
// String url = arrayAsString.split(",http")[0];
// return url;
// }
//
// }
| import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import au.com.bytecode.opencsv.CSVReader;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.utils.Utils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random; | try {
String[] firstLine = reader.readNext(); // skip first line
if (firstLine == null) {
return "No data.";
}
if ((mType == Type.IMPORT_ITEMS && firstLine.length != 9) ||
mType == Type.IMPORT_SHOPS && firstLine.length != 9) {
Log.d(TAG, "Invalid column count.");
return "Invalid column count.";
}
Log.d(TAG, "Importing the following CSV schema: " + Arrays.toString(firstLine));
String[] line;
Random random = new Random(123456); // seed to get fixed
// distribution
while ((line = reader.readNext()) != null) {
ContentValues values = new ContentValues();
switch (mType) {
case IMPORT_SHOPS:
// add values for one shop
values.put(Shops._ID, line[0]);
values.put(Shops.NAME, line[1]);
values.put(Shops.OPENING_HOURS, line[2]);
values.put(Shops.LAT, line[5]);
values.put(Shops.LONG, line[6]);
break;
case IMPORT_ITEMS:
// add values for one item | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/utils/Utils.java
// public class Utils {
//
// /**
// * Returns the first http url out of the given array in the form of
// * "[http://abc,http://cde]".
// */
// public static String extractFirstUrl(String arrayAsString) {
// arrayAsString = arrayAsString.substring(1, arrayAsString.length() - 1);
// /*
// * Some eBay URLs sadly include commas (,), so really split by ",http".
// * We only want the first one anyhow.
// */
// String url = arrayAsString.split(",http")[0];
// return url;
// }
//
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/importer/CsvImportTask.java
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import au.com.bytecode.opencsv.CSVReader;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.utils.Utils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
try {
String[] firstLine = reader.readNext(); // skip first line
if (firstLine == null) {
return "No data.";
}
if ((mType == Type.IMPORT_ITEMS && firstLine.length != 9) ||
mType == Type.IMPORT_SHOPS && firstLine.length != 9) {
Log.d(TAG, "Invalid column count.");
return "Invalid column count.";
}
Log.d(TAG, "Importing the following CSV schema: " + Arrays.toString(firstLine));
String[] line;
Random random = new Random(123456); // seed to get fixed
// distribution
while ((line = reader.readNext()) != null) {
ContentValues values = new ContentValues();
switch (mType) {
case IMPORT_SHOPS:
// add values for one shop
values.put(Shops._ID, line[0]);
values.put(Shops.NAME, line[1]);
values.put(Shops.OPENING_HOURS, line[2]);
values.put(Shops.LAT, line[5]);
values.put(Shops.LONG, line[6]);
break;
case IMPORT_ITEMS:
// add values for one item | values.put(Items._ID, line[0]); |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/importer/CsvImportTask.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/utils/Utils.java
// public class Utils {
//
// /**
// * Returns the first http url out of the given array in the form of
// * "[http://abc,http://cde]".
// */
// public static String extractFirstUrl(String arrayAsString) {
// arrayAsString = arrayAsString.substring(1, arrayAsString.length() - 1);
// /*
// * Some eBay URLs sadly include commas (,), so really split by ",http".
// * We only want the first one anyhow.
// */
// String url = arrayAsString.split(",http")[0];
// return url;
// }
//
// }
| import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import au.com.bytecode.opencsv.CSVReader;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.utils.Utils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random; | }
Log.d(TAG, "Importing the following CSV schema: " + Arrays.toString(firstLine));
String[] line;
Random random = new Random(123456); // seed to get fixed
// distribution
while ((line = reader.readNext()) != null) {
ContentValues values = new ContentValues();
switch (mType) {
case IMPORT_SHOPS:
// add values for one shop
values.put(Shops._ID, line[0]);
values.put(Shops.NAME, line[1]);
values.put(Shops.OPENING_HOURS, line[2]);
values.put(Shops.LAT, line[5]);
values.put(Shops.LONG, line[6]);
break;
case IMPORT_ITEMS:
// add values for one item
values.put(Items._ID, line[0]);
values.put(Shops.REF_SHOP_ID, random.nextInt(129));
values.put(Items.CLOTHING_TYPE, line[1]);
values.put(Items.SEX, line[2]);
values.put(Items.COLOR, line[3]);
values.put(Items.BRAND, line[4]);
values.put(Items.PRICE, line[5]);
// extract first image
String imageUrl = line[6]; | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/utils/Utils.java
// public class Utils {
//
// /**
// * Returns the first http url out of the given array in the form of
// * "[http://abc,http://cde]".
// */
// public static String extractFirstUrl(String arrayAsString) {
// arrayAsString = arrayAsString.substring(1, arrayAsString.length() - 1);
// /*
// * Some eBay URLs sadly include commas (,), so really split by ",http".
// * We only want the first one anyhow.
// */
// String url = arrayAsString.split(",http")[0];
// return url;
// }
//
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/importer/CsvImportTask.java
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import au.com.bytecode.opencsv.CSVReader;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.R;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.utils.Utils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
}
Log.d(TAG, "Importing the following CSV schema: " + Arrays.toString(firstLine));
String[] line;
Random random = new Random(123456); // seed to get fixed
// distribution
while ((line = reader.readNext()) != null) {
ContentValues values = new ContentValues();
switch (mType) {
case IMPORT_SHOPS:
// add values for one shop
values.put(Shops._ID, line[0]);
values.put(Shops.NAME, line[1]);
values.put(Shops.OPENING_HOURS, line[2]);
values.put(Shops.LAT, line[5]);
values.put(Shops.LONG, line[6]);
break;
case IMPORT_ITEMS:
// add values for one item
values.put(Items._ID, line[0]);
values.put(Shops.REF_SHOP_ID, random.nextInt(129));
values.put(Items.CLOTHING_TYPE, line[1]);
values.put(Items.SEX, line[2]);
values.put(Items.COLOR, line[3]);
values.put(Items.BRAND, line[4]);
values.put(Items.PRICE, line[5]);
// extract first image
String imageUrl = line[6]; | imageUrl = Utils.extractFirstUrl(imageUrl); |
UweTrottmann/Shopr | Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/Similarity.java | // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public class Attributes {
//
// public interface Attribute {
// public String id();
//
// public AttributeValue currentValue();
//
// public double[] getValueWeights();
//
// public String getValueWeightsString();
//
// public String getReasonString();
//
// public void critiqueQuery(Query query, boolean isPositive);
// }
//
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
//
// private HashMap<String, Attribute> attributes = new HashMap<String, Attributes.Attribute>();
//
// public Attribute getAttributeById(String id) {
// return attributes.get(id);
// }
//
// /**
// * Adds the new attribute mapped by its {@link Attribute#id()} or replaces
// * an existing one.
// */
// public Attributes putAttribute(Attribute attribute) {
// attributes.put(attribute.id(), attribute);
// return this;
// }
//
// public List<Attribute> getAllAttributes() {
// List<Attribute> attributeList = new ArrayList<Attribute>();
// attributeList.addAll(attributes.values());
//
// return attributeList;
// }
//
// public String getAllAttributesString() {
// StringBuilder attrsStr = new StringBuilder("");
//
// List<Attribute> allAttributes = getAllAttributes();
// for (int i = 0; i < allAttributes.size(); i++) {
// attrsStr.append(allAttributes.get(i).getValueWeightsString());
// if (i != allAttributes.size() - 1) {
// attrsStr.append(" ");
// }
// }
//
// return attrsStr.toString();
// }
//
// /**
// * Returns a string describing this query for an end-user, e.g.
// * "no Red, mainly Blue, no Armani".
// */
// public String getReasonString() {
// StringBuilder reason = new StringBuilder();
//
// List<Attribute> allAttributes = getAllAttributes();
// for (int i = 0; i < allAttributes.size(); i++) {
// Attribute attribute = allAttributes.get(i);
// String attrString = attribute.getReasonString();
// if (attrString != null && attrString.length() != 0) {
// if (reason.length() != 0) {
// reason.append(", ");
// }
// reason.append(attrString);
// }
// }
//
// return reason.toString();
// }
//
// /**
// * Calls {@link #putAttribute(Attribute)} with a {@link GenericAttribute}
// * implementation matching the given id.
// */
// public void initializeAttribute(Attribute attribute) {
// try {
// Class<?> attrClass = Class.forName(attribute.getClass().getCanonicalName());
// Attribute newAttr = (Attribute) attrClass.newInstance();
// putAttribute(newAttr);
// } catch (ClassNotFoundException ex) {
// System.err.println(ex + " Interpreter class must be in class path.");
// } catch (InstantiationException ex) {
// System.err.println(ex + " Interpreter class must be concrete.");
// } catch (IllegalAccessException ex) {
// System.err.println(ex + " Interpreter class must have a no-arg constructor.");
// }
// }
//
// }
//
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface Attribute {
// public String id();
//
// public AttributeValue currentValue();
//
// public double[] getValueWeights();
//
// public String getValueWeightsString();
//
// public String getReasonString();
//
// public void critiqueQuery(Query query, boolean isPositive);
// }
| import com.uwetrottmann.shopr.algorithm.model.Attributes;
import com.uwetrottmann.shopr.algorithm.model.Attributes.Attribute;
import java.util.List; |
package com.uwetrottmann.shopr.algorithm;
public class Similarity {
public static double similarity(Attributes first, Attributes second) { | // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public class Attributes {
//
// public interface Attribute {
// public String id();
//
// public AttributeValue currentValue();
//
// public double[] getValueWeights();
//
// public String getValueWeightsString();
//
// public String getReasonString();
//
// public void critiqueQuery(Query query, boolean isPositive);
// }
//
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
//
// private HashMap<String, Attribute> attributes = new HashMap<String, Attributes.Attribute>();
//
// public Attribute getAttributeById(String id) {
// return attributes.get(id);
// }
//
// /**
// * Adds the new attribute mapped by its {@link Attribute#id()} or replaces
// * an existing one.
// */
// public Attributes putAttribute(Attribute attribute) {
// attributes.put(attribute.id(), attribute);
// return this;
// }
//
// public List<Attribute> getAllAttributes() {
// List<Attribute> attributeList = new ArrayList<Attribute>();
// attributeList.addAll(attributes.values());
//
// return attributeList;
// }
//
// public String getAllAttributesString() {
// StringBuilder attrsStr = new StringBuilder("");
//
// List<Attribute> allAttributes = getAllAttributes();
// for (int i = 0; i < allAttributes.size(); i++) {
// attrsStr.append(allAttributes.get(i).getValueWeightsString());
// if (i != allAttributes.size() - 1) {
// attrsStr.append(" ");
// }
// }
//
// return attrsStr.toString();
// }
//
// /**
// * Returns a string describing this query for an end-user, e.g.
// * "no Red, mainly Blue, no Armani".
// */
// public String getReasonString() {
// StringBuilder reason = new StringBuilder();
//
// List<Attribute> allAttributes = getAllAttributes();
// for (int i = 0; i < allAttributes.size(); i++) {
// Attribute attribute = allAttributes.get(i);
// String attrString = attribute.getReasonString();
// if (attrString != null && attrString.length() != 0) {
// if (reason.length() != 0) {
// reason.append(", ");
// }
// reason.append(attrString);
// }
// }
//
// return reason.toString();
// }
//
// /**
// * Calls {@link #putAttribute(Attribute)} with a {@link GenericAttribute}
// * implementation matching the given id.
// */
// public void initializeAttribute(Attribute attribute) {
// try {
// Class<?> attrClass = Class.forName(attribute.getClass().getCanonicalName());
// Attribute newAttr = (Attribute) attrClass.newInstance();
// putAttribute(newAttr);
// } catch (ClassNotFoundException ex) {
// System.err.println(ex + " Interpreter class must be in class path.");
// } catch (InstantiationException ex) {
// System.err.println(ex + " Interpreter class must be concrete.");
// } catch (IllegalAccessException ex) {
// System.err.println(ex + " Interpreter class must have a no-arg constructor.");
// }
// }
//
// }
//
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface Attribute {
// public String id();
//
// public AttributeValue currentValue();
//
// public double[] getValueWeights();
//
// public String getValueWeightsString();
//
// public String getReasonString();
//
// public void critiqueQuery(Query query, boolean isPositive);
// }
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/Similarity.java
import com.uwetrottmann.shopr.algorithm.model.Attributes;
import com.uwetrottmann.shopr.algorithm.model.Attributes.Attribute;
import java.util.List;
package com.uwetrottmann.shopr.algorithm;
public class Similarity {
public static double similarity(Attributes first, Attributes second) { | List<Attribute> attrsFirst = first.getAllAttributes(); |
UweTrottmann/Shopr | Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Sex.java | // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
| import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import java.util.Arrays; |
package com.uwetrottmann.shopr.algorithm.model;
public class Sex extends GenericAttribute {
public static final String ID = "sex";
| // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Sex.java
import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import java.util.Arrays;
package com.uwetrottmann.shopr.algorithm.model;
public class Sex extends GenericAttribute {
public static final String ID = "sex";
| public enum Value implements AttributeValue { |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprDatabase.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_STATS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
//
// public static Uri buildStatUri(int statId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
// .build();
// }
//
// public static String getStatId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
| import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats; |
package com.uwetrottmann.shopr.provider;
public class ShoprDatabase extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "shopr.db";
public static final int DBVER_INITIAL = 1;
public static final int DBVER_ITEM_COLUMNS = 2;
public static final int DBVER_STATS = 3;
public static final int DATABASE_VERSION = DBVER_STATS;
public interface Tables {
String ITEMS = "items";
String SHOPS = "shops";
String STATS = "stats";
}
public interface References { | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_STATS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
//
// public static Uri buildStatUri(int statId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
// .build();
// }
//
// public static String getStatId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprDatabase.java
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats;
package com.uwetrottmann.shopr.provider;
public class ShoprDatabase extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "shopr.db";
public static final int DBVER_INITIAL = 1;
public static final int DBVER_ITEM_COLUMNS = 2;
public static final int DBVER_STATS = 3;
public static final int DATABASE_VERSION = DBVER_STATS;
public interface Tables {
String ITEMS = "items";
String SHOPS = "shops";
String STATS = "stats";
}
public interface References { | String SHOP_ID = "REFERENCES " + Tables.SHOPS + "(" + Shops._ID + ")"; |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprDatabase.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_STATS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
//
// public static Uri buildStatUri(int statId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
// .build();
// }
//
// public static String getStatId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
| import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats; |
package com.uwetrottmann.shopr.provider;
public class ShoprDatabase extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "shopr.db";
public static final int DBVER_INITIAL = 1;
public static final int DBVER_ITEM_COLUMNS = 2;
public static final int DBVER_STATS = 3;
public static final int DATABASE_VERSION = DBVER_STATS;
public interface Tables {
String ITEMS = "items";
String SHOPS = "shops";
String STATS = "stats";
}
public interface References {
String SHOP_ID = "REFERENCES " + Tables.SHOPS + "(" + Shops._ID + ")";
}
private static final String CREATE_ITEMS_TABLE = "CREATE TABLE "
+ Tables.ITEMS + " ("
| // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_STATS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
//
// public static Uri buildStatUri(int statId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
// .build();
// }
//
// public static String getStatId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprDatabase.java
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats;
package com.uwetrottmann.shopr.provider;
public class ShoprDatabase extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "shopr.db";
public static final int DBVER_INITIAL = 1;
public static final int DBVER_ITEM_COLUMNS = 2;
public static final int DBVER_STATS = 3;
public static final int DATABASE_VERSION = DBVER_STATS;
public interface Tables {
String ITEMS = "items";
String SHOPS = "shops";
String STATS = "stats";
}
public interface References {
String SHOP_ID = "REFERENCES " + Tables.SHOPS + "(" + Shops._ID + ")";
}
private static final String CREATE_ITEMS_TABLE = "CREATE TABLE "
+ Tables.ITEMS + " ("
| + Items._ID + " INTEGER PRIMARY KEY," |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprDatabase.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_STATS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
//
// public static Uri buildStatUri(int statId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
// .build();
// }
//
// public static String getStatId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
| import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats; | + Items.CLOTHING_TYPE + " TEXT,"
+ Items.COLOR + " TEXT,"
+ Items.PRICE + " REAL,"
+ Items.SEX + " TEXT,"
+ Items.IMAGE_URL + " TEXT"
+ ");";
private static final String CREATE_SHOPS_TABLE = "CREATE TABLE "
+ Tables.SHOPS + " ("
+ Shops._ID + " INTEGER PRIMARY KEY,"
+ Shops.NAME + " TEXT NOT NULL,"
+ Shops.OPENING_HOURS + " TEXT,"
+ Shops.LAT + " REAL,"
+ Shops.LONG + " REAL"
+ ");";
private static final String CREATE_STATS_TABLE = "CREATE TABLE "
+ Tables.STATS + " ("
| // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_ITEMS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
//
// public static Uri buildItemUri(int itemId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
// .build();
// }
//
// public static String getItemId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_STATS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
//
// public static Uri buildStatUri(int statId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
// .build();
// }
//
// public static String getStatId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprDatabase.java
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats;
+ Items.CLOTHING_TYPE + " TEXT,"
+ Items.COLOR + " TEXT,"
+ Items.PRICE + " REAL,"
+ Items.SEX + " TEXT,"
+ Items.IMAGE_URL + " TEXT"
+ ");";
private static final String CREATE_SHOPS_TABLE = "CREATE TABLE "
+ Tables.SHOPS + " ("
+ Shops._ID + " INTEGER PRIMARY KEY,"
+ Shops.NAME + " TEXT NOT NULL,"
+ Shops.OPENING_HOURS + " TEXT,"
+ Shops.LAT + " REAL,"
+ Shops.LONG + " REAL"
+ ");";
private static final String CREATE_STATS_TABLE = "CREATE TABLE "
+ Tables.STATS + " ("
| + Stats._ID + " INTEGER PRIMARY KEY," |
UweTrottmann/Shopr | Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
| import android.content.Context;
import android.database.Cursor;
import com.google.android.gms.maps.model.LatLng;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import java.util.List; |
package com.uwetrottmann.shopr.loaders;
public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
public ShopLoader(Context context) {
super(context);
}
@Override
public List<Shop> loadInBackground() { | // Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/model/Shop.java
// public class Shop {
//
// private int id;
// private String name;
// private LatLng location;
//
// public int id() {
// return id;
// }
//
// public Shop id(int id) {
// this.id = id;
// return this;
// }
//
// public String name() {
// return name;
// }
//
// public Shop name(String name) {
// this.name = name;
// return this;
// }
//
// public LatLng location() {
// return location;
// }
//
// public Shop location(LatLng location) {
// this.location = location;
// return this;
// }
//
// }
//
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
// public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
// .appendPath(PATH_SHOPS).build();
//
// /** Use if multiple items get returned */
// public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
//
// /** Use if a single item is returned */
// public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
//
// public static Uri buildShopUri(int shopId) {
// return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
// .build();
// }
//
// public static String getShopId(Uri uri) {
// return uri.getLastPathSegment();
// }
// }
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/loaders/ShopLoader.java
import android.content.Context;
import android.database.Cursor;
import com.google.android.gms.maps.model.LatLng;
import com.uwetrottmann.androidutils.Lists;
import com.uwetrottmann.shopr.model.Shop;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import java.util.List;
package com.uwetrottmann.shopr.loaders;
public class ShopLoader extends GenericSimpleLoader<List<Shop>> {
public ShopLoader(Context context) {
super(context);
}
@Override
public List<Shop> loadInBackground() { | final Cursor query = getContext().getContentResolver().query(Shops.CONTENT_URI, |
UweTrottmann/Shopr | Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Price.java | // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
| import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import org.jgrapht.Graphs;
import org.jgrapht.UndirectedGraph;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.SimpleGraph;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List; |
package com.uwetrottmann.shopr.algorithm.model;
public class Price extends GenericAttribute {
private static UndirectedGraph<Price.Value, DefaultEdge> sSimilarValues;
static {
sSimilarValues = new SimpleGraph<Price.Value, DefaultEdge>(DefaultEdge.class);
Value[] values = Value.values();
for (Value value : values) {
sSimilarValues.addVertex(value);
}
/**
* Stores similar price values in an undirected graph. Price regions
* right above or below are similar.
*/
sSimilarValues.addEdge(Value.SUB_25, Value.BETWEEN_25_50);
sSimilarValues.addEdge(Value.BETWEEN_25_50, Value.BETWEEN_50_75);
sSimilarValues.addEdge(Value.BETWEEN_50_75, Value.BETWEEN_75_100);
sSimilarValues.addEdge(Value.BETWEEN_75_100, Value.BETWEEN_100_150);
sSimilarValues.addEdge(Value.BETWEEN_100_150, Value.BETWEEN_150_200);
sSimilarValues.addEdge(Value.BETWEEN_150_200, Value.ABOVE_200);
}
public static final String ID = "price";
| // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Price.java
import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import org.jgrapht.Graphs;
import org.jgrapht.UndirectedGraph;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.SimpleGraph;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
package com.uwetrottmann.shopr.algorithm.model;
public class Price extends GenericAttribute {
private static UndirectedGraph<Price.Value, DefaultEdge> sSimilarValues;
static {
sSimilarValues = new SimpleGraph<Price.Value, DefaultEdge>(DefaultEdge.class);
Value[] values = Value.values();
for (Value value : values) {
sSimilarValues.addVertex(value);
}
/**
* Stores similar price values in an undirected graph. Price regions
* right above or below are similar.
*/
sSimilarValues.addEdge(Value.SUB_25, Value.BETWEEN_25_50);
sSimilarValues.addEdge(Value.BETWEEN_25_50, Value.BETWEEN_50_75);
sSimilarValues.addEdge(Value.BETWEEN_50_75, Value.BETWEEN_75_100);
sSimilarValues.addEdge(Value.BETWEEN_75_100, Value.BETWEEN_100_150);
sSimilarValues.addEdge(Value.BETWEEN_100_150, Value.BETWEEN_150_200);
sSimilarValues.addEdge(Value.BETWEEN_150_200, Value.ABOVE_200);
}
public static final String ID = "price";
| public enum Value implements AttributeValue { |
UweTrottmann/Shopr | Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Label.java | // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
| import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import java.util.Arrays; |
package com.uwetrottmann.shopr.algorithm.model;
public class Label extends GenericAttribute {
public static final String ID = "label";
| // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Label.java
import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import java.util.Arrays;
package com.uwetrottmann.shopr.algorithm.model;
public class Label extends GenericAttribute {
public static final String ID = "label";
| public enum Value implements AttributeValue { |
UweTrottmann/Shopr | Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java | // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/Query.java
// public class Query {
//
// private Attributes attrs;
//
// public Query() {
// attrs = new Attributes();
// }
//
// public Attributes attributes() {
// return attrs;
// }
// }
| import com.uwetrottmann.shopr.algorithm.Query;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; |
package com.uwetrottmann.shopr.algorithm.model;
/**
* Holds a list of possible attributes of an item.
*/
public class Attributes {
public interface Attribute {
public String id();
public AttributeValue currentValue();
public double[] getValueWeights();
public String getValueWeightsString();
public String getReasonString();
| // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/Query.java
// public class Query {
//
// private Attributes attrs;
//
// public Query() {
// attrs = new Attributes();
// }
//
// public Attributes attributes() {
// return attrs;
// }
// }
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
import com.uwetrottmann.shopr.algorithm.Query;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
package com.uwetrottmann.shopr.algorithm.model;
/**
* Holds a list of possible attributes of an item.
*/
public class Attributes {
public interface Attribute {
public String id();
public AttributeValue currentValue();
public double[] getValueWeights();
public String getValueWeightsString();
public String getReasonString();
| public void critiqueQuery(Query query, boolean isPositive); |
UweTrottmann/Shopr | Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Color.java | // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
| import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import org.jgrapht.Graphs;
import org.jgrapht.UndirectedGraph;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.SimpleGraph;
import java.util.Arrays;
import java.util.List; |
package com.uwetrottmann.shopr.algorithm.model;
public class Color extends GenericAttribute {
private static UndirectedGraph<Color.Value, DefaultEdge> sSimilarValues;
static {
sSimilarValues = new SimpleGraph<Color.Value, DefaultEdge>(DefaultEdge.class);
Value[] values = Value.values();
for (Value value : values) {
sSimilarValues.addVertex(value);
}
/**
* Stores similar price values in an undirected graph. This is rather
* subjective, e.g. white is similar to grey. Red is similar to pink,
* etc.
*/
sSimilarValues.addEdge(Value.BLUE, Value.PURPLE);
sSimilarValues.addEdge(Value.BLUE, Value.TURQUOISE);
sSimilarValues.addEdge(Value.RED, Value.PURPLE);
sSimilarValues.addEdge(Value.RED, Value.PINK);
sSimilarValues.addEdge(Value.YELLOW, Value.ORANGE);
sSimilarValues.addEdge(Value.BLACK, Value.GREY);
sSimilarValues.addEdge(Value.WHITE, Value.BEIGE);
sSimilarValues.addEdge(Value.WHITE, Value.GREY);
sSimilarValues.addEdge(Value.COLORED, Value.MIXED);
sSimilarValues.addEdge(Value.BROWN, Value.BEIGE);
}
public static final String ID = "color";
| // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Color.java
import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import org.jgrapht.Graphs;
import org.jgrapht.UndirectedGraph;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.SimpleGraph;
import java.util.Arrays;
import java.util.List;
package com.uwetrottmann.shopr.algorithm.model;
public class Color extends GenericAttribute {
private static UndirectedGraph<Color.Value, DefaultEdge> sSimilarValues;
static {
sSimilarValues = new SimpleGraph<Color.Value, DefaultEdge>(DefaultEdge.class);
Value[] values = Value.values();
for (Value value : values) {
sSimilarValues.addVertex(value);
}
/**
* Stores similar price values in an undirected graph. This is rather
* subjective, e.g. white is similar to grey. Red is similar to pink,
* etc.
*/
sSimilarValues.addEdge(Value.BLUE, Value.PURPLE);
sSimilarValues.addEdge(Value.BLUE, Value.TURQUOISE);
sSimilarValues.addEdge(Value.RED, Value.PURPLE);
sSimilarValues.addEdge(Value.RED, Value.PINK);
sSimilarValues.addEdge(Value.YELLOW, Value.ORANGE);
sSimilarValues.addEdge(Value.BLACK, Value.GREY);
sSimilarValues.addEdge(Value.WHITE, Value.BEIGE);
sSimilarValues.addEdge(Value.WHITE, Value.GREY);
sSimilarValues.addEdge(Value.COLORED, Value.MIXED);
sSimilarValues.addEdge(Value.BROWN, Value.BEIGE);
}
public static final String ID = "color";
| public enum Value implements AttributeValue { |
UweTrottmann/Shopr | Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/ClothingType.java | // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
| import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import org.jgrapht.Graphs;
import org.jgrapht.UndirectedGraph;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.SimpleGraph;
import java.util.Arrays;
import java.util.List; |
package com.uwetrottmann.shopr.algorithm.model;
public class ClothingType extends GenericAttribute {
private static UndirectedGraph<ClothingType.Value, DefaultEdge> sSimilarValues;
static {
sSimilarValues = new SimpleGraph<ClothingType.Value, DefaultEdge>(DefaultEdge.class);
Value[] values = Value.values();
for (Value value : values) {
sSimilarValues.addVertex(value);
}
/**
* Store similar clothing type values in an undirected graph.
*/
sSimilarValues.addEdge(Value.SHIRT, Value.POLOSHIRT);
sSimilarValues.addEdge(Value.SHIRT, Value.BLOUSE);
sSimilarValues.addEdge(Value.TROUSERS, Value.JEANS);
sSimilarValues.addEdge(Value.TROUSERS, Value.SHORTS);
sSimilarValues.addEdge(Value.TROUSERS, Value.SKIRT);
sSimilarValues.addEdge(Value.SKIRT, Value.SHORTS);
sSimilarValues.addEdge(Value.CARDIGAN, Value.SWEATER);
sSimilarValues.addEdge(Value.TOP, Value.SHIRT);
sSimilarValues.addEdge(Value.TOP, Value.BLOUSE);
}
public static final String ID = "clothing-type";
| // Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/Attributes.java
// public interface AttributeValue {
//
// /**
// * Returns the index of this value in the weights vector of the
// * attribute.
// */
// public int index();
//
// /**
// * Returns a {@link String} representation suitable for end-user
// * representation.
// */
// public String descriptor();
// }
// Path: Java/ShoprAlgorithm/src/com/uwetrottmann/shopr/algorithm/model/ClothingType.java
import com.uwetrottmann.shopr.algorithm.model.Attributes.AttributeValue;
import org.jgrapht.Graphs;
import org.jgrapht.UndirectedGraph;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.SimpleGraph;
import java.util.Arrays;
import java.util.List;
package com.uwetrottmann.shopr.algorithm.model;
public class ClothingType extends GenericAttribute {
private static UndirectedGraph<ClothingType.Value, DefaultEdge> sSimilarValues;
static {
sSimilarValues = new SimpleGraph<ClothingType.Value, DefaultEdge>(DefaultEdge.class);
Value[] values = Value.values();
for (Value value : values) {
sSimilarValues.addVertex(value);
}
/**
* Store similar clothing type values in an undirected graph.
*/
sSimilarValues.addEdge(Value.SHIRT, Value.POLOSHIRT);
sSimilarValues.addEdge(Value.SHIRT, Value.BLOUSE);
sSimilarValues.addEdge(Value.TROUSERS, Value.JEANS);
sSimilarValues.addEdge(Value.TROUSERS, Value.SHORTS);
sSimilarValues.addEdge(Value.TROUSERS, Value.SKIRT);
sSimilarValues.addEdge(Value.SKIRT, Value.SHORTS);
sSimilarValues.addEdge(Value.CARDIGAN, Value.SWEATER);
sSimilarValues.addEdge(Value.TOP, Value.SHIRT);
sSimilarValues.addEdge(Value.TOP, Value.BLOUSE);
}
public static final String ID = "clothing-type";
| public enum Value implements AttributeValue { |
WolfgangFahl/Mediawiki-Japi | src/main/java/com/bitplan/mediawiki/japi/PageInfo.java | // Path: src/main/java/com/bitplan/mediawiki/japi/api/Ns.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "", propOrder = {
// "value"
// })
// public class Ns {
//
// @XmlValue
// protected String value;
// @XmlAttribute
// protected Integer id;
// @XmlAttribute(name = "case")
// protected String _case;
// @XmlAttribute
// protected String canonical;
// @XmlAttribute
// protected String content;
// @XmlAttribute
// protected String subpages;
//
// /**
// * Gets the value of the value property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getValue() {
// return value;
// }
//
// /**
// * Sets the value of the value property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setValue(String value) {
// this.value = value;
// }
//
// /**
// * Gets the value of the id property.
// *
// * @return
// * possible object is
// * {@link Integer }
// *
// */
// public Integer getId() {
// return id;
// }
//
// /**
// * Sets the value of the id property.
// *
// * @param value
// * allowed object is
// * {@link Integer }
// *
// */
// public void setId(Integer value) {
// this.id = value;
// }
//
// /**
// * Gets the value of the case property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getCase() {
// return _case;
// }
//
// /**
// * Sets the value of the case property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setCase(String value) {
// this._case = value;
// }
//
// /**
// * Gets the value of the canonical property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getCanonical() {
// return canonical;
// }
//
// /**
// * Sets the value of the canonical property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setCanonical(String value) {
// this.canonical = value;
// }
//
// /**
// * Gets the value of the content property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getContent() {
// return content;
// }
//
// /**
// * Sets the value of the content property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setContent(String value) {
// this.content = value;
// }
//
// /**
// * Gets the value of the subpages property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getSubpages() {
// return subpages;
// }
//
// /**
// * Sets the value of the subpages property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setSubpages(String value) {
// this.subpages = value;
// }
//
// }
| import java.util.regex.Pattern;
import com.bitplan.mediawiki.japi.api.Ns;
import java.util.logging.Level;
import java.util.regex.Matcher; | /**
*
* This file is part of the https://github.com/WolfgangFahl/Mediawiki-Japi open source project
*
* Copyright 2015-2021 BITPlan GmbH https://github.com/BITPlan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http:www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bitplan.mediawiki.japi;
/**
* helper class for canonical Page Titles
*/
public class PageInfo {
/**
* Logging may be enabled by setting debug to true
*/
protected static java.util.logging.Logger LOGGER = java.util.logging.Logger
.getLogger("com.bitplan.mediawiki.japi");
public static boolean debug = false;
int namespaceId = -999;
String lang;
String pageTitle;
String canonicalPageTitle; | // Path: src/main/java/com/bitplan/mediawiki/japi/api/Ns.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "", propOrder = {
// "value"
// })
// public class Ns {
//
// @XmlValue
// protected String value;
// @XmlAttribute
// protected Integer id;
// @XmlAttribute(name = "case")
// protected String _case;
// @XmlAttribute
// protected String canonical;
// @XmlAttribute
// protected String content;
// @XmlAttribute
// protected String subpages;
//
// /**
// * Gets the value of the value property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getValue() {
// return value;
// }
//
// /**
// * Sets the value of the value property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setValue(String value) {
// this.value = value;
// }
//
// /**
// * Gets the value of the id property.
// *
// * @return
// * possible object is
// * {@link Integer }
// *
// */
// public Integer getId() {
// return id;
// }
//
// /**
// * Sets the value of the id property.
// *
// * @param value
// * allowed object is
// * {@link Integer }
// *
// */
// public void setId(Integer value) {
// this.id = value;
// }
//
// /**
// * Gets the value of the case property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getCase() {
// return _case;
// }
//
// /**
// * Sets the value of the case property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setCase(String value) {
// this._case = value;
// }
//
// /**
// * Gets the value of the canonical property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getCanonical() {
// return canonical;
// }
//
// /**
// * Sets the value of the canonical property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setCanonical(String value) {
// this.canonical = value;
// }
//
// /**
// * Gets the value of the content property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getContent() {
// return content;
// }
//
// /**
// * Sets the value of the content property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setContent(String value) {
// this.content = value;
// }
//
// /**
// * Gets the value of the subpages property.
// *
// * @return
// * possible object is
// * {@link String }
// *
// */
// public String getSubpages() {
// return subpages;
// }
//
// /**
// * Sets the value of the subpages property.
// *
// * @param value
// * allowed object is
// * {@link String }
// *
// */
// public void setSubpages(String value) {
// this.subpages = value;
// }
//
// }
// Path: src/main/java/com/bitplan/mediawiki/japi/PageInfo.java
import java.util.regex.Pattern;
import com.bitplan.mediawiki.japi.api.Ns;
import java.util.logging.Level;
import java.util.regex.Matcher;
/**
*
* This file is part of the https://github.com/WolfgangFahl/Mediawiki-Japi open source project
*
* Copyright 2015-2021 BITPlan GmbH https://github.com/BITPlan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http:www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bitplan.mediawiki.japi;
/**
* helper class for canonical Page Titles
*/
public class PageInfo {
/**
* Logging may be enabled by setting debug to true
*/
protected static java.util.logging.Logger LOGGER = java.util.logging.Logger
.getLogger("com.bitplan.mediawiki.japi");
public static boolean debug = false;
int namespaceId = -999;
String lang;
String pageTitle;
String canonicalPageTitle; | Ns namespace; |
WolfgangFahl/Mediawiki-Japi | src/test/java/com/bitplan/mediawiki/japi/ExampleWikiManager.java | // Path: src/test/java/com/bitplan/mediawiki/japi/ExampleWiki.java
// public class ExamplePage extends Page {
// String contentPart;
// boolean forEdit=false;
//
// /**
// * construct an example Page with the given title and the given part of the
// * content
// *
// * @param title
// * @param contentPart
// * @param forEdit
// */
// public ExamplePage(String title, String contentPart,boolean forEdit) {
// this.title = title;
// this.contentPart = contentPart;
// this.forEdit=forEdit;
// }
//
// public ExamplePage(String title, String contentPart) {
// this(title,contentPart,false);
// }
//
// public String getContentPart() {
// return contentPart;
// }
//
// }
| import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import com.bitplan.mediawiki.japi.ExampleWiki.ExamplePage;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector; | String csv = Mediawiki.getStringFromUrl(urlString);
String[] csvlines = csv.split("\n");
int lineIndex = 0;
for (String csvLine : csvlines) {
if (lineIndex++ > 0) {
this.add(this.getExampleWikiFromCSV(csvLine, this.defaultWiki));
}
}
}
/**
* get the given Example wiki
*
* @param wikiId
* @return - the example wiki for the given wikiId
* @throws Exception
*/
public ExampleWiki get(String wikiId) throws Exception {
// this code should be (partly?) replaced by csv-access
if (getExampleWikis().size() == 0) {
// String urlString = "http://mediawiki-japi.bitplan.com/mediawiki-japi/index.php/Special:Ask/-5B-5BCategory:ExampleWiki-5D-5D-20-5B-5Bsiteurl::%2B-5D-5D/-3FSiteurl/-3FWikiid/-3FMwversion/-3FMwMinExpectedPages/format%3Dcsv/sep%3D;/offset%3D0";
// FIXME uncomment to activate
// readCSV(urlString);
// Mediawiki site
ExampleWiki wiki = add("wikipedia_org_test2",
//"http://www.mediawiki.org",
"https://test2.wikipedia.org",
Mediawiki.DEFAULT_SCRIPTPATH);
wiki.setExpectedPages(30000);
wiki.setLogo("//test2.wikipedia.org/static/images/project-logos/test2wiki.png"); | // Path: src/test/java/com/bitplan/mediawiki/japi/ExampleWiki.java
// public class ExamplePage extends Page {
// String contentPart;
// boolean forEdit=false;
//
// /**
// * construct an example Page with the given title and the given part of the
// * content
// *
// * @param title
// * @param contentPart
// * @param forEdit
// */
// public ExamplePage(String title, String contentPart,boolean forEdit) {
// this.title = title;
// this.contentPart = contentPart;
// this.forEdit=forEdit;
// }
//
// public ExamplePage(String title, String contentPart) {
// this(title,contentPart,false);
// }
//
// public String getContentPart() {
// return contentPart;
// }
//
// }
// Path: src/test/java/com/bitplan/mediawiki/japi/ExampleWikiManager.java
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import com.bitplan.mediawiki.japi.ExampleWiki.ExamplePage;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
String csv = Mediawiki.getStringFromUrl(urlString);
String[] csvlines = csv.split("\n");
int lineIndex = 0;
for (String csvLine : csvlines) {
if (lineIndex++ > 0) {
this.add(this.getExampleWikiFromCSV(csvLine, this.defaultWiki));
}
}
}
/**
* get the given Example wiki
*
* @param wikiId
* @return - the example wiki for the given wikiId
* @throws Exception
*/
public ExampleWiki get(String wikiId) throws Exception {
// this code should be (partly?) replaced by csv-access
if (getExampleWikis().size() == 0) {
// String urlString = "http://mediawiki-japi.bitplan.com/mediawiki-japi/index.php/Special:Ask/-5B-5BCategory:ExampleWiki-5D-5D-20-5B-5Bsiteurl::%2B-5D-5D/-3FSiteurl/-3FWikiid/-3FMwversion/-3FMwMinExpectedPages/format%3Dcsv/sep%3D;/offset%3D0";
// FIXME uncomment to activate
// readCSV(urlString);
// Mediawiki site
ExampleWiki wiki = add("wikipedia_org_test2",
//"http://www.mediawiki.org",
"https://test2.wikipedia.org",
Mediawiki.DEFAULT_SCRIPTPATH);
wiki.setExpectedPages(30000);
wiki.setLogo("//test2.wikipedia.org/static/images/project-logos/test2wiki.png"); | ExamplePage testPage1 = wiki.new ExamplePage("Asteroid", |
upwork/java-upwork | test/com/Upwork/api/Routers/Reports/Finance/EarningsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Earnings.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Earnings {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Earnings(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancer(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/providers/" + freelancerReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer's Team
// *
// * @param freelancerTeamReference Freelancer's team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer's Company
// *
// * @param freelancerCompanyReference Freelancer's company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Buyer's Team
// *
// * @param buyerTeamReference Buyer team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Buyer's Company
// *
// * @param buyerCompanyReference Buyer company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/earnings", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Earnings; | package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Earnings.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Earnings {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Earnings(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancer(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/providers/" + freelancerReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer's Team
// *
// * @param freelancerTeamReference Freelancer's team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer's Company
// *
// * @param freelancerCompanyReference Freelancer's company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Buyer's Team
// *
// * @param buyerTeamReference Buyer team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Buyer's Company
// *
// * @param buyerCompanyReference Buyer company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/earnings", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Reports/Finance/EarningsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Earnings;
package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Earnings.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Reports/Finance/EarningsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Earnings.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Earnings {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Earnings(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancer(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/providers/" + freelancerReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer's Team
// *
// * @param freelancerTeamReference Freelancer's team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer's Company
// *
// * @param freelancerCompanyReference Freelancer's company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Buyer's Team
// *
// * @param buyerTeamReference Buyer team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Buyer's Company
// *
// * @param buyerCompanyReference Buyer company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/earnings", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Earnings; | package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Earnings.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Earnings.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Earnings {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Earnings(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancer(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/providers/" + freelancerReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer's Team
// *
// * @param freelancerTeamReference Freelancer's team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Freelancer's Company
// *
// * @param freelancerCompanyReference Freelancer's company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Buyer's Team
// *
// * @param buyerTeamReference Buyer team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/earnings", params);
// }
//
// /**
// * Generate Earning Reports for a Specific Buyer's Company
// *
// * @param buyerCompanyReference Buyer company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/earnings", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Reports/Finance/EarningsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Earnings;
package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Earnings.class
}) | public class EarningsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Organization/UsersTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Users.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "10/13/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Users {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Users(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Auth User Info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getMyInfo() throws JSONException {
// return oClient.get("/hr/v2/users/me");
// }
//
// /**
// * Get Specific User Info
// *
// * @param userReference User reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String userReference) throws JSONException {
// return oClient.get("/hr/v2/users/" + userReference);
// }
//
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Users; | package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Users.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "10/13/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Users {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Users(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Auth User Info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getMyInfo() throws JSONException {
// return oClient.get("/hr/v2/users/me");
// }
//
// /**
// * Get Specific User Info
// *
// * @param userReference User reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String userReference) throws JSONException {
// return oClient.get("/hr/v2/users/" + userReference);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Organization/UsersTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Users;
package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Users.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Organization/UsersTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Users.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "10/13/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Users {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Users(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Auth User Info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getMyInfo() throws JSONException {
// return oClient.get("/hr/v2/users/me");
// }
//
// /**
// * Get Specific User Info
// *
// * @param userReference User reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String userReference) throws JSONException {
// return oClient.get("/hr/v2/users/" + userReference);
// }
//
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Users; | package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Users.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Users.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "10/13/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Users {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Users(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Auth User Info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getMyInfo() throws JSONException {
// return oClient.get("/hr/v2/users/me");
// }
//
// /**
// * Get Specific User Info
// *
// * @param userReference User reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String userReference) throws JSONException {
// return oClient.get("/hr/v2/users/" + userReference);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Organization/UsersTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Users;
package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Users.class
}) | public class UsersTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/MilestonesTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Milestones.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "11/17/2014",
// currentRevision = 1,
// lastModified = "11/17/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Milestones {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Milestones(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get active Milestone for the Contract
// *
// * @param contractId Contract reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getActiveMilestone(String contractId) throws JSONException {
// return oClient.get("/hr/v3/fp/milestones/statuses/active/contracts/" + contractId);
// }
//
// /**
// * Get all submissions for the active Milestone
// *
// * @param milestoneId Milestone ID
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSubmissions(String milestoneId) throws JSONException {
// return oClient.get("/hr/v3/fp/milestones/" + milestoneId + "/submissions");
// }
//
// /**
// * Create a new Milestone
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject create(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v3/fp/milestones", params);
// }
//
// /**
// * Edit an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject edit(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId, params);
// }
//
// /**
// * Activate an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject activate(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/activate", params);
// }
//
// /**
// * Approve an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject approve(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/approve", params);
// }
//
// /**
// * Delete an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject delete(String milestoneId) throws JSONException {
// return oClient.delete("/hr/v3/fp/milestones/" + milestoneId);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Milestones; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Milestones.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "11/17/2014",
// currentRevision = 1,
// lastModified = "11/17/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Milestones {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Milestones(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get active Milestone for the Contract
// *
// * @param contractId Contract reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getActiveMilestone(String contractId) throws JSONException {
// return oClient.get("/hr/v3/fp/milestones/statuses/active/contracts/" + contractId);
// }
//
// /**
// * Get all submissions for the active Milestone
// *
// * @param milestoneId Milestone ID
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSubmissions(String milestoneId) throws JSONException {
// return oClient.get("/hr/v3/fp/milestones/" + milestoneId + "/submissions");
// }
//
// /**
// * Create a new Milestone
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject create(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v3/fp/milestones", params);
// }
//
// /**
// * Edit an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject edit(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId, params);
// }
//
// /**
// * Activate an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject activate(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/activate", params);
// }
//
// /**
// * Approve an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject approve(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/approve", params);
// }
//
// /**
// * Delete an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject delete(String milestoneId) throws JSONException {
// return oClient.delete("/hr/v3/fp/milestones/" + milestoneId);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/MilestonesTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Milestones;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Milestones.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/MilestonesTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Milestones.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "11/17/2014",
// currentRevision = 1,
// lastModified = "11/17/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Milestones {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Milestones(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get active Milestone for the Contract
// *
// * @param contractId Contract reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getActiveMilestone(String contractId) throws JSONException {
// return oClient.get("/hr/v3/fp/milestones/statuses/active/contracts/" + contractId);
// }
//
// /**
// * Get all submissions for the active Milestone
// *
// * @param milestoneId Milestone ID
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSubmissions(String milestoneId) throws JSONException {
// return oClient.get("/hr/v3/fp/milestones/" + milestoneId + "/submissions");
// }
//
// /**
// * Create a new Milestone
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject create(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v3/fp/milestones", params);
// }
//
// /**
// * Edit an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject edit(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId, params);
// }
//
// /**
// * Activate an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject activate(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/activate", params);
// }
//
// /**
// * Approve an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject approve(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/approve", params);
// }
//
// /**
// * Delete an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject delete(String milestoneId) throws JSONException {
// return oClient.delete("/hr/v3/fp/milestones/" + milestoneId);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Milestones; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Milestones.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Milestones.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "11/17/2014",
// currentRevision = 1,
// lastModified = "11/17/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Milestones {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Milestones(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get active Milestone for the Contract
// *
// * @param contractId Contract reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getActiveMilestone(String contractId) throws JSONException {
// return oClient.get("/hr/v3/fp/milestones/statuses/active/contracts/" + contractId);
// }
//
// /**
// * Get all submissions for the active Milestone
// *
// * @param milestoneId Milestone ID
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSubmissions(String milestoneId) throws JSONException {
// return oClient.get("/hr/v3/fp/milestones/" + milestoneId + "/submissions");
// }
//
// /**
// * Create a new Milestone
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject create(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v3/fp/milestones", params);
// }
//
// /**
// * Edit an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject edit(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId, params);
// }
//
// /**
// * Activate an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject activate(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/activate", params);
// }
//
// /**
// * Approve an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject approve(String milestoneId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/milestones/" + milestoneId + "/approve", params);
// }
//
// /**
// * Delete an existing Milestone
// *
// * @param milestoneId Milestone ID
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject delete(String milestoneId) throws JSONException {
// return oClient.delete("/hr/v3/fp/milestones/" + milestoneId);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/MilestonesTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Milestones;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Milestones.class
}) | public class MilestonesTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Freelancers/ProfileTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Freelancers/Profile.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Profile {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Profile(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get specific Freelancer's Profile
// *
// * @param key Profile key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String key) throws JSONException {
// return oClient.get("/profiles/v1/providers/" + key);
// }
//
// /**
// * Get brief info for the specific Freelancer's Profile
// *
// * @param key Profile key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecificBrief(String key) throws JSONException {
// return oClient.get("/profiles/v1/providers/" + key + "/brief");
// }
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Freelancers.Profile; | package com.Upwork.api.Routers.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Freelancers/Profile.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Profile {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Profile(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get specific Freelancer's Profile
// *
// * @param key Profile key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String key) throws JSONException {
// return oClient.get("/profiles/v1/providers/" + key);
// }
//
// /**
// * Get brief info for the specific Freelancer's Profile
// *
// * @param key Profile key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecificBrief(String key) throws JSONException {
// return oClient.get("/profiles/v1/providers/" + key + "/brief");
// }
// }
// Path: test/com/Upwork/api/Routers/Freelancers/ProfileTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Freelancers.Profile;
package com.Upwork.api.Routers.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Profile.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Freelancers/ProfileTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Freelancers/Profile.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Profile {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Profile(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get specific Freelancer's Profile
// *
// * @param key Profile key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String key) throws JSONException {
// return oClient.get("/profiles/v1/providers/" + key);
// }
//
// /**
// * Get brief info for the specific Freelancer's Profile
// *
// * @param key Profile key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecificBrief(String key) throws JSONException {
// return oClient.get("/profiles/v1/providers/" + key + "/brief");
// }
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Freelancers.Profile; | package com.Upwork.api.Routers.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Profile.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Freelancers/Profile.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Profile {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Profile(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get specific Freelancer's Profile
// *
// * @param key Profile key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String key) throws JSONException {
// return oClient.get("/profiles/v1/providers/" + key);
// }
//
// /**
// * Get brief info for the specific Freelancer's Profile
// *
// * @param key Profile key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecificBrief(String key) throws JSONException {
// return oClient.get("/profiles/v1/providers/" + key + "/brief");
// }
// }
// Path: test/com/Upwork/api/Routers/Freelancers/ProfileTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Freelancers.Profile;
package com.Upwork.api.Routers.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Profile.class
}) | public class ProfileTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/Freelancers/ApplicationsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Freelancers/Applications.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "2/15/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Applications {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Applications(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/contractors/applications", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Application reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference) throws JSONException {
// return oClient.get("/hr/v4/contractors/applications/" + reference);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Freelancers.Applications; | package com.Upwork.api.Routers.Hr.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Freelancers/Applications.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "2/15/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Applications {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Applications(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/contractors/applications", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Application reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference) throws JSONException {
// return oClient.get("/hr/v4/contractors/applications/" + reference);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/Freelancers/ApplicationsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Freelancers.Applications;
package com.Upwork.api.Routers.Hr.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Applications.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/Freelancers/ApplicationsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Freelancers/Applications.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "2/15/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Applications {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Applications(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/contractors/applications", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Application reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference) throws JSONException {
// return oClient.get("/hr/v4/contractors/applications/" + reference);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Freelancers.Applications; | package com.Upwork.api.Routers.Hr.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Applications.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Freelancers/Applications.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "2/15/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Applications {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Applications(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/contractors/applications", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Application reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference) throws JSONException {
// return oClient.get("/hr/v4/contractors/applications/" + reference);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/Freelancers/ApplicationsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Freelancers.Applications;
package com.Upwork.api.Routers.Hr.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Applications.class
}) | public class ApplicationsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Reports/TimeTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Time.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Time {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Time(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Time Reports for a Specific Team/Comapny/Agency
// *
// * @param company Company ID
// * @param team (Optional) Team ID
// * @param agency (Optional) Agency ID
// * @param params (Optional) Parameters
// * @param hideFinDetails (Optional) Hides all financial details
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// private JSONObject _getByType(String company, String team, String agency, HashMap<String, String> params, Boolean hideFinDetails) throws JSONException {
// String url = "";
// if (team != null) {
// url = "/teams/" + team;
// if (hideFinDetails) {
// url = url + "/hours";
// }
// } else if (agency != null) {
// url = "/agencies/" + agency;
// }
//
// return oClient.get("/timereports/v1/companies/" + company + url, params);
// }
//
// /**
// * Generate Time Reports for a Specific Team (with financial info)
// *
// * @param company Company ID
// * @param team Team ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByTeamFull(String company, String team, HashMap<String, String> params) throws JSONException {
// return _getByType(company, team, null, params, false);
// }
//
// /**
// * Generate Time Reports for a Specific Team (hide financial info)
// *
// * @param company Company ID
// * @param team Team ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByTeamLimited(String company, String team, HashMap<String, String> params) throws JSONException {
// return _getByType(company, team, null, params, true);
// }
//
// /**
// * Generating Agency Specific Reports
// *
// * @param company Company ID
// * @param agency Agency ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByAgency(String company, String agency, HashMap<String, String> params) throws JSONException {
// return _getByType(company, null, agency, params, false);
// }
//
// /**
// * Generating Company Wide Reports
// *
// * @param company Company ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByCompany(String company, HashMap<String, String> params) throws JSONException {
// return _getByType(company, null, null, params, false);
// }
//
// /**
// * Generating Freelancer's Specific Reports (hide financial info)
// *
// * @param freelancerId Freelancer's ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancerLimited(String freelancerId, HashMap<String, String> params) throws JSONException {
// return oClient.get("/timereports/v1/providers/" + freelancerId + "/hours", params);
// }
//
// /**
// * Generating Freelancer's Specific Reports (with financial info)
// *
// * @param freelancerId Freelancer's ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancerFull(String freelancerId, HashMap<String, String> params) throws JSONException {
// return oClient.get("/timereports/v1/providers/" + freelancerId, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Time; | package com.Upwork.api.Routers.Reports;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Time.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Time {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Time(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Time Reports for a Specific Team/Comapny/Agency
// *
// * @param company Company ID
// * @param team (Optional) Team ID
// * @param agency (Optional) Agency ID
// * @param params (Optional) Parameters
// * @param hideFinDetails (Optional) Hides all financial details
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// private JSONObject _getByType(String company, String team, String agency, HashMap<String, String> params, Boolean hideFinDetails) throws JSONException {
// String url = "";
// if (team != null) {
// url = "/teams/" + team;
// if (hideFinDetails) {
// url = url + "/hours";
// }
// } else if (agency != null) {
// url = "/agencies/" + agency;
// }
//
// return oClient.get("/timereports/v1/companies/" + company + url, params);
// }
//
// /**
// * Generate Time Reports for a Specific Team (with financial info)
// *
// * @param company Company ID
// * @param team Team ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByTeamFull(String company, String team, HashMap<String, String> params) throws JSONException {
// return _getByType(company, team, null, params, false);
// }
//
// /**
// * Generate Time Reports for a Specific Team (hide financial info)
// *
// * @param company Company ID
// * @param team Team ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByTeamLimited(String company, String team, HashMap<String, String> params) throws JSONException {
// return _getByType(company, team, null, params, true);
// }
//
// /**
// * Generating Agency Specific Reports
// *
// * @param company Company ID
// * @param agency Agency ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByAgency(String company, String agency, HashMap<String, String> params) throws JSONException {
// return _getByType(company, null, agency, params, false);
// }
//
// /**
// * Generating Company Wide Reports
// *
// * @param company Company ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByCompany(String company, HashMap<String, String> params) throws JSONException {
// return _getByType(company, null, null, params, false);
// }
//
// /**
// * Generating Freelancer's Specific Reports (hide financial info)
// *
// * @param freelancerId Freelancer's ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancerLimited(String freelancerId, HashMap<String, String> params) throws JSONException {
// return oClient.get("/timereports/v1/providers/" + freelancerId + "/hours", params);
// }
//
// /**
// * Generating Freelancer's Specific Reports (with financial info)
// *
// * @param freelancerId Freelancer's ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancerFull(String freelancerId, HashMap<String, String> params) throws JSONException {
// return oClient.get("/timereports/v1/providers/" + freelancerId, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Reports/TimeTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Time;
package com.Upwork.api.Routers.Reports;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Time.class |
upwork/java-upwork | test/com/Upwork/api/Routers/PaymentsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Payments.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Payments {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Payments(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Submit a Custom Payment
// *
// * @param teamReference Team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Payments; | package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Payments.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Payments {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Payments(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Submit a Custom Payment
// *
// * @param teamReference Team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/PaymentsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Payments;
package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Payments.class |
upwork/java-upwork | test/com/Upwork/api/Routers/PaymentsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Payments.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Payments {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Payments(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Submit a Custom Payment
// *
// * @param teamReference Team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Payments; | package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Payments.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Payments.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Payments {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Payments(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Submit a Custom Payment
// *
// * @param teamReference Team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject submitBonus(String teamReference, HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v2/teams/" + teamReference + "/adjustments", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/PaymentsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Payments;
package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Payments.class
}) | public class PaymentsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/WorkdaysTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Workdays.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "14/7/2015",
// currentRevision = 1,
// lastModified = "24/5/2018",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Workdays {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Workdays(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Workdays by Company
// *
// * @param company Company ID
// * @param fromDate Start date
// * @param tillDate End date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
// }
//
// /**
// * Get Workdays by Contract
// *
// * @param contract Contract ID
// * @param fromDate Start date
// * @param tillDate End date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByContract(String contract, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Workdays; | package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Workdiary.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Workdays.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "14/7/2015",
// currentRevision = 1,
// lastModified = "24/5/2018",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Workdays {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Workdays(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Workdays by Company
// *
// * @param company Company ID
// * @param fromDate Start date
// * @param tillDate End date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
// }
//
// /**
// * Get Workdays by Contract
// *
// * @param contract Contract ID
// * @param fromDate Start date
// * @param tillDate End date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByContract(String contract, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/WorkdaysTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Workdays;
package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Workdiary.class
}) | public class WorkdaysTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/WorkdaysTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Workdays.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "14/7/2015",
// currentRevision = 1,
// lastModified = "24/5/2018",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Workdays {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Workdays(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Workdays by Company
// *
// * @param company Company ID
// * @param fromDate Start date
// * @param tillDate End date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
// }
//
// /**
// * Get Workdays by Contract
// *
// * @param contract Contract ID
// * @param fromDate Start date
// * @param tillDate End date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByContract(String contract, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Workdays; | package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Workdiary.class
})
public class WorkdaysTest extends Helper {
@Test public void getByCompany() throws Exception { | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Workdays.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "14/7/2015",
// currentRevision = 1,
// lastModified = "24/5/2018",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Workdays {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Workdays(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Workdays by Company
// *
// * @param company Company ID
// * @param fromDate Start date
// * @param tillDate End date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
// }
//
// /**
// * Get Workdays by Contract
// *
// * @param contract Contract ID
// * @param fromDate Start date
// * @param tillDate End date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByContract(String contract, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/WorkdaysTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Workdays;
package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Workdiary.class
})
public class WorkdaysTest extends Helper {
@Test public void getByCompany() throws Exception { | Workdays workdays = new Workdays(client); |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/SubmissionsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Submissions.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "11/17/2014",
// currentRevision = 1,
// lastModified = "11/17/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Submissions {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Submissions(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Freelancer submits work for the client to approve
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject requestApproval(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v3/fp/submissions", params);
// }
//
// /**
// * Approve an existing Submission
// *
// * @param submissionId Submission ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject approve(String submissionId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/approve", params);
// }
//
// /**
// * Reject an existing Submission
// *
// * @param submissionId Submission ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject reject(String submissionId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/reject", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Submissions; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Submissions.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "11/17/2014",
// currentRevision = 1,
// lastModified = "11/17/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Submissions {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Submissions(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Freelancer submits work for the client to approve
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject requestApproval(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v3/fp/submissions", params);
// }
//
// /**
// * Approve an existing Submission
// *
// * @param submissionId Submission ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject approve(String submissionId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/approve", params);
// }
//
// /**
// * Reject an existing Submission
// *
// * @param submissionId Submission ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject reject(String submissionId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/reject", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/SubmissionsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Submissions;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Submissions.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/SubmissionsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Submissions.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "11/17/2014",
// currentRevision = 1,
// lastModified = "11/17/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Submissions {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Submissions(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Freelancer submits work for the client to approve
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject requestApproval(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v3/fp/submissions", params);
// }
//
// /**
// * Approve an existing Submission
// *
// * @param submissionId Submission ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject approve(String submissionId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/approve", params);
// }
//
// /**
// * Reject an existing Submission
// *
// * @param submissionId Submission ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject reject(String submissionId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/reject", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Submissions; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Submissions.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Submissions.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "11/17/2014",
// currentRevision = 1,
// lastModified = "11/17/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Submissions {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Submissions(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Freelancer submits work for the client to approve
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject requestApproval(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v3/fp/submissions", params);
// }
//
// /**
// * Approve an existing Submission
// *
// * @param submissionId Submission ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject approve(String submissionId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/approve", params);
// }
//
// /**
// * Reject an existing Submission
// *
// * @param submissionId Submission ID
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject reject(String submissionId, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v3/fp/submissions/" + submissionId + "/reject", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/SubmissionsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Submissions;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Submissions.class
}) | public class SubmissionsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/ConfigTest.java | // Path: src/com/Upwork/api/Config.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "5/30/2014",
// currentRevision = 1,
// lastModified = "6/3/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public class Config {
// private final Properties properties;
//
// public Config(Properties properties) {
// if (properties == null) {
// this.properties = new Properties();
// }
// else {
// this.properties = properties;
// return;
// }
//
// InputStream input = null;
//
// try {
// input = new FileInputStream("upwork.properties");
// this.properties.load(input);
// } catch (IOException ex) {
// ex.printStackTrace();
// } finally {
// if (input != null) {
// try {
// input.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// /**
// * Get property by name
// * @param key Parameter name
// * */
// public String getProperty(String key) {
// return this.properties.getProperty(key);
// }
// }
| import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Spy;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.*;
import static org.mockito.Mockito.*;
import java.io.FileInputStream;
import java.util.Properties;
import com.Upwork.api.Config; | package com.Upwork.api;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: src/com/Upwork/api/Config.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "5/30/2014",
// currentRevision = 1,
// lastModified = "6/3/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public class Config {
// private final Properties properties;
//
// public Config(Properties properties) {
// if (properties == null) {
// this.properties = new Properties();
// }
// else {
// this.properties = properties;
// return;
// }
//
// InputStream input = null;
//
// try {
// input = new FileInputStream("upwork.properties");
// this.properties.load(input);
// } catch (IOException ex) {
// ex.printStackTrace();
// } finally {
// if (input != null) {
// try {
// input.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// /**
// * Get property by name
// * @param key Parameter name
// * */
// public String getProperty(String key) {
// return this.properties.getProperty(key);
// }
// }
// Path: test/com/Upwork/api/ConfigTest.java
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Spy;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.*;
import static org.mockito.Mockito.*;
import java.io.FileInputStream;
import java.util.Properties;
import com.Upwork.api.Config;
package com.Upwork.api;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Config.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Reports/Finance/BillingsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Billings.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Billings {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Billings(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancer(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/providers/" + freelancerReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer's Team
// *
// * @param freelancerTeamReference Freelancer's team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer's Company
// *
// * @param freelancerCompanyReference Freelancer's company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Buyer's Team
// *
// * @param buyerTeamReference Buyer team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Buyer's Company
// *
// * @param buyerCompanyReference Buyer company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Billings; | package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Billings.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Billings {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Billings(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancer(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/providers/" + freelancerReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer's Team
// *
// * @param freelancerTeamReference Freelancer's team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer's Company
// *
// * @param freelancerCompanyReference Freelancer's company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Buyer's Team
// *
// * @param buyerTeamReference Buyer team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Buyer's Company
// *
// * @param buyerCompanyReference Buyer company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Reports/Finance/BillingsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Billings;
package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Billings.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Reports/Finance/BillingsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Billings.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Billings {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Billings(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancer(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/providers/" + freelancerReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer's Team
// *
// * @param freelancerTeamReference Freelancer's team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer's Company
// *
// * @param freelancerCompanyReference Freelancer's company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Buyer's Team
// *
// * @param buyerTeamReference Buyer team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Buyer's Company
// *
// * @param buyerCompanyReference Buyer company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Billings; | package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Billings.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Billings.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Billings {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Billings(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancer(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/providers/" + freelancerReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer's Team
// *
// * @param freelancerTeamReference Freelancer's team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersTeam(String freelancerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_teams/" + freelancerTeamReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Freelancer's Company
// *
// * @param freelancerCompanyReference Freelancer's company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Buyer's Team
// *
// * @param buyerTeamReference Buyer team reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params);
// }
//
// /**
// * Generate Billing Reports for a Specific Buyer's Company
// *
// * @param buyerCompanyReference Buyer company reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByBuyersCompany(String buyerCompanyReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/buyer_companies/" + buyerCompanyReference + "/billings", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Reports/Finance/BillingsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Billings;
package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Billings.class
}) | public class BillingsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Organization/TeamsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Teams.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Teams {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Teams(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Teams info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList() throws JSONException {
// return oClient.get("/hr/v2/teams");
// }
//
// /**
// * Get Users in Team
// *
// * @param teamReference Team reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getUsersInTeam(String teamReference) throws JSONException {
// return oClient.get("/hr/v2/teams/" + teamReference + "/users");
// }
//
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Teams; | package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Teams.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Teams {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Teams(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Teams info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList() throws JSONException {
// return oClient.get("/hr/v2/teams");
// }
//
// /**
// * Get Users in Team
// *
// * @param teamReference Team reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getUsersInTeam(String teamReference) throws JSONException {
// return oClient.get("/hr/v2/teams/" + teamReference + "/users");
// }
//
// }
// Path: test/com/Upwork/api/Routers/Organization/TeamsTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Teams;
package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Teams.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Organization/TeamsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Teams.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Teams {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Teams(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Teams info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList() throws JSONException {
// return oClient.get("/hr/v2/teams");
// }
//
// /**
// * Get Users in Team
// *
// * @param teamReference Team reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getUsersInTeam(String teamReference) throws JSONException {
// return oClient.get("/hr/v2/teams/" + teamReference + "/users");
// }
//
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Teams; | package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Teams.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Teams.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Teams {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Teams(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Teams info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList() throws JSONException {
// return oClient.get("/hr/v2/teams");
// }
//
// /**
// * Get Users in Team
// *
// * @param teamReference Team reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getUsersInTeam(String teamReference) throws JSONException {
// return oClient.get("/hr/v2/teams/" + teamReference + "/users");
// }
//
// }
// Path: test/com/Upwork/api/Routers/Organization/TeamsTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Teams;
package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Teams.class
}) | public class TeamsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/RolesTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Roles.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Roles {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Roles(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get user roles
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getAll() throws JSONException {
// return oClient.get("/hr/v2/userroles");
// }
//
// /**
// * Get by specific user
// *
// * @param reference User reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getBySpecificUser(String reference) throws JSONException {
// return oClient.get("/hr/v2/userroles/" + reference);
// }
//
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Roles; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Roles.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Roles {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Roles(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get user roles
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getAll() throws JSONException {
// return oClient.get("/hr/v2/userroles");
// }
//
// /**
// * Get by specific user
// *
// * @param reference User reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getBySpecificUser(String reference) throws JSONException {
// return oClient.get("/hr/v2/userroles/" + reference);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/RolesTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Roles;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Roles.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/RolesTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Roles.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Roles {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Roles(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get user roles
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getAll() throws JSONException {
// return oClient.get("/hr/v2/userroles");
// }
//
// /**
// * Get by specific user
// *
// * @param reference User reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getBySpecificUser(String reference) throws JSONException {
// return oClient.get("/hr/v2/userroles/" + reference);
// }
//
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Roles; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Roles.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Roles.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Roles {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Roles(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get user roles
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getAll() throws JSONException {
// return oClient.get("/hr/v2/userroles");
// }
//
// /**
// * Get by specific user
// *
// * @param reference User reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getBySpecificUser(String reference) throws JSONException {
// return oClient.get("/hr/v2/userroles/" + reference);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/RolesTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Roles;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Roles.class
}) | public class RolesTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/JobsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Jobs.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Jobs {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Jobs(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of jobs
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v2/jobs", params);
// }
//
// /**
// * Get specific job by key
// *
// * @param key Job key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String key) throws JSONException {
// return oClient.get("/hr/v2/jobs/" + key);
// }
//
// /**
// * Post a new job
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject postJob(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v2/jobs", params);
// }
//
// /**
// * Edit existent job
// *
// * @param key Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject editJob(String key, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/jobs/" + key, params);
// }
//
// /**
// * Delete existent job
// *
// * @param key Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject deleteJob(String key, HashMap<String, String> params) throws JSONException {
// return oClient.delete("/hr/v2/jobs/" + key, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Jobs; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Jobs.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Jobs {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Jobs(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of jobs
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v2/jobs", params);
// }
//
// /**
// * Get specific job by key
// *
// * @param key Job key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String key) throws JSONException {
// return oClient.get("/hr/v2/jobs/" + key);
// }
//
// /**
// * Post a new job
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject postJob(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v2/jobs", params);
// }
//
// /**
// * Edit existent job
// *
// * @param key Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject editJob(String key, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/jobs/" + key, params);
// }
//
// /**
// * Delete existent job
// *
// * @param key Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject deleteJob(String key, HashMap<String, String> params) throws JSONException {
// return oClient.delete("/hr/v2/jobs/" + key, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/JobsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Jobs;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Jobs.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/JobsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Jobs.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Jobs {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Jobs(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of jobs
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v2/jobs", params);
// }
//
// /**
// * Get specific job by key
// *
// * @param key Job key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String key) throws JSONException {
// return oClient.get("/hr/v2/jobs/" + key);
// }
//
// /**
// * Post a new job
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject postJob(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v2/jobs", params);
// }
//
// /**
// * Edit existent job
// *
// * @param key Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject editJob(String key, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/jobs/" + key, params);
// }
//
// /**
// * Delete existent job
// *
// * @param key Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject deleteJob(String key, HashMap<String, String> params) throws JSONException {
// return oClient.delete("/hr/v2/jobs/" + key, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Jobs; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Jobs.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Jobs.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Jobs {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Jobs(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of jobs
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v2/jobs", params);
// }
//
// /**
// * Get specific job by key
// *
// * @param key Job key
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String key) throws JSONException {
// return oClient.get("/hr/v2/jobs/" + key);
// }
//
// /**
// * Post a new job
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject postJob(HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v2/jobs", params);
// }
//
// /**
// * Edit existent job
// *
// * @param key Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject editJob(String key, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/jobs/" + key, params);
// }
//
// /**
// * Delete existent job
// *
// * @param key Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject deleteJob(String key, HashMap<String, String> params) throws JSONException {
// return oClient.delete("/hr/v2/jobs/" + key, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/JobsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Jobs;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Jobs.class
}) | public class JobsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/ContractsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Contracts.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "19/9/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Contracts {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Contracts(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Suspend Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject suspendContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/contracts/" + reference + "/suspend", params);
// }
//
// /**
// * Restart Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject restartContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/contracts/" + reference + "/restart", params);
// }
//
// /**
// * End Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject endContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.delete("/hr/v2/contracts/" + reference, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Contracts; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Contracts.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "19/9/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Contracts {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Contracts(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Suspend Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject suspendContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/contracts/" + reference + "/suspend", params);
// }
//
// /**
// * Restart Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject restartContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/contracts/" + reference + "/restart", params);
// }
//
// /**
// * End Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject endContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.delete("/hr/v2/contracts/" + reference, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/ContractsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Contracts;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Contracts.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/ContractsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Contracts.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "19/9/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Contracts {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Contracts(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Suspend Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject suspendContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/contracts/" + reference + "/suspend", params);
// }
//
// /**
// * Restart Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject restartContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/contracts/" + reference + "/restart", params);
// }
//
// /**
// * End Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject endContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.delete("/hr/v2/contracts/" + reference, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Contracts; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Contracts.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Contracts.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "19/9/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Contracts {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Contracts(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Suspend Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject suspendContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/contracts/" + reference + "/suspend", params);
// }
//
// /**
// * Restart Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject restartContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.put("/hr/v2/contracts/" + reference + "/restart", params);
// }
//
// /**
// * End Contract
// *
// * @param reference Contract reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject endContract(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.delete("/hr/v2/contracts/" + reference, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/ContractsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Contracts;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Contracts.class
}) | public class ContractsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/WorkdiaryTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Workdiary.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/3/2014",
// currentRevision = 1,
// lastModified = "24/5/2018",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Workdiary {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Workdiary(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Workdiary
// *
// * @param company Company ID
// * @param date Date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject get(String company, String date, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdiaries/companies/" + company + "/" + date, params);
// }
//
// /**
// * Get Work Diary by Contract
// *
// * @param contract Contract ID
// * @param date Date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByContract(String contract, String date, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdiaries/contracts/" + contract + "/" + date, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Workdiary; | package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Workdiary.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/3/2014",
// currentRevision = 1,
// lastModified = "24/5/2018",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Workdiary {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Workdiary(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Workdiary
// *
// * @param company Company ID
// * @param date Date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject get(String company, String date, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdiaries/companies/" + company + "/" + date, params);
// }
//
// /**
// * Get Work Diary by Contract
// *
// * @param contract Contract ID
// * @param date Date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByContract(String contract, String date, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdiaries/contracts/" + contract + "/" + date, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/WorkdiaryTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Workdiary;
package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Workdiary.class |
upwork/java-upwork | test/com/Upwork/api/Routers/WorkdiaryTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Workdiary.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/3/2014",
// currentRevision = 1,
// lastModified = "24/5/2018",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Workdiary {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Workdiary(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Workdiary
// *
// * @param company Company ID
// * @param date Date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject get(String company, String date, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdiaries/companies/" + company + "/" + date, params);
// }
//
// /**
// * Get Work Diary by Contract
// *
// * @param contract Contract ID
// * @param date Date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByContract(String contract, String date, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdiaries/contracts/" + contract + "/" + date, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Workdiary; | package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Workdiary.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Workdiary.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/3/2014",
// currentRevision = 1,
// lastModified = "24/5/2018",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Workdiary {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Workdiary(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Workdiary
// *
// * @param company Company ID
// * @param date Date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject get(String company, String date, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdiaries/companies/" + company + "/" + date, params);
// }
//
// /**
// * Get Work Diary by Contract
// *
// * @param contract Contract ID
// * @param date Date
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getByContract(String contract, String date, HashMap<String, String> params) throws JSONException {
// return oClient.get("/team/v3/workdiaries/contracts/" + contract + "/" + date, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/WorkdiaryTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Workdiary;
package com.Upwork.api.Routers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Workdiary.class
}) | public class WorkdiaryTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/InterviewsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Interviews.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Interviews {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Interviews(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Invite to Interview
// *
// * @param jobKey Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject invite(String jobKey, HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v1/jobs/" + jobKey + "/candidates", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Interviews; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Interviews.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Interviews {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Interviews(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Invite to Interview
// *
// * @param jobKey Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject invite(String jobKey, HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v1/jobs/" + jobKey + "/candidates", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/InterviewsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Interviews;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Interviews.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/InterviewsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Interviews.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Interviews {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Interviews(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Invite to Interview
// *
// * @param jobKey Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject invite(String jobKey, HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v1/jobs/" + jobKey + "/candidates", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Interviews; | package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Interviews.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Interviews.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Interviews {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Interviews(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Invite to Interview
// *
// * @param jobKey Job key
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject invite(String jobKey, HashMap<String, String> params) throws JSONException {
// return oClient.post("/hr/v1/jobs/" + jobKey + "/candidates", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/InterviewsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Interviews;
package com.Upwork.api.Routers.Hr;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Interviews.class
}) | public class InterviewsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/Freelancers/OffersTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Offers {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Offers(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/contractors/offers", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Offer reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference) throws JSONException {
// return oClient.get("/offers/v1/contractors/offers/" + reference);
// }
//
// /**
// * Run a specific action
// *
// * @param reference Offer reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.post("/offers/v1/contractors/offers/" + reference, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Freelancers.Offers; | package com.Upwork.api.Routers.Hr.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Offers {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Offers(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/contractors/offers", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Offer reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference) throws JSONException {
// return oClient.get("/offers/v1/contractors/offers/" + reference);
// }
//
// /**
// * Run a specific action
// *
// * @param reference Offer reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.post("/offers/v1/contractors/offers/" + reference, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/Freelancers/OffersTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Freelancers.Offers;
package com.Upwork.api.Routers.Hr.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Offers.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/Freelancers/OffersTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Offers {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Offers(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/contractors/offers", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Offer reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference) throws JSONException {
// return oClient.get("/offers/v1/contractors/offers/" + reference);
// }
//
// /**
// * Run a specific action
// *
// * @param reference Offer reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.post("/offers/v1/contractors/offers/" + reference, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Freelancers.Offers; | package com.Upwork.api.Routers.Hr.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Offers.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Offers {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Offers(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/contractors/offers", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Offer reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference) throws JSONException {
// return oClient.get("/offers/v1/contractors/offers/" + reference);
// }
//
// /**
// * Run a specific action
// *
// * @param reference Offer reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.post("/offers/v1/contractors/offers/" + reference, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/Freelancers/OffersTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Freelancers.Offers;
package com.Upwork.api.Routers.Hr.Freelancers;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Offers.class
}) | public class OffersTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Reports/Finance/AccountsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Accounts.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Accounts {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Accounts(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Financial Reports for an owned Account
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getOwned(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/financial_account_owner/" + freelancerReference, params);
// }
//
// /**
// * Generate Financial Reports for a Specific Account
// *
// * @param entityReference Entity reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String entityReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/financial_accounts/" + entityReference, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Accounts; | package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Accounts.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Accounts {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Accounts(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Financial Reports for an owned Account
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getOwned(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/financial_account_owner/" + freelancerReference, params);
// }
//
// /**
// * Generate Financial Reports for a Specific Account
// *
// * @param entityReference Entity reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String entityReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/financial_accounts/" + entityReference, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Reports/Finance/AccountsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Accounts;
package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Accounts.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Reports/Finance/AccountsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Accounts.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Accounts {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Accounts(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Financial Reports for an owned Account
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getOwned(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/financial_account_owner/" + freelancerReference, params);
// }
//
// /**
// * Generate Financial Reports for a Specific Account
// *
// * @param entityReference Entity reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String entityReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/financial_accounts/" + entityReference, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Accounts; | package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Accounts.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Reports/Finance/Accounts.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Accounts {
//
// final static String ENTRY_POINT = "gds";
//
// private OAuthClient oClient = null;
//
// public Accounts(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Generate Financial Reports for an owned Account
// *
// * @param freelancerReference Freelancer's reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getOwned(String freelancerReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/financial_account_owner/" + freelancerReference, params);
// }
//
// /**
// * Generate Financial Reports for a Specific Account
// *
// * @param entityReference Entity reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String entityReference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/finreports/v2/financial_accounts/" + entityReference, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Reports/Finance/AccountsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Reports.Finance.Accounts;
package com.Upwork.api.Routers.Reports.Finance;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Accounts.class
}) | public class AccountsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/Clients/ApplicationsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Clients/Applications.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "2/15/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Applications {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Applications(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @return object
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/clients/applications", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Application reference
// * @param params Parameters
// * @return object
// */
// public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/clients/applications/" + reference, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Clients.Applications; | package com.Upwork.api.Routers.Hr.Clients;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Clients/Applications.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "2/15/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Applications {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Applications(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @return object
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/clients/applications", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Application reference
// * @param params Parameters
// * @return object
// */
// public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/clients/applications/" + reference, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/Clients/ApplicationsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Clients.Applications;
package com.Upwork.api.Routers.Hr.Clients;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Applications.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/Clients/ApplicationsTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Clients/Applications.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "2/15/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Applications {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Applications(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @return object
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/clients/applications", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Application reference
// * @param params Parameters
// * @return object
// */
// public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/clients/applications/" + reference, params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Clients.Applications; | package com.Upwork.api.Routers.Hr.Clients;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Applications.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Clients/Applications.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "2/15/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Applications {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Applications(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of applications
// *
// * @param params Parameters
// * @return object
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/clients/applications", params);
// }
//
// /**
// * Get specific application
// *
// * @param reference Application reference
// * @param params Parameters
// * @return object
// */
// public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/hr/v4/clients/applications/" + reference, params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/Clients/ApplicationsTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Clients.Applications;
package com.Upwork.api.Routers.Hr.Clients;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Applications.class
}) | public class ApplicationsTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/Clients/OffersTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Clients/Offers.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Offers {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Offers(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of offers
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/clients/offers", params);
// }
//
// /**
// * Get specific offer
// *
// * @param reference Offer reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/clients/offers/" + reference, params);
// }
//
// /**
// * Send offer
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject makeOffer(HashMap<String, String> params) throws JSONException {
// return oClient.post("/offers/v1/clients/offers", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Clients.Offers; | package com.Upwork.api.Routers.Hr.Clients;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Clients/Offers.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Offers {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Offers(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of offers
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/clients/offers", params);
// }
//
// /**
// * Get specific offer
// *
// * @param reference Offer reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/clients/offers/" + reference, params);
// }
//
// /**
// * Send offer
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject makeOffer(HashMap<String, String> params) throws JSONException {
// return oClient.post("/offers/v1/clients/offers", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/Clients/OffersTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Clients.Offers;
package com.Upwork.api.Routers.Hr.Clients;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Offers.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Hr/Clients/OffersTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Clients/Offers.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Offers {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Offers(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of offers
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/clients/offers", params);
// }
//
// /**
// * Get specific offer
// *
// * @param reference Offer reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/clients/offers/" + reference, params);
// }
//
// /**
// * Send offer
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject makeOffer(HashMap<String, String> params) throws JSONException {
// return oClient.post("/offers/v1/clients/offers", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Clients.Offers; | package com.Upwork.api.Routers.Hr.Clients;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Offers.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Hr/Clients/Offers.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Offers {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Offers(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get list of offers
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList(HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/clients/offers", params);
// }
//
// /**
// * Get specific offer
// *
// * @param reference Offer reference
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
// return oClient.get("/offers/v1/clients/offers/" + reference, params);
// }
//
// /**
// * Send offer
// *
// * @param params Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject makeOffer(HashMap<String, String> params) throws JSONException {
// return oClient.post("/offers/v1/clients/offers", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Hr/Clients/OffersTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Hr.Clients.Offers;
package com.Upwork.api.Routers.Hr.Clients;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Offers.class
}) | public class OffersTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Organization/CompaniesTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Companies.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Companies {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Companies(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Companies Info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList() throws JSONException {
// return oClient.get("/hr/v2/companies");
// }
//
// /**
// * Get Specific Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference);
// }
//
// /**
// * Get Teams in Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getTeams(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference + "/teams");
// }
//
// /**
// * Get Users in Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getUsers(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference + "/users");
// }
//
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Companies; | package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Companies.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Companies {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Companies(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Companies Info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList() throws JSONException {
// return oClient.get("/hr/v2/companies");
// }
//
// /**
// * Get Specific Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference);
// }
//
// /**
// * Get Teams in Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getTeams(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference + "/teams");
// }
//
// /**
// * Get Users in Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getUsers(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference + "/users");
// }
//
// }
// Path: test/com/Upwork/api/Routers/Organization/CompaniesTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Companies;
package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Companies.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Organization/CompaniesTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Companies.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Companies {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Companies(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Companies Info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList() throws JSONException {
// return oClient.get("/hr/v2/companies");
// }
//
// /**
// * Get Specific Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference);
// }
//
// /**
// * Get Teams in Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getTeams(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference + "/teams");
// }
//
// /**
// * Get Users in Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getUsers(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference + "/users");
// }
//
// }
| import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Companies; | package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Companies.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Organization/Companies.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Companies {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Companies(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Get Companies Info
// *
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getList() throws JSONException {
// return oClient.get("/hr/v2/companies");
// }
//
// /**
// * Get Specific Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getSpecific(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference);
// }
//
// /**
// * Get Teams in Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getTeams(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference + "/teams");
// }
//
// /**
// * Get Users in Company
// *
// * @param cmpReference Company reference
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject getUsers(String cmpReference) throws JSONException {
// return oClient.get("/hr/v2/companies/" + cmpReference + "/users");
// }
//
// }
// Path: test/com/Upwork/api/Routers/Organization/CompaniesTest.java
import static org.junit.Assert.*;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Organization.Companies;
package com.Upwork.api.Routers.Organization;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Companies.class
}) | public class CompaniesTest extends Helper { |
upwork/java-upwork | test/com/Upwork/api/Routers/Jobs/SearchTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Jobs/Search.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Search {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Search(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Search jobs
// *
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject find(HashMap<String, String> params) throws JSONException {
// return oClient.get("/profiles/v2/search/jobs", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Jobs.Search; | package com.Upwork.api.Routers.Jobs;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Jobs/Search.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Search {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Search(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Search jobs
// *
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject find(HashMap<String, String> params) throws JSONException {
// return oClient.get("/profiles/v2/search/jobs", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Jobs/SearchTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Jobs.Search;
package com.Upwork.api.Routers.Jobs;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ | Search.class |
upwork/java-upwork | test/com/Upwork/api/Routers/Jobs/SearchTest.java | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Jobs/Search.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Search {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Search(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Search jobs
// *
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject find(HashMap<String, String> params) throws JSONException {
// return oClient.get("/profiles/v2/search/jobs", params);
// }
//
// }
| import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Jobs.Search; | package com.Upwork.api.Routers.Jobs;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Search.class
}) | // Path: test/com/Upwork/api/Routers/Helper.java
// @RunWith(PowerMockRunner.class)
// public class Helper {
// @Mock
// protected OAuthClient client;
//
// @Before
// public void setUp() throws JSONException {
// MockitoAnnotations.initMocks(this);
// when(client.get(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.get(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.post(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.put(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString())).thenReturn(new JSONObject("{'key': 'value'}"));
// when(client.delete(Matchers.anyString(), (HashMap<String, String>) Matchers.anyObject())).thenReturn(new JSONObject("{'key': 'value'}"));
// }
// }
//
// Path: src/com/Upwork/api/Routers/Jobs/Search.java
// @ClassPreamble (
// author = "Maksym Novozhylov <mnovozhilov@upwork.com>",
// date = "6/4/2014",
// currentRevision = 1,
// lastModified = "6/4/2014",
// lastModifiedBy = "Maksym Novozhylov",
// reviewers = {"Yiota Tsakiri"}
// )
// public final class Search {
//
// final static String ENTRY_POINT = "api";
//
// private OAuthClient oClient = null;
//
// public Search(OAuthClient client) {
// oClient = client;
// oClient.setEntryPoint(ENTRY_POINT);
// }
//
// /**
// * Search jobs
// *
// * @param params (Optional) Parameters
// * @throws JSONException If error occurred
// * @return {@link JSONObject}
// */
// public JSONObject find(HashMap<String, String> params) throws JSONException {
// return oClient.get("/profiles/v2/search/jobs", params);
// }
//
// }
// Path: test/com/Upwork/api/Routers/Jobs/SearchTest.java
import static org.junit.Assert.*;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.Upwork.api.Routers.Helper;
import com.Upwork.api.Routers.Jobs.Search;
package com.Upwork.api.Routers.Jobs;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Search.class
}) | public class SearchTest extends Helper { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.