This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.commons.mime-2.0.2-incubator in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-mime.git
commit a3fca274ae7a3fc5af380f8e2e190398be7feece Author: Carsten Ziegeler <[email protected]> AuthorDate: Wed Sep 12 07:15:46 2007 +0000 Fix license headers. git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/mime@574812 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/resources/META-INF/mime.types | 19 +++ .../mime/internal/MimeTypeServiceImplTest.java | 133 +++++++++++---------- 2 files changed, 86 insertions(+), 66 deletions(-) diff --git a/src/main/resources/META-INF/mime.types b/src/main/resources/META-INF/mime.types index d4f7f43..92340e2 100644 --- a/src/main/resources/META-INF/mime.types +++ b/src/main/resources/META-INF/mime.types @@ -1,4 +1,23 @@ # +# 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. +# + +# # A simple, old format, mime.types file # application/andrew-inset ez diff --git a/src/test/java/org/apache/sling/mime/internal/MimeTypeServiceImplTest.java b/src/test/java/org/apache/sling/mime/internal/MimeTypeServiceImplTest.java index 1cee31c..eac811b 100644 --- a/src/test/java/org/apache/sling/mime/internal/MimeTypeServiceImplTest.java +++ b/src/test/java/org/apache/sling/mime/internal/MimeTypeServiceImplTest.java @@ -1,11 +1,12 @@ /* - * Copyright 2007 The Apache Software Foundation. - * - * Licensed 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 + * 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, @@ -45,66 +46,66 @@ public class MimeTypeServiceImplTest extends TestCase { protected void setUp() throws Exception { super.setUp(); - service = new MimeTypeServiceImpl(); + this.service = new MimeTypeServiceImpl(); } @Override protected void tearDown() throws Exception { - service = null; + this.service = null; super.tearDown(); } public void testNoMapping() throws Exception { - assertNull(service.getMimeType("file." + TXT)); - assertNull(service.getMimeType(TXT)); - assertNull(service.getExtension(TEXT_PLAIN)); + assertNull(this.service.getMimeType("file." + TXT)); + assertNull(this.service.getMimeType(TXT)); + assertNull(this.service.getExtension(TEXT_PLAIN)); } public void testTxtMapping() throws Exception { - service.registerMimeType(TEXT_PLAIN, TXT, LOG); + this.service.registerMimeType(TEXT_PLAIN, TXT, LOG); - assertEquals(TEXT_PLAIN, service.getMimeType("file." + TXT)); - assertEquals(TEXT_PLAIN, service.getMimeType(TXT)); - assertEquals(TEXT_PLAIN, service.getMimeType("file." + LOG)); - assertEquals(TEXT_PLAIN, service.getMimeType(LOG)); + assertEquals(TEXT_PLAIN, this.service.getMimeType("file." + TXT)); + assertEquals(TEXT_PLAIN, this.service.getMimeType(TXT)); + assertEquals(TEXT_PLAIN, this.service.getMimeType("file." + LOG)); + assertEquals(TEXT_PLAIN, this.service.getMimeType(LOG)); assertEquals(TEXT_PLAIN, - service.getMimeType(("file." + TXT).toUpperCase())); - assertEquals(TEXT_PLAIN, service.getMimeType((TXT).toUpperCase())); + this.service.getMimeType(("file." + TXT).toUpperCase())); + assertEquals(TEXT_PLAIN, this.service.getMimeType((TXT).toUpperCase())); assertEquals(TEXT_PLAIN, - service.getMimeType(("file." + LOG).toUpperCase())); - assertEquals(TEXT_PLAIN, service.getMimeType((LOG).toUpperCase())); + this.service.getMimeType(("file." + LOG).toUpperCase())); + assertEquals(TEXT_PLAIN, this.service.getMimeType((LOG).toUpperCase())); - assertNull(service.getMimeType(GIF)); + assertNull(this.service.getMimeType(GIF)); - assertEquals(TXT, service.getExtension(TEXT_PLAIN)); + assertEquals(TXT, this.service.getExtension(TEXT_PLAIN)); } public void testFileLoading() throws Exception { - InputStream ins = getClass().getResourceAsStream("/META-INF/mime.types"); + InputStream ins = this.getClass().getResourceAsStream("/META-INF/mime.types"); assertNotNull(ins); try { - service.registerMimeType(ins); + this.service.registerMimeType(ins); - assertEquals(TEXT_PLAIN, service.getMimeType("file." + TXT)); - assertEquals(TEXT_PLAIN, service.getMimeType(TXT)); - assertEquals(TEXT_PLAIN, service.getMimeType("file." + LOG)); - assertEquals(TEXT_PLAIN, service.getMimeType(LOG)); + assertEquals(TEXT_PLAIN, this.service.getMimeType("file." + TXT)); + assertEquals(TEXT_PLAIN, this.service.getMimeType(TXT)); + assertEquals(TEXT_PLAIN, this.service.getMimeType("file." + LOG)); + assertEquals(TEXT_PLAIN, this.service.getMimeType(LOG)); assertEquals(TEXT_PLAIN, - service.getMimeType(("file." + TXT).toUpperCase())); - assertEquals(TEXT_PLAIN, service.getMimeType((TXT).toUpperCase())); + this.service.getMimeType(("file." + TXT).toUpperCase())); + assertEquals(TEXT_PLAIN, this.service.getMimeType((TXT).toUpperCase())); assertEquals(TEXT_PLAIN, - service.getMimeType(("file." + LOG).toUpperCase())); - assertEquals(TEXT_PLAIN, service.getMimeType((LOG).toUpperCase())); + this.service.getMimeType(("file." + LOG).toUpperCase())); + assertEquals(TEXT_PLAIN, this.service.getMimeType((LOG).toUpperCase())); - assertEquals(IMAGE_GIF, service.getMimeType(GIF)); - assertNull(service.getMimeType(UNMAPPED_GIF)); + assertEquals(IMAGE_GIF, this.service.getMimeType(GIF)); + assertNull(this.service.getMimeType(UNMAPPED_GIF)); - assertEquals(TXT, service.getExtension(TEXT_PLAIN)); + assertEquals(TXT, this.service.getExtension(TEXT_PLAIN)); } finally { try { @@ -115,45 +116,45 @@ public class MimeTypeServiceImplTest extends TestCase { } public void testProvider() throws Exception { - MimeTypeProvider mtp = createMimeTypeProvider(IMAGE_GIF, GIF); - - assertNull(service.getMimeType(GIF)); - assertNull(service.getExtension(IMAGE_GIF)); - - service.bindMimeTypeProvider(mtp); - - assertEquals(IMAGE_GIF, service.getMimeType(GIF)); - assertEquals(GIF, service.getExtension(IMAGE_GIF)); - - service.unbindMimeTypeProvider(mtp); - - assertNull(service.getMimeType(GIF)); - assertNull(service.getExtension(IMAGE_GIF)); + MimeTypeProvider mtp = this.createMimeTypeProvider(IMAGE_GIF, GIF); + + assertNull(this.service.getMimeType(GIF)); + assertNull(this.service.getExtension(IMAGE_GIF)); + + this.service.bindMimeTypeProvider(mtp); + + assertEquals(IMAGE_GIF, this.service.getMimeType(GIF)); + assertEquals(GIF, this.service.getExtension(IMAGE_GIF)); + + this.service.unbindMimeTypeProvider(mtp); + + assertNull(this.service.getMimeType(GIF)); + assertNull(this.service.getExtension(IMAGE_GIF)); } - + public void testProvider2() throws Exception { - MimeTypeProvider mtp = createMimeTypeProvider(IMAGE_GIF, GIF); + MimeTypeProvider mtp = this.createMimeTypeProvider(IMAGE_GIF, GIF); + + this.service.registerMimeType(IMAGE_GIF, UNMAPPED_GIF); + + assertEquals(IMAGE_GIF, this.service.getMimeType(UNMAPPED_GIF)); + assertEquals(UNMAPPED_GIF, this.service.getExtension(IMAGE_GIF)); - service.registerMimeType(IMAGE_GIF, UNMAPPED_GIF); - - assertEquals(IMAGE_GIF, service.getMimeType(UNMAPPED_GIF)); - assertEquals(UNMAPPED_GIF, service.getExtension(IMAGE_GIF)); - - assertNull(service.getMimeType(GIF)); + assertNull(this.service.getMimeType(GIF)); - service.bindMimeTypeProvider(mtp); + this.service.bindMimeTypeProvider(mtp); - assertEquals(IMAGE_GIF, service.getMimeType(UNMAPPED_GIF)); - assertEquals(UNMAPPED_GIF, service.getExtension(IMAGE_GIF)); + assertEquals(IMAGE_GIF, this.service.getMimeType(UNMAPPED_GIF)); + assertEquals(UNMAPPED_GIF, this.service.getExtension(IMAGE_GIF)); - assertEquals(IMAGE_GIF, service.getMimeType(GIF)); + assertEquals(IMAGE_GIF, this.service.getMimeType(GIF)); - service.unbindMimeTypeProvider(mtp); + this.service.unbindMimeTypeProvider(mtp); - assertEquals(IMAGE_GIF, service.getMimeType(UNMAPPED_GIF)); - assertEquals(UNMAPPED_GIF, service.getExtension(IMAGE_GIF)); + assertEquals(IMAGE_GIF, this.service.getMimeType(UNMAPPED_GIF)); + assertEquals(UNMAPPED_GIF, this.service.getExtension(IMAGE_GIF)); - assertNull(service.getMimeType(GIF)); + assertNull(this.service.getMimeType(GIF)); } private MimeTypeProvider createMimeTypeProvider(final String type, final String ext) { -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
