From 671a506e85aa2c37462c9dc9a053c6e259ddae04 Mon Sep 17 00:00:00 2001 From: yuki Date: Tue, 5 May 2009 09:04:03 +0000 Subject: [PATCH] =?utf8?q?svn=E3=83=84=E3=83=AA=E3=83=BC=E3=81=AE=E5=86=8D?= =?utf8?q?=E6=A7=8B=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: http://192.168.11.7/svn/repository/NicoBrowser/trunk@105 bdf3b611-c98c-6041-8292-703d9c9adbe7 --- build.xml | 69 ++++ manifest.mf | 3 + master.jnlp | 21 + nbproject/build-impl.xml | 628 +++++++++++++++++++++++++++++ nbproject/configs/JWS_generated.properties | 4 + nbproject/genfiles.properties | 8 + nbproject/jnlp-impl.xml | 453 +++++++++++++++++++++ nbproject/project.properties | 82 ++++ nbproject/project.xml | 21 + src/nicobrowser/MainWindow.form | 299 ++++++++++++++ src/nicobrowser/MainWindow.java | 410 +++++++++++++++++++ src/nicobrowser/NicoContent.java | 61 +++ src/nicobrowser/NicoHttpClient.java | 345 ++++++++++++++++ src/nicobrowser/NicoTableModel.java | 91 +++++ test/nicobrowser/NicoHttpClientTest.java | 120 ++++++ 15 files changed, 2615 insertions(+) create mode 100644 build.xml create mode 100644 manifest.mf create mode 100644 master.jnlp create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/configs/JWS_generated.properties create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/jnlp-impl.xml create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/nicobrowser/MainWindow.form create mode 100644 src/nicobrowser/MainWindow.java create mode 100644 src/nicobrowser/NicoContent.java create mode 100644 src/nicobrowser/NicoHttpClient.java create mode 100644 src/nicobrowser/NicoTableModel.java create mode 100644 test/nicobrowser/NicoHttpClientTest.java diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..42b57c8 --- /dev/null +++ b/build.xml @@ -0,0 +1,69 @@ + + + + + + Builds, tests, and runs the project NicoBrowser. + + + diff --git a/manifest.mf b/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/master.jnlp b/master.jnlp new file mode 100644 index 0000000..4bd96d2 --- /dev/null +++ b/master.jnlp @@ -0,0 +1,21 @@ + + + + ${APPLICATION.TITLE} + ${APPLICATION.VENDOR} + ${APPLICATION.DESC} + ${APPLICATION.DESC.SHORT} + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..029ef38 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,628 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/configs/JWS_generated.properties b/nbproject/configs/JWS_generated.properties new file mode 100644 index 0000000..74df2c1 --- /dev/null +++ b/nbproject/configs/JWS_generated.properties @@ -0,0 +1,4 @@ +#Mon Jan 07 02:20:53 JST 2008 +$label=Web Start +$target.debug=jws-debug +$target.run=jws-run diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..0260410 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=c5fd47ab +build.xml.script.CRC32=c46c5d81 +build.xml.stylesheet.CRC32=be360661 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=c5fd47ab +nbproject/build-impl.xml.script.CRC32=9b6e51de +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08 diff --git a/nbproject/jnlp-impl.xml b/nbproject/jnlp-impl.xml new file mode 100644 index 0000000..df18b4f --- /dev/null +++ b/nbproject/jnlp-impl.xml @@ -0,0 +1,453 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $${APPLICATION.TITLE} + $${APPLICATION.VENDOR} + $${APPLICATION.DESC} + $${APPLICATION.DESC.SHORT} + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test page for launching the application via JNLP + + +

Test page for launching the application via JNLP

