From 6170d7c6063da89929577702189e4e4bfe564cc7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 15 May 2017 21:06:24 +0100 Subject: drop unused qa OfficeResourceLoader test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3c8486781cff4d2b1ad8dc41c0ad2648f42e94e2 Reviewed-on: https://gerrit.libreoffice.org/37656 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- .../complex/extensions/OfficeResourceLoader.java | 127 --------------------- .../qa/complex/extensions/extensions_all.sce | 1 - extensions/qa/complex/extensions/makefile.mk | 89 --------------- extensions/qa/complex/extensions/orl_de.src | 25 ---- extensions/qa/complex/extensions/orl_en-US.src | 25 ---- 5 files changed, 267 deletions(-) delete mode 100644 extensions/qa/complex/extensions/OfficeResourceLoader.java delete mode 100644 extensions/qa/complex/extensions/extensions_all.sce delete mode 100644 extensions/qa/complex/extensions/makefile.mk delete mode 100644 extensions/qa/complex/extensions/orl_de.src delete mode 100644 extensions/qa/complex/extensions/orl_en-US.src diff --git a/extensions/qa/complex/extensions/OfficeResourceLoader.java b/extensions/qa/complex/extensions/OfficeResourceLoader.java deleted file mode 100644 index 7114ecf5ec39..000000000000 --- a/extensions/qa/complex/extensions/OfficeResourceLoader.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ -package complex.extensions; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.resource.XResourceBundle; -import com.sun.star.resource.XResourceBundleLoader; -import com.sun.star.beans.XPropertySet; -import com.sun.star.uno.XComponentContext; -import com.sun.star.lang.Locale; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openoffice.test.OfficeConnection; -import static org.junit.Assert.*; - -public class OfficeResourceLoader -{ - XResourceBundleLoader m_loader; - XResourceBundle m_bundle; - - /* ------------------------------------------------------------------ */ - @Before public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet orb = UnoRuntime.queryInterface(XPropertySet.class, getMSF()); - XComponentContext context = UnoRuntime.queryInterface(XComponentContext.class, orb.getPropertyValue("DefaultContext")); - - m_loader = com.sun.star.resource.OfficeResourceLoader.get( context ); - } - - /* ------------------------------------------------------------------ */ - @After public void after() throws java.lang.Exception - { - } - - /* ------------------------------------------------------------------ */ - @Test public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception - { - // default bundle (UI locale) - m_bundle = m_loader.loadBundle_Default( "orl" ); - - Locale resourceLocale = m_bundle.getLocale(); - - String testString = (String)m_bundle.getByName( "string:1000" ); - - if ( resourceLocale.Language.equals( "en" ) - && resourceLocale.Country.equals( "US" ) - && resourceLocale.Variant.equals( "" ) - ) - { - assertTrue( "invalid 'en-US' string", testString.equals( "Dummy String" ) ); - } - - if ( resourceLocale.Language.equals( "de" ) - && resourceLocale.Country.equals( "" ) - && resourceLocale.Variant.equals( "" ) - ) - { - assertTrue( "invalid 'de' string", testString.equals( "Attrappen-Zeichenkette" ) ); - } - - if ( resourceLocale.Language.equals( "" ) - && resourceLocale.Country.equals( "" ) - && resourceLocale.Variant.equals( "" ) - ) - { - assertTrue( "invalid unlocalized string", testString.equals( "unlocalized string" ) ); - } - } - - /* ------------------------------------------------------------------ */ - @Test public void checkLocales() throws java.lang.Exception - { - // en-US bundle (should always be built and thus present and thus found) - m_bundle = m_loader.loadBundle( "orl", new Locale( "en", "US", "" ) ); - Locale resourceLocale = m_bundle.getLocale(); - assertTrue( "'en-US' could not be loaded", - resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ); - - // some (invalid) locale which is usually no built, and should thus fallback to en-US - m_bundle = m_loader.loadBundle( "orl", new Locale( "inv", "al", "id" ) ); - resourceLocale = m_bundle.getLocale(); - assertTrue( "non-existing locale request does not fallback to en-US", - resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ); - } - - - private XMultiServiceFactory getMSF() - { - return UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); - } - - // setup and close connections - @BeforeClass public static void setUpConnection() throws Exception { - System.out.println("setUpConnection()"); - connection.setUp(); - } - - @AfterClass public static void tearDownConnection() - throws InterruptedException, com.sun.star.uno.Exception - { - System.out.println("tearDownConnection()"); - connection.tearDown(); - } - - private static final OfficeConnection connection = new OfficeConnection(); -} diff --git a/extensions/qa/complex/extensions/extensions_all.sce b/extensions/qa/complex/extensions/extensions_all.sce deleted file mode 100644 index 2d23dd7a1c92..000000000000 --- a/extensions/qa/complex/extensions/extensions_all.sce +++ /dev/null @@ -1 +0,0 @@ --o complex.extensions.OfficeResourceLoader diff --git a/extensions/qa/complex/extensions/makefile.mk b/extensions/qa/complex/extensions/makefile.mk deleted file mode 100644 index 312a7caae482..000000000000 --- a/extensions/qa/complex/extensions/makefile.mk +++ /dev/null @@ -1,89 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# 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 . -# - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../../.. -PRJNAME = extensions -TARGET = qa_complex_extensions - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = complex/extensions -JAVATESTFILES = \ - OfficeResourceLoader.java - -JAVAFILES = $(JAVATESTFILES) - -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar ConnectivityTools.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) -.END - - - -.IF "$(OS)"=="WNT" -command_separator=&& -.ELSE -command_separator=; -.ENDIF - - -.INCLUDE: settings.mk - -#----- resource files for the OfficeResourceLoader test ------------ -RES_TARGET = orl - -SRS1NAME=$(RES_TARGET)_A_ -SRC1FILES= \ - $(RES_TARGET)_en-US.src - -RES1FILELIST=\ - $(SRS)$/$(RES_TARGET)_A_.srs - -RESLIB1NAME=$(RES_TARGET)_A_ -RESLIB1SRSFILES=$(RES1FILELIST) - - - -SRS2NAME=$(RES_TARGET)_B_ -SRC2FILES= \ - $(RES_TARGET)_de.src - -RES2FILELIST=\ - $(SRS)$/$(RES_TARGET)_B_.srs - -RESLIB2NAME=$(RES_TARGET)_B_ -RESLIB2SRSFILES=$(RES2FILELIST) - -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - - -#----- resource files for the OfficeResourceLoader test ------------ - - -ALLTAR : copy_resources javatest - -copy_resources: $(RESLIB1TARGETN) $(RESLIB2TARGETN) - $(foreach,i,$(RESLIB1TARGETN) $(COPY) $i $(i:s/de/invalid/:s/_A_//) $(command_separator)) echo - $(foreach,i,$(RESLIB2TARGETN) $(COPY) $i $(i:s/en-US/invalid/:s/_B_//) $(command_separator)) echo - - -.END - diff --git a/extensions/qa/complex/extensions/orl_de.src b/extensions/qa/complex/extensions/orl_de.src deleted file mode 100644 index 43f638c64f65..000000000000 --- a/extensions/qa/complex/extensions/orl_de.src +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ - -String 1000 -{ - Text = "Attrappen-Zeichenkette"; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/qa/complex/extensions/orl_en-US.src b/extensions/qa/complex/extensions/orl_en-US.src deleted file mode 100644 index 418a90136a18..000000000000 --- a/extensions/qa/complex/extensions/orl_en-US.src +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ - -String 1000 -{ - Text = "Dummy String"; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3