/*
 * Copyright (C) 2021 berdan
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package test;

import utils.FifoPipe;
import utils.Message;

/**
 * Dies ist eine Test-Klasse
 * 
 * @author berdan, eichehome
 */
public class PipeTest {

    /**
     * 
     * @param args Standard String der Main-Methode
     */
    public static void main(String[] args) {
        FifoPipe pipe = new FifoPipe();
//        System.out.println("Erstes Element: " + pipe.firstElement);
//        System.out.println("Letztes Element: " + pipe.lastElement);
        Message el = new Message("Christian", "Test");
        pipe.setElement(el);
        System.out.println("Angehängt");
//        System.out.println("Erstes Element: " + pipe.firstElement);
//        System.out.println("Letztes Element: " + pipe.lastElement);
//        System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().getMessage());
//        System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().getMessage());
        Message el2 = new Message("Christian", "Test");
        pipe.setElement(el2);
        System.out.println("Angehängt2");
//        System.out.println("Erstes Element: " + pipe.firstElement);
//        System.out.println("Letztes Element: " + pipe.lastElement);
//        System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().getMessage());
//        System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().getMessage());
        Message message = pipe.getNextElement();
        System.out.println("Oben entnommen");
        System.out.println("Entnommen Inhalt: " + message.getMessage());
//        System.out.println("Erstes Element: " + pipe.firstElement);
//        System.out.println("Letztes Element: " + pipe.lastElement);
//        System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().getMessage());
//        System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().getMessage());
        Message message2 = pipe.getNextElement();
        System.out.println("Oben entnommen2");
        System.out.println("Entnommen Inhalt: " + message2.getMessage());
//        System.out.println("Erstes Element: " + pipe.firstElement);
//        System.out.println("Letztes Element: " + pipe.lastElement);
        //Wieso wills nicht funktionieren?
        Message message3 = pipe.getNextElement();
        System.out.println("Oben entnommen3");
        System.out.println(message3.getMessage());
//        System.out.println("Erstes Element: " + pipe.firstElement);
//        System.out.println("Letztes Element: " + pipe.lastElement);
    }

}