+ Launch the application + + +]]>
+
+ +
diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..bfc26b1 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,82 @@ +application.homepage=http://feather.cocolog-nifty.com/ +application.title=DEMO:\u30cb\u30b3\u30cb\u30b3\u52d5\u753b\u30b3\u30f3\u30c6\u30f3\u30c4\u60c5\u5831\u30d6\u30e9\u30a6\u30b6 +application.vendor=yukihane +build.classes.dir=${build.dir}/classes +build.classes.excludes= +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/NicoBrowser.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath=\ + ${libs.HttpClient3.classpath}:\ + ${libs.Log4J.classpath}:\ + ${libs.Codec.classpath}:\ + ${libs.Rome.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.source=1.5 +javac.target=1.6 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit_4.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jnlp.codebase.type=user +jnlp.codebase.user=http://feather.cocolog-nifty.com/weblog/program/NicoBrowser +jnlp.enabled=true +jnlp.offline-allowed=true +jnlp.signed=true +# Property libs.Codec.classpath is set here just to make sharing of project simpler. +# The library definition has always preference over this property. +libs.Codec.classpath=../../../java/commons/commons-codec-1.3/commons-codec-1.3.jar +# Property libs.HttpClient3.classpath is set here just to make sharing of project simpler. +# The library definition has always preference over this property. +libs.HttpClient3.classpath=../../../java/commons/commons-httpclient-3.1/commons-httpclient-3.1.jar +# Property libs.Log4J.classpath is set here just to make sharing of project simpler. +# The library definition has always preference over this property. +libs.Log4J.classpath=../../../java/commons/commons-logging-1.1/commons-logging-adapters-1.1.jar;../../../java/commons/commons-logging-1.1/commons-logging-api-1.1.jar +# Property libs.Rome.classpath is set here just to make sharing of project simpler. +# The library definition has always preference over this property. +libs.Rome.classpath=../../../java/commons/rome-0.9/rome-0.9.jar;../../../java/commons/jdom-1.1/build/jdom.jar +main.class=nicobrowser.MainWindow +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..ae68a6a --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,21 @@ + + + org.netbeans.modules.java.j2seproject + + + + + + + + NicoBrowser + 1.6.5 + + + + + + + + + diff --git a/src/nicobrowser/MainWindow.form b/src/nicobrowser/MainWindow.form new file mode 100644 index 0000000..170bae8 --- /dev/null +++ b/src/nicobrowser/MainWindow.form @@ -0,0 +1,299 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/nicobrowser/MainWindow.java b/src/nicobrowser/MainWindow.java new file mode 100644 index 0000000..b4c41fe --- /dev/null +++ b/src/nicobrowser/MainWindow.java @@ -0,0 +1,410 @@ +/*$Id$*/ +/* + * MainWindow.java + * + * Created on 2008/01/05, 15:28 + */ +package nicobrowser; + +import java.awt.Component; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableColumnModel; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; + +/** + * + * @author yuki + */ +public class MainWindow extends javax.swing.JFrame { + + private void setContents(List contList) { + int rowHeight = -1; + for (NicoContent cont : contList) { + Vector v = new Vector(); + ImageIcon icon = new ImageIcon(); + try { + icon = new ImageIcon(new URL(cont.getImageLink())); + if (rowHeight < 0) { + rowHeight = icon.getIconHeight(); + jTable1.setRowHeight(rowHeight); + } + } catch (MalformedURLException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, "画像未取得" + cont.getTitle()); + } + v.add(icon); + v.add(cont.getTitle()); + v.add(cont.getDescription()); + v.add(cont.getPageLink()); + tableModel.addRow(v); + } + } + + private class MyTableModel extends DefaultTableModel { + + private MyTableModel(String[] COLUMN_NAMES, int i) { + super(COLUMN_NAMES, i); + } + + @Override + public Class getColumnClass(int columnIndex) { + return getValueAt(0, columnIndex).getClass(); + } + } + private static final String COLUMN_NAMES[] = {"サムネイル", "タイトル", "説明", "ページリンク"}; + private DefaultTableModel tableModel = new MyTableModel(COLUMN_NAMES, 0); + // private DefaultTableModel tableModel = new NicoTableModel; + /** Creates new form MainWindow */ + public MainWindow() { + initComponents(); + TableCellRenderer textAriaRenderer = new DefaultTableCellRenderer() { + + @Override + public Component getTableCellRendererComponent(JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column) { + JTextArea comp = new JTextArea(value.toString()); + comp.setLineWrap(true); + return comp; + } + }; + TableCellRenderer buttonRenderer = new DefaultTableCellRenderer() { + + @Override + public Component getTableCellRendererComponent(JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column) { + String[] splitted = value.toString().split("/"); + String text = ""; + if (splitted.length > 0) { + text = splitted[splitted.length - 1]; + } + JButton comp = new JButton(text); + return comp; + } + }; + + DefaultTableColumnModel cMoldel = (DefaultTableColumnModel) jTable1.getColumnModel(); + TableColumn c; + c = cMoldel.getColumn(1); + c.setCellRenderer(textAriaRenderer); + c = cMoldel.getColumn(2); + c.setCellRenderer(textAriaRenderer); + c = cMoldel.getColumn(3); + c.setCellRenderer(buttonRenderer); + + c = cMoldel.getColumn(0); + c.setPreferredWidth(130); + c = cMoldel.getColumn(1); + c.setPreferredWidth(100); + c = cMoldel.getColumn(2); + c.setPreferredWidth(400); + c = cMoldel.getColumn(3); + c.setPreferredWidth(110); + + } + + /** 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. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jScrollPane1 = new javax.swing.JScrollPane(); + jTable1 = new javax.swing.JTable(); + jPanel2 = new javax.swing.JPanel(); + listLoadButton = new javax.swing.JButton(); + jLabel3 = new javax.swing.JLabel(); + listNoField = new javax.swing.JTextField(); + unitLoadButton = new javax.swing.JButton(); + jLabel4 = new javax.swing.JLabel(); + unitNoField = new javax.swing.JTextField(); + loadDailyListButton = new javax.swing.JButton(); + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + mailField = new javax.swing.JTextField(); + passwordField = new javax.swing.JTextField(); + loginButton = new javax.swing.JButton(); + jPanel3 = new javax.swing.JPanel(); + clearButton = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jTable1.setModel(tableModel); + jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); + jTable1.setEnabled(false); + jScrollPane1.setViewportView(jTable1); + + jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + listLoadButton.setText("Load"); + listLoadButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + listLoadButtonActionPerformed(evt); + } + }); + + jLabel3.setText("ListNo"); + + listNoField.setText("1923688"); + + unitLoadButton.setText("Load"); + unitLoadButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + unitLoadButtonActionPerformed(evt); + } + }); + + jLabel4.setText("No"); + + unitNoField.setText("sm9"); + + loadDailyListButton.setText("Daily"); + loadDailyListButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + loadDailyListButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(unitLoadButton, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE) + .addComponent(listLoadButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel4)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(unitNoField) + .addComponent(listNoField, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)) + .addGap(18, 18, 18) + .addComponent(loadDailyListButton) + .addContainerGap(20, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(listLoadButton) + .addComponent(jLabel3) + .addComponent(listNoField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(loadDailyListButton)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(jLabel4) + .addComponent(unitLoadButton) + .addComponent(unitNoField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + jLabel1.setText("mail"); + + jLabel2.setText("password"); + + mailField.setEditable(false); + + passwordField.setEditable(false); + + loginButton.setText("LogIn"); + loginButton.setEnabled(false); + loginButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + loginButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(loginButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(mailField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(31, Short.MAX_VALUE)) + ); + + jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {mailField, passwordField}); + + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(loginButton) + .addComponent(jLabel1) + .addComponent(mailField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2) + .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + clearButton.setText("Clear"); + clearButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + clearButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(clearButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(clearButton) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 755, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + private void listLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listLoadButtonActionPerformed + String no = listNoField.getText(); + if (no.length() < 1) { + return; + } + List contList = NicoHttpClient.getInstance().loadMyList(no); + setContents(contList); +}//GEN-LAST:event_listLoadButtonActionPerformed + + private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed + String mail = mailField.getText(); + String password = passwordField.getText(); + if (mail.length() < 1 || password.length() < 1) { + //TODO エラー通知. + return; + } + NicoHttpClient.getInstance().login(mail, password); +}//GEN-LAST:event_loginButtonActionPerformed + + private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed + int num = tableModel.getRowCount(); + for (int i = num - 1; i >= 0; i--) { + tableModel.removeRow(i); + } +}//GEN-LAST:event_clearButtonActionPerformed + + private void unitLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unitLoadButtonActionPerformed + String no = unitNoField.getText(); + if (no.length() < 1) { + return; + } + NicoContent cont = NicoHttpClient.getInstance().loadMyMovie(no); + List list = new ArrayList(); + list.add(cont); + setContents(list); +}//GEN-LAST:event_unitLoadButtonActionPerformed + + private void loadDailyListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadDailyListButtonActionPerformed + List contList = NicoHttpClient.getInstance().loadMyListDaily(); + setContents(contList); + +}//GEN-LAST:event_loadDailyListButtonActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + + public void run() { + new MainWindow().setVisible(true); + } + }); + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton clearButton; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable jTable1; + private javax.swing.JButton listLoadButton; + private javax.swing.JTextField listNoField; + private javax.swing.JButton loadDailyListButton; + private javax.swing.JButton loginButton; + private javax.swing.JTextField mailField; + private javax.swing.JTextField passwordField; + private javax.swing.JButton unitLoadButton; + private javax.swing.JTextField unitNoField; + // End of variables declaration//GEN-END:variables +} diff --git a/src/nicobrowser/NicoContent.java b/src/nicobrowser/NicoContent.java new file mode 100644 index 0000000..6f38ac1 --- /dev/null +++ b/src/nicobrowser/NicoContent.java @@ -0,0 +1,61 @@ +/*$Id$*/ +package nicobrowser; + +import java.util.Date; + +/** + * ニコニコ動画コンテンツ情報. + */ +public class NicoContent { + + private String pageLink; + private String imageLink; + private String title; + private String description; + private Date publishedDate; + + public String getPageLink() { + return pageLink; + } + + public void setPageLink(String pageLink) { + this.pageLink = pageLink; + } + + public String getImageLink() { + return imageLink; + } + + public void setImageLink(String imageLink) { + this.imageLink = imageLink; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + void setDescription(String description) { + this.description = description; + } + + void setPublishedDate(Date publishedDate) { + this.publishedDate = publishedDate; + } + + public Date getPublishedDate() { + return publishedDate; + } + + public String getDescription() { + return description; + } + + @Override + public String toString() { + return new String(getTitle() + ": " + getPageLink()); + } +} diff --git a/src/nicobrowser/NicoHttpClient.java b/src/nicobrowser/NicoHttpClient.java new file mode 100644 index 0000000..cdd2eaf --- /dev/null +++ b/src/nicobrowser/NicoHttpClient.java @@ -0,0 +1,345 @@ +/*$Id$*/ +package nicobrowser; + +import com.sun.syndication.feed.synd.SyndContentImpl; +import com.sun.syndication.feed.synd.SyndEntryImpl; +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.io.FeedException; +import com.sun.syndication.io.ParsingFeedException; +import com.sun.syndication.io.SyndFeedInput; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.text.MutableAttributeSet; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.parser.ParserDelegator; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +/** + * + * @author yuki + */ +public class NicoHttpClient extends HttpClient { + + static NicoHttpClient instance; + private static final String LOGIN_PAGE = + "https://secure.nicovideo.jp/secure/login?site=niconico"; + private static final String LOGOUT_PAGE = + "https://secure.nicovideo.jp/secure/logout"; + private static final String MY_LIST_PAGE_HEADER = + "http://www.nicovideo.jp/mylist/"; + private static final String MOVIE_THUMBNAIL_PAGE_HEADER = + "http://www.nicovideo.jp/api/getthumbinfo/"; + + private NicoHttpClient() { + super(); + instance = this; + } + + public static NicoHttpClient getInstance() { + if (instance == null) { + return new NicoHttpClient(); + } + return instance; + } + + /** + * ニコニコ動画へログインする. + * @param mail ログイン識別子(登録メールアドレス). + * @param password パスワード. + * @return 認証がOKであればtrue. + */ + public boolean login(String mail, String password) { + boolean auth = false; + PostMethod post = new PostMethod(LOGIN_PAGE); + + try { + post.addParameter("mail", mail); + post.addParameter("password", password); + post.addParameter("next_url", ""); + post.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); + int statusCode = executeMethod(post); + Logger.getLogger(NicoHttpClient.class.getName()). + log(Level.INFO, "ログインステータスコード: " + statusCode); + + // ログイン可否の判定. + // x-niconico-authflagで判定できそうだったが必ず0になる... + // Set-Cookieがあればログインできたとみなしているが,あまりよろしくないかも. + auth = (null != post.getResponseHeader("Set-Cookie")) ? true : false; + } catch (IOException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } finally { + post.releaseConnection(); + } + return auth; + } + + public boolean logout() { + boolean result = false; + GetMethod method = new GetMethod(LOGOUT_PAGE); + try { + int statusCode = executeMethod(method); + Logger.getLogger(NicoHttpClient.class.getName()). + log(Level.INFO, "ログアウトステータスコード: " + statusCode); + + if (statusCode == HttpStatus.SC_OK) { + result = true; + } + } catch (IOException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } finally { + method.releaseConnection(); + } + return result; + } + + /** + * 「マイリスト登録数ランキング(本日)」の動画一覧を取得する。 + * @return 動画一覧. + */ + List loadMyListDaily() { + List list = new ArrayList(); + String url = new String("http://zio3.net/nicoRss/Handler.ashx"); + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.INFO, "全動画サイトのマイリスト登録数ランキング(本日)[全体] : " + url); + + GetMethod get = new GetMethod(url); + + try { + int statusCode = executeMethod(get); + BufferedReader reader = new BufferedReader(new InputStreamReader(get.getResponseBodyAsStream(), "UTF-8")); + // BOMを読み捨て + reader.skip(1); + list = getNicoContents(reader); + } catch (FeedException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } finally { + get.releaseConnection(); + } + + return list; + } + + /** + * マイリストに登録した動画一覧の取得. + * 「公開」設定にしていないリストからは取得できない. + * ログインしていなくても取得可能. + * @param listNo マイリストNo. + * @return 動画一覧. + */ + public List loadMyList(String listNo) { + List contList = new ArrayList(); + String url = new String(MY_LIST_PAGE_HEADER + listNo + "?rss=atom"); + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.INFO, "マイリストURL: " + url); + + GetMethod get = new GetMethod(url); + + try { + int statusCode = executeMethod(get); + Reader reader = new BufferedReader(new InputStreamReader(get.getResponseBodyAsStream(), "UTF-8")); + contList = getNicoContents(reader); + } catch (FeedException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } finally { + get.releaseConnection(); + } + return contList; + } + + /** + * 動画番号を指定したコンテンツ情報の取得. + * @param movieNo 動画番号. + * @return コンテンツ情報. + */ + public NicoContent loadMyMovie(String movieNo) { + NicoContent cont = null; + InputStream re = null; + List list = null; + String url = new String(MOVIE_THUMBNAIL_PAGE_HEADER + movieNo); + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.INFO, "動画サムネイルURL: " + url); + + GetMethod get = new GetMethod(url); + + try { + int statusCode = executeMethod(get); + re = get.getResponseBodyAsStream(); + // ドキュメントビルダーファクトリを生成 + DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance(); + // ドキュメントビルダーを生成 + DocumentBuilder builder = dbfactory.newDocumentBuilder(); + // パースを実行してDocumentオブジェクトを取得 + Document doc = builder.parse(re); + // ルート要素を取得(タグ名:site) + Element root = doc.getDocumentElement(); + System.out.println("ルート要素のタグ名:" + root.getTagName()); + + NodeList list2 = root.getElementsByTagName("thumb"); + cont = new NicoContent(); + Element element = (Element) list2.item(0); + + String watch_url = ((Element) element.getElementsByTagName("watch_url").item(0)).getFirstChild().getNodeValue(); + cont.setPageLink(watch_url); + + String thumbnail_url = ((Element) element.getElementsByTagName("thumbnail_url").item(0)).getFirstChild().getNodeValue(); + cont.setImageLink(thumbnail_url); + + String title = ((Element) element.getElementsByTagName("title").item(0)).getFirstChild().getNodeValue(); + cont.setTitle(title); + + String description = ((Element) element.getElementsByTagName("description").item(0)).getFirstChild().getNodeValue(); + cont.setDescription(description); + + // TODO 投稿日の設定 +// String first_retrieve = ((Element) element.getElementsByTagName("first_retrieve").item(0)).getFirstChild().getNodeValue(); +// cont.setPublishedDate(DateFormat.getInstance().parse(first_retrieve)); +// +// } catch (ParseException ex) { +// Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } catch (SAXException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } catch (ParserConfigurationException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } finally { + try { + re.close(); + } catch (IOException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } + } + return cont; + + } + + private List getNicoContents(Reader reader) throws FeedException { + List list = null; + SyndFeedInput input = new SyndFeedInput(); + SyndFeed feed = input.build(reader); + + list = (List) feed.getEntries(); + + List contList; + if (list == null) { + contList = new ArrayList(); + } else { + contList = createContentsList(list); + } + return contList; + } + + private List createContentsList(List list) { + class CallBack extends HTMLEditorKit.ParserCallback { + + private boolean descFlag; + private String imageLink = new String(); + private StringBuilder description = new StringBuilder(); + + @Override + public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos) { +// System.out.println("--------<" + t.toString() + ">--------"); +// printAttributes(a); + if (HTML.Tag.IMG.equals(t)) { + imageLink = a.getAttribute(HTML.Attribute.SRC).toString(); + } + } + + @Override + public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) { + if (HTML.Tag.P.equals(t)) { + if ("nico-description".equals( + a.getAttribute(HTML.Attribute.CLASS).toString())) { + descFlag = true; + } + } +// System.out.println("--------<" + t.toString() + ">--------"); +// printAttributes(a); + } + + @Override + public void handleEndTag(HTML.Tag t, int pos) { + if (HTML.Tag.P.equals(t)) { + descFlag = false; + } +// System.out.println("----------------"); + } + + @Override + public void handleText(char[] data, int pos) { + if (descFlag) { + description.append(data); + } + +// System.out.println("--------TEXT--------"); +// System.out.println(data); + } + + private void printAttributes(MutableAttributeSet a) { + Enumeration e = a.getAttributeNames(); + while (e.hasMoreElements()) { + Object key = e.nextElement(); + System.out.println("---- " + key.toString() + " : " + a.getAttribute(key)); + } + } + + public String getImageLink() { + return imageLink; + } + + public String getDescription() { + return description.toString(); + } + } + + List contList = new ArrayList(); + + for (SyndEntryImpl entry : list) { + NicoContent content = new NicoContent(); + + content.setTitle(entry.getTitle()); + content.setPageLink(entry.getLink()); + content.setPublishedDate(entry.getPublishedDate()); + + // サムネイル画像リンクと説明文の取得 + CallBack callBack = new CallBack(); + for (SyndContentImpl sc : (List) entry.getContents()) { + try { + Reader reader = new StringReader(sc.getValue()); + new ParserDelegator().parse(reader, callBack, true); + } catch (IOException ex) { + Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex); + } + } + content.setImageLink(callBack.getImageLink()); + content.setDescription(callBack.getDescription()); + + // リストへ追加. + contList.add(content); + } + return contList; + } +} diff --git a/src/nicobrowser/NicoTableModel.java b/src/nicobrowser/NicoTableModel.java new file mode 100644 index 0000000..aa8345c --- /dev/null +++ b/src/nicobrowser/NicoTableModel.java @@ -0,0 +1,91 @@ +/*$Id$*/ +package nicobrowser; + +import java.awt.Component; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumn; + +/** + * + * @author yuki + */ +public class NicoTableModel extends DefaultTableModel { + + private static final ColumnContext[] COLUMN_CONTEXT = { + new ColumnContext("サムネイル", ImageIcon.class), + new ColumnContext("タイトル", String.class), + new ColumnContext("説明", JTextArea.class), + new ColumnContext("リンク", JButton.class) + }; + + private static class ColumnContext { + + private String columnName; + private Class renderer; + + private ColumnContext(String columnName, Class renderer) { + this.columnName = columnName; + this.renderer = renderer; + } + } + + static class MyCellRender extends DefaultTableCellRenderer { + + @Override + public Component getTableCellRendererComponent( + JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + if (isSelected) { + table.setForeground(table.getSelectionForeground()); + table.setBackground(table.getSelectionBackground()); + } else { + table.setForeground(table.getForeground()); + table.setBackground(table.getBackground()); + } + + //setFont(table.getFont()); + + try { + Object obj = COLUMN_CONTEXT[column].renderer.newInstance(); + + + return (Component) obj; + } catch (InstantiationException ex) { + Logger.getLogger(NicoTableModel.class.getName()).log(Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + Logger.getLogger(NicoTableModel.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + + + } + } + + public NicoTableModel() { + super(); + for (ColumnContext c : COLUMN_CONTEXT) { + addColumn(c.columnName); + } + TableColumn column; + + + } + + @Override + public Class getColumnClass(int columnIndex) { + return COLUMN_CONTEXT[columnIndex].renderer; + + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return false; + } +} diff --git a/test/nicobrowser/NicoHttpClientTest.java b/test/nicobrowser/NicoHttpClientTest.java new file mode 100644 index 0000000..294bc94 --- /dev/null +++ b/test/nicobrowser/NicoHttpClientTest.java @@ -0,0 +1,120 @@ +/*$Id$*/ +package nicobrowser; + +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author yuki + */ +public class NicoHttpClientTest { + + static final String OK_MAIL = "niconico.senyou@live.jp"; + static final String OK_PASS = "piyopiyo"; + static final String OK_LIST_NO = "4315046"; + + public NicoHttpClientTest() { + } + + @BeforeClass + public static void setUpClass() throws Exception { + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * Test of getInstance method, of class NicoHttpClient. + */ + @Test + public void getInstance() { + System.out.println("getInstance"); + NicoHttpClient result = NicoHttpClient.getInstance(); + assertNotNull(result); + + // 2回目でも同じインスタンスが返る. + NicoHttpClient instance = NicoHttpClient.getInstance(); + assertEquals(result, instance); + } + + /** + * Test of login method, of class NicoHttpClient. + */ + @Test + public void login() { + System.out.println("login"); + NicoHttpClient instance = NicoHttpClient.getInstance(); + + // ログイン失敗ケース + String mail = "test@example.com"; + String password = "xxxx"; + boolean result = instance.login(mail, password); + assertEquals(false, result); + + // ログイン成功ケース + mail = OK_MAIL; + password = OK_PASS; + result = instance.login(mail, password); + assertEquals(true, result); + } + + @Test + public void logout() { + System.out.println("logout"); + + boolean result; + result = NicoHttpClient.getInstance().logout(); + assertEquals(true, result); + + result = NicoHttpClient.getInstance().logout(); + assertEquals(true, result); + } + + @Test + public void loadMyList() { + System.out.println("loadMyList"); + + NicoHttpClient instance = NicoHttpClient.getInstance(); + List list; + + list = instance.loadMyList(OK_LIST_NO); + assertNotNull(list); + assertNotSame(0, list.size()); +// for (Object o : list) { +// System.out.println(o.toString()); +// } + + list = instance.loadMyList("XXXX"); + assertNotNull(list); + assertSame(0, list.size()); + } + + @Test + public void loadMyListDaily() { + System.out.println("loadMyListDaily"); + NicoHttpClient instance = NicoHttpClient.getInstance(); + instance.login(OK_MAIL, OK_PASS); + List list = instance.loadMyListDaily(); + assertNotNull(list); + assertNotSame(0, list.size()); +// System.out.println(list.size()); +// for (Object o : list) { +// System.out.println(o.toString()); +// } + } +} -- 2.11.0