de.dentrassi.pm.testing.DebTest.java Source code

Java tutorial

Introduction

Here is the source code for de.dentrassi.pm.testing.DebTest.java

Source

/*******************************************************************************
 * Copyright (c) 2015 IBH SYSTEMS GmbH.
 * 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:
 *     IBH SYSTEMS GmbH - initial API and implementation
 *******************************************************************************/
package de.dentrassi.pm.testing;

import java.util.Set;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

public class DebTest extends AbstractServerTest {
    @Test
    public void testDeb1() throws Exception {
        final ChannelTester ct = ChannelTester.create(getWebContext(), "deb1");
        ct.addAspect("deb");
        ct.addAspect("apt");

        {
            final Set<String> result = ct.upload("data/deb/org.eclipse.scada_0.2.1_all.deb");
            Assert.assertEquals(1, result.size());
        }
        Assert.assertEquals(1, ct.getAllArtifactIds().size());

        testUrl(String.format("/apt/%s", ct.getId())); // index page
    }

    @Test
    public void testDeb2() throws Exception {
        final ChannelTester ct = ChannelTester.create(getWebContext(), "deb2");
        ct.addAspect("deb");
        ct.addAspect("apt");

        {
            final Set<String> result = ct.upload("data/deb/org.eclipse.scada_0.2.1_all.deb");
            Assert.assertEquals(1, result.size());
        }
        Assert.assertEquals(1, ct.getAllArtifactIds().size());

        testUrl(String.format("/apt/%s", ct.getId())); // index page

        getWebContext().getResolved(String.format("/config/deb/channel/%s/edit", ct.getId()));

        final WebElement desc = getWebContext().findElement(By.name("description"));
        desc.sendKeys("Test Description");
        desc.submit();

        testUrl(String.format("/apt/%s", ct.getId())); // index page

        testUrl(String.format("/apt/%s/dists/default/Release", ct.getId()));
        testUrl(String.format("/apt/%s/dists/default/main/binary-amd64/Release", ct.getId()));
        testUrl(String.format("/apt/%s/dists/default/main/binary-amd64/Packages", ct.getId()));
        testUrl(String.format("/apt/%s/dists/default/main/binary-i386/Release", ct.getId()));
        testUrl(String.format("/apt/%s/dists/default/main/binary-i386/Packages", ct.getId()));
    }

}