Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 425AC104AC for ; Mon, 8 Jul 2013 11:57:20 +0000 (UTC) Received: (qmail 50090 invoked by uid 500); 8 Jul 2013 11:57:20 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 50018 invoked by uid 500); 8 Jul 2013 11:57:19 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 50011 invoked by uid 99); 8 Jul 2013 11:57:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jul 2013 11:57:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jul 2013 11:57:16 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0666B2388860; Mon, 8 Jul 2013 11:56:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1500678 - in /sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api: ./ InstallableResourceTest.java Date: Mon, 08 Jul 2013 11:56:54 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130708115655.0666B2388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Mon Jul 8 11:56:54 2013 New Revision: 1500678 URL: http://svn.apache.org/r1500678 Log: SLING-2947 : Merge installer api back into core Added: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/ sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/InstallableResourceTest.java (with props) Added: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/InstallableResourceTest.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/InstallableResourceTest.java?rev=1500678&view=auto ============================================================================== --- sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/InstallableResourceTest.java (added) +++ sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/InstallableResourceTest.java Mon Jul 8 11:56:54 2013 @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.installer.api; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.ByteArrayInputStream; +import java.util.Hashtable; + +import org.junit.Test; + +/** + * Test for the installable resource. + */ +public class InstallableResourceTest { + + @Test public void testConstructor() { + // no id + try { + new InstallableResource(null, null, new Hashtable(), null, null, null); + fail("IAE expected : no id"); + } catch (IllegalArgumentException iae) { + // expected + } + // no input stream, no dict + try { + new InstallableResource("1", null, null, null, null, null); + fail("IAE expected : no is no dict"); + } catch (IllegalArgumentException iae) { + // expected + } + new InstallableResource("1", new ByteArrayInputStream("a".getBytes()), null, null, null, null); + new InstallableResource("1", null, new Hashtable(), null, null, null); + new InstallableResource("1", new ByteArrayInputStream("a".getBytes()), new Hashtable(), null, null, null); + } + + @Test public void testPriority() { + final InstallableResource defaultPrio = + new InstallableResource("1", null, new Hashtable(), null, null, null); + assertEquals(InstallableResource.DEFAULT_PRIORITY, defaultPrio.getPriority()); + final InstallableResource ownPrio = + new InstallableResource("1", null, new Hashtable(), null, null, 47); + assertEquals(47, ownPrio.getPriority()); + } +} Propchange: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/InstallableResourceTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/InstallableResourceTest.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Propchange: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/api/InstallableResourceTest.java ------------------------------------------------------------------------------ svn:mime-type = text/plain