public static void main(String[] args) {

    System.out.println("Dieser Test sollte in einem leeren TeamfoundDir probiert werden");

    try {
      java.io.File f = new java.io.File("/home/moddin/build/teamfound.properties");

      java.io.FileInputStream pin = new java.io.FileInputStream(f);

      java.util.Properties props = new java.util.Properties();

      props.load(pin);

      config.Config tfc = new config.teamfound.TeamFoundConfig(props);

      Controller ctrl = new TeamFoundController(tfc);

      System.out.println("Server initializieren!");
      if (ctrl.initServer()) System.out.println("Server ist bereit\n\n");
      else System.out.println("Server ist nicht bereit\n\n");

      System.out.println("\n\n");
      System.out.println("------GetProjects Test---------");
      GetProjectsResponse r1 = ctrl.getProjects();
      printdoc(r1);

      System.out.println("\n\n");
      System.out.println("-------Add Category Test--------");
      AddCategoriesResponse r2;
      r2 = ctrl.addCategory("Cat1", 0, "Unterkat vom Projekt Tf");
      printdoc(r2);

      r2 = ctrl.addCategory("Cat2", 0, "Unterkat vom Projekt Tf");
      printdoc(r2);

      r2 = ctrl.addCategory("SubCat1", 1, "Unterkat von Cat1");
      printdoc(r2);

      System.out.println("\n\n");
      System.out.println("-------GetCategories Test--------");
      GetCategoriesResponse r3 = ctrl.getCategories(0);
      printdoc(r3);

      System.out.println("\n\n");
      System.out.println("-------AddPage Test--------");
      int[] cats = new int[1];
      cats[0] = 3; // ist Subcat1
      String url = new String("http://www.black-sparx.de/");
      try {
        AddPageResponse r4 = ctrl.addToIndex(url, cats);
        printdoc(r4);
        r4 = ctrl.addToIndex(url, cats);
        printdoc(r4);
        cats[0] = 2; // ist Cat2
        r4 = ctrl.addToIndex(url, cats);
        printdoc(r4);
        url = ("http://de.wikipedia.org/wiki/Reiseveranstalter");
        r4 = ctrl.addToIndex(url, cats);
        printdoc(r4);

      } catch (Exception e) {
        System.out.println(e);
      }
      System.out.println("\n\n");
      System.out.println("-------Search Test--------");
      cats[0] = 2;
      try {
        SearchResponse r5 = ctrl.search("Black", 0, cats);
        printdoc(r5);
        r5 = ctrl.search("Produkte", 0, cats);
        printdoc(r5);
      } catch (Exception e) {
        System.out.println(e);
      }
      //	System.out.println("\n\n");
      //	System.out.println("-------GetCategories Test--------");
      //	r3 = ctrl.getCategories(0);
      //	printdoc(r3);

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Пример #2
0
 @SuppressWarnings("serial")
 private void initGUI() {
   try {
     setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
     getContentPane().setLayout(null);
     this.setTitle("Overzicht");
     this.setVisible(true);
     {
       lStart = new JLabel();
       getContentPane().add(lStart);
       lStart.setText("Overzicht");
       lStart.setHorizontalAlignment(SwingConstants.CENTER);
       lStart.setBackground(new java.awt.Color(54, 190, 54));
       lStart.setFont(new java.awt.Font("Arial", 1, 36));
       lStart.setForeground(new java.awt.Color(0, 128, 64));
       lStart.setOpaque(true);
       lStart.setBounds(0, 0, 336, 49);
     }
     {
       pInzet = new JPanel();
       getContentPane().add(pInzet);
       pInzet.setBorder(
           BorderFactory.createTitledBorder(
               null,
               "Selectie",
               TitledBorder.LEADING,
               TitledBorder.DEFAULT_POSITION,
               new java.awt.Font("Tahoma", 1, 11)));
       pInzet.setLayout(null);
       pInzet.setBounds(14, 63, 308, 105);
       pInzet.setFont(new java.awt.Font("Tahoma", 1, 12));
       {
         lMin = new JLabel();
         pInzet.add(lMin);
         lMin.setText("Speler");
         lMin.setFont(new java.awt.Font("Arial", 0, 12));
         lMin.setBounds(17, 59, 62, 27);
       }
       {
         lMax = new JLabel();
         pInzet.add(lMax);
         lMax.setText("Spelronde");
         lMax.setFont(new java.awt.Font("Arial", 0, 12));
         lMax.setBounds(17, 26, 62, 25);
       }
       // Combo voor Spelrondes. Deze wordt eerst geladen. Na selectie
       // wordt de speler gevuld.
       {
         oc = new OverzichtController(this);
         String[] rondes = oc.GeefSpelrondes();
         ComboBoxModel cbSpelRondeModel = new DefaultComboBoxModel(rondes);
         cbSpelRonde = new JComboBox();
         pInzet.add(cbSpelRonde);
         cbSpelRonde.setModel(cbSpelRondeModel);
         cbSpelRonde.setBounds(91, 29, 156, 21);
         cbSpelRonde.setToolTipText("Maak een keuze uit de gespeelde speelronden.");
       }
       {
         bStart = new JButton();
         getContentPane().add(bStart);
         bStart.setText("Sluiten");
         bStart.setFont(new java.awt.Font("Arial", 0, 12));
         bStart.setBounds(196, 303, 75, 23);
         bStart.addActionListener(
             new ActionListener() {
               public void actionPerformed(ActionEvent evt) {
                 bStartActionPerformed(evt);
               }
             });
       }
     }
     pack();
     this.setSize(352, 364);
   } catch (Exception e) {
     e.printStackTrace();
   }
 } // private void initGUI()