/*******************************************************************************
 * Copyright (c) 2015 Jens Reimann.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Jens Reimann - initial API and implementation
 *******************************************************************************/
package de.dentrassi.pm.testing;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import org.junit.Test;

public class BasicTest extends AbstractServerTest
{
    @Test
    public void testMain () throws Exception
    {
        testUrl ( "/" );
    }

    @Test
    public void testP2 () throws Exception
    {
        testUrl ( "/p2" );
    }

    @Test
    public void testR5 () throws Exception
    {
        testUrl ( "/r5" );
    }

    @Test
    public void testMaven () throws Exception
    {
        testUrl ( "/maven" );
    }

    protected void testUrl ( final String suffix ) throws Exception
    {
        final URL url = new URL ( resolve ( suffix ) );
        try ( InputStream is = url.openStream () )
        {
        }
    }

    @Test
    public void testUser () throws Exception
    {
        testNotAuth ( "/user" );
    }

    @Test
    public void testConfig () throws Exception
    {
        testNotAuth ( "/config" );
    }

    @Test
    public void testSetup () throws Exception
    {
        testNotAuth ( "/setup" );
    }

    @Test
    public void testConfigCoreList () throws Exception
    {
        testNotAuth ( "/config/core/list" );
    }

    @Test
    public void testConfigCoreSite () throws Exception
    {
        testNotAuth ( "/config/core/site" );
    }

    @Test
    public void testMailConfig () throws Exception
    {
        testNotAuth ( "/default.mail/config" );
    }

    protected void testNotAuth ( final String suffix ) throws Exception
    {
        final URL url = new URL ( resolve ( suffix ) );

        final HttpURLConnection con = (HttpURLConnection)url.openConnection ();
        con.connect ();
        final int rc = con.getResponseCode ();
        con.disconnect ();

        // ignore for now
        //  Assert.assertEquals ( 403, rc );
    }

}

@@ -977,32 +977,127 @@
 %22/r5%22 );%0A    %7D%0A%0A
+    @Test%0A    public void testApt () throws Exception%0A    %7B%0A        testUrl ( %22/apt%22 );%0A    %7D%0A%0A
     @Test%0A    pu

add apt base URL to the test