You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2004/10/14 08:36:55 UTC
svn commit: rev 54774 - in cocoon/whiteboard/block-deployer: src/impl/org/apache/cocoon/blockdeployer/repository src/impl/org/apache/cocoon/blockdeployer/utils test/junit/org/apache/cocoon/blockdeployer test/junit/org/apache/cocoon/blockdeployer/repository test/junit/org/apache/cocoon/blockdeployer/utils
Author: reinhard
Date: Wed Oct 13 23:36:54 2004
New Revision: 54774
Added:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/utils/CommonsTransactionLogger.java
cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/LogEnabledTestCase.java
Modified:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/FilesystemLocator.java
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/utils/LocatorUtils.java
cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java
cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/DefaultRepositoryTest.java
cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/FilesystemLocatorTest.java
cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/utils/FilesystemUtilsTest.java
Log:
- Integrate Logging facade that enables plugging-in any logging framework from
clients using this library
- commons transaction logging facade impl that redirects the logging messages into
cocoon block deployer logging facade
- some javadocs
- tweaking some unit tests
Modified: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java
==============================================================================
--- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java (original)
+++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocator.java Wed Oct 13 23:36:54 2004
@@ -21,7 +21,6 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
-import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -29,9 +28,11 @@
import org.apache.cocoon.blockdeployer.block.descriptor.BlockDescriptor;
import org.apache.cocoon.blockdeployer.locking.Lock;
import org.apache.cocoon.blockdeployer.locking.LockingException;
+import org.apache.cocoon.blockdeployer.logging.LoggerFacade;
import org.apache.cocoon.blockdeployer.repository.Deployable;
import org.apache.cocoon.blockdeployer.repository.Locator;
import org.apache.cocoon.blockdeployer.repository.Lockable;
+import org.apache.cocoon.blockdeployer.utils.CommonsTransactionLogger;
import org.apache.cocoon.blockdeployer.utils.LocatorUtils;
import org.apache.cocoon.blockdeployer.wiring.WiredRealBlockDescriptor;
import org.apache.cocoon.blockdeployer.wiring.Wiring;
@@ -39,8 +40,6 @@
import org.apache.commons.transaction.file.ResourceManagerException;
import org.apache.commons.transaction.file.ResourceManagerSystemException;
import org.apache.commons.transaction.util.FileHelper;
-import org.apache.commons.transaction.util.Jdk14Logger;
-import org.apache.commons.transaction.util.LoggerFacade;
/**
* The <code>ApplicationServerLocator</code> points to a Cocoon server that
@@ -52,6 +51,7 @@
private File basedir;
private Wiring wiring;
+ private LoggerFacade logger;
/**
* Provide the basedir and the wiring.
@@ -63,7 +63,10 @@
* is the
* @link Wiring (representing wiring.xml) of a Cocoon server
*/
- public ApplicationServerLocator(File basedir, Wiring wiring) {
+ public ApplicationServerLocator(File basedir, Wiring wiring, LoggerFacade logger ) {
+ if( logger == null) {
+ throw new NullPointerException("You have to set a logger!");
+ }
if (!basedir.exists()) {
throw new IllegalArgumentException(
"The specified directory is not available!");
@@ -77,12 +80,12 @@
throw new IllegalArgumentException(
"The specified base dir is not writeable!");
}
-
if (wiring == null) {
throw new NullPointerException("The wiring mustn't be null!");
}
this.basedir = basedir;
this.wiring = wiring;
+ this.logger = logger;
}
public RemoteBlock getRemoteBlock(String blockUri) {
@@ -108,22 +111,26 @@
FileHelper.removeRec(new File(workDir));
new File(workDir).mkdirs();
- // initialize the logger
- // FIXME integrate this in global logging and remove dependency on JDK1.4 by using Log4J
- Logger logger = Logger.getLogger(ApplicationServerLocator.class
- .getName());
- LoggerFacade sLogger = new Jdk14Logger(logger);
-
+ // initialize the logger by using a implementation delegating all logging infos of
+ // Commons transactions to BlockDeployer LoggingFacade
+ org.apache.commons.transaction.util.LoggerFacade ctLogger = new CommonsTransactionLogger(this.logger);
+
// start the file resource manager
+ if(this.logger.isDebugEnabled()) {
+ this.logger.debug(this.getClass(), "Initializing FileResourceManager - workdir:"
+ + workDir + ", store:" + this.basedir.getAbsolutePath());
+ }
FileResourceManager frm = new FileResourceManager(this.basedir
- .getAbsolutePath(), workDir, false, sLogger, true);
+ .getAbsolutePath(), workDir, false, ctLogger, true);
String txId = "deploy";
+ long startDeployment = System.currentTimeMillis();
try {
// start resource manager
frm.start();
// start file system transaction
frm.startTransaction(txId);
+ this.logger.info(this.getClass(), "Started FileResourceManager transaction \"" + txId + "\"");
// loop over all blocks and deploy them using the file resource
// manager
@@ -177,18 +184,19 @@
// write wiring
// commit transaction
- System.out.println("commit reached");
frm.commitTransaction(txId);
+ this.logger.debug(this.getClass(), "Deployment took " + (System.currentTimeMillis() - startDeployment) + "ms");
+ this.logger.info(this.getClass(), "Transaction \"" + txId + "\" has been committed");
} catch (Exception rme) {
try {
- System.out.println("rolled back");
frm.rollbackTransaction(txId);
+ this.logger.error(this.getClass(), "Transaction \"" + txId + "\" has been roled back: " + rme.getStackTrace());
return false;
} catch (ResourceManagerException rme1) {
- rme1.printStackTrace();
+ this.logger.error(this.getClass(), "While rolling back transaction \"" + txId + "\" an error occurred: " + rme1.getStackTrace());
}
// FIXME provide exception explanation
- throw new IOException("");
+ throw new IOException(this.getClass().getName() + ": While deploying the passed blocks an error occurred. Check the logs for details. " + rme.getClass());
} finally {
try {
frm.stop(FileResourceManager.SHUTDOWN_MODE_NORMAL);
@@ -207,7 +215,7 @@
} catch (MalformedURLException e) {
// if a MalformedURLException occurs this indicates a problem (maybe in the
// BlockFactory
- throw new IllegalStateException("The block doesn't have a valid ID.");
+ throw new IllegalStateException(this.getClass().getName() + ": The block doesn't have a valid ID.");
}
}
Modified: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/FilesystemLocator.java
==============================================================================
--- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/FilesystemLocator.java (original)
+++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/repository/FilesystemLocator.java Wed Oct 13 23:36:54 2004
@@ -25,6 +25,7 @@
import org.apache.cocoon.blockdeployer.block.RemoteBlock;
import org.apache.cocoon.blockdeployer.block.RemoteBlockFactory;
+import org.apache.cocoon.blockdeployer.logging.LoggerFacade;
import org.apache.cocoon.blockdeployer.utils.LocatorUtils;
/**
@@ -33,15 +34,21 @@
public class FilesystemLocator implements Locator {
private File basedir;
+ private LoggerFacade logger;
- public FilesystemLocator(File basedir) {
- this.basedir = basedir;
+ public FilesystemLocator(File basedir, LoggerFacade logger) {
if(!basedir.exists()) {
throw new IllegalArgumentException("The specified directory is not available!");
}
if(!basedir.isDirectory()) {
throw new IllegalArgumentException("The specified base for this locator is not a directory!");
- }
+ }
+ if(logger == null) {
+ throw new NullPointerException("Please set a Logger implementing the interface " + LoggerFacade.class.getClass().getName() + ".");
+ }
+ this.basedir = basedir;
+ this.logger = logger;
+ this.logger.debug(this.getClass(), "Created FileSystemLocator, basedir: " + this.basedir.getAbsolutePath());
}
public String getIdentifier() {
@@ -57,14 +64,20 @@
}
protected InputStream getBlockDescriptorAsStream(String blockUri) throws IOException, BlockNotFoundException {
+ this.logger.debug(this.getClass() + "getBlockDescriptorAsStream(" + blockUri + ") called");
File cobFile = null;
try {
cobFile = getBlockAsFile(blockUri);
+ if(this.logger.isDebugEnabled()) {
+ this.logger.debug(this.getClass(), "Found block (COB): " + cobFile.getAbsolutePath());
+ }
} catch(FileNotFoundException fnfe) {
- throw new BlockNotFoundException("Block " + blockUri + " at locator " + this.getIdentifier() + " not available.");
+ String infoMsg = "Block " + blockUri + " at locator " + this.getIdentifier() + " not available.";
+ this.logger.info(this.getClass(), infoMsg);
+ throw new BlockNotFoundException(infoMsg);
}
InputStream descriptorInputStream = null;
- return LocatorUtils.getDescriptorInputStream(new ZipInputStream(new FileInputStream(cobFile)));
+ return LocatorUtils.getDescriptorInputStream(new ZipInputStream(new FileInputStream(cobFile)), this.logger);
}
protected File getBlockAsFile(String blockUri) throws FileNotFoundException {
Added: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/utils/CommonsTransactionLogger.java
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/utils/CommonsTransactionLogger.java Wed Oct 13 23:36:54 2004
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2004 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
+ *
+ * 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.cocoon.blockdeployer.utils;
+
+import org.apache.cocoon.blockdeployer.logging.LoggerFacade;
+
+/**
+ * @since 0.1
+ */
+public class CommonsTransactionLogger implements org.apache.commons.transaction.util.LoggerFacade{
+
+ private static final String PREFIX = "CommonsTransaction: ";
+ private LoggerFacade logger;
+
+ public CommonsTransactionLogger(LoggerFacade logger) {
+ this.logger = logger;
+ }
+
+ public org.apache.commons.transaction.util.LoggerFacade createLogger(String arg0) {
+ return new CommonsTransactionLogger(this.logger);
+ }
+
+ public void logInfo(String msg) {
+ this.logger.info(PREFIX + msg);
+ }
+
+ public void logFine(String msg) {
+ this.logger.debug(PREFIX + msg);
+ }
+
+ public boolean isFineEnabled() {
+ return this.logger.isDebugEnabled();
+ }
+
+ public void logFiner(String msg) {
+ this.logger.debug(PREFIX + msg);
+ }
+
+ public boolean isFinerEnabled() {
+ return this.logger.isDebugEnabled();
+ }
+
+ public void logFinest(String msg) {
+ this.logger.debug(PREFIX + msg);
+ }
+
+ public boolean isFinestEnabled() {
+ return this.logger.isDebugEnabled();
+ }
+
+ public void logWarning(String msg) {
+ this.logger.warn(PREFIX + msg);
+ }
+
+ public void logWarning(String msg, Throwable t) {
+ this.logger.warn(PREFIX + msg + ", " + t.getStackTrace().toString());
+ }
+
+ public void logSevere(String msg) {
+ this.logger.error(PREFIX + msg);
+ }
+
+ public void logSevere(String msg, Throwable t) {
+ this.logger.error(PREFIX + msg + ", " + t.getStackTrace().toString());
+ }
+}
Modified: cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/utils/LocatorUtils.java
==============================================================================
--- cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/utils/LocatorUtils.java (original)
+++ cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/utils/LocatorUtils.java Wed Oct 13 23:36:54 2004
@@ -25,6 +25,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import org.apache.cocoon.blockdeployer.logging.LoggerFacade;
import org.apache.cocoon.blockdeployer.repository.Locator;
/**
@@ -52,7 +53,7 @@
* @throws FileNotFoundException if the ZipInputStream doesn't contain block.xml
* @throws IOException if there is a problem while reading the input stream
*/
- public static InputStream getDescriptorInputStream(ZipInputStream cobStream)
+ public static InputStream getDescriptorInputStream(ZipInputStream cobStream, LoggerFacade logger)
throws IOException, FileNotFoundException {
boolean found = false;
@@ -71,7 +72,9 @@
} while (document != null && found == false);
if(found == false) {
- throw new FileNotFoundException("The ZIP file doesn't contain " + Locator.COB_INF_BLOCK_XML);
+ String debugMsg = "The ZIP file doesn't contain " + Locator.COB_INF_BLOCK_XML;
+ logger.debug(LocatorUtils.class, debugMsg);
+ throw new FileNotFoundException(debugMsg);
}
// now we will extract the document and write it into a byte array
Added: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/LogEnabledTestCase.java
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/LogEnabledTestCase.java Wed Oct 13 23:36:54 2004
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004 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
+ *
+ * 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.cocoon.blockdeployer;
+
+import org.apache.cocoon.blockdeployer.logging.ConsoleLogger;
+import org.apache.cocoon.blockdeployer.logging.LoggerFacade;
+import org.easymock.MockControl;
+
+import junit.framework.TestCase;
+
+/**
+ * @since 0.1
+ */
+public class LogEnabledTestCase extends TestCase {
+
+ protected LoggerFacade logger;
+ protected MockControl loggerControl;
+
+ public void setUp() {
+ this.loggerControl = MockControl.createNiceControl(LoggerFacade.class);
+ this.logger = (LoggerFacade) loggerControl.getMock();
+ this.logger = new ConsoleLogger();
+ }
+
+}
Modified: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java
==============================================================================
--- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java (original)
+++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/ApplicationServerLocatorTest.java Wed Oct 13 23:36:54 2004
@@ -20,16 +20,15 @@
import java.io.InputStream;
import org.apache.cocoon.blockdeployer.Constants;
+import org.apache.cocoon.blockdeployer.LogEnabledTestCase;
import org.apache.cocoon.blockdeployer.block.RemoteBlock;
import org.apache.cocoon.blockdeployer.wiring.Wiring;
import org.easymock.MockControl;
-import junit.framework.TestCase;
-
/**
* @since 0.1
*/
-public class ApplicationServerLocatorTest extends TestCase {
+public class ApplicationServerLocatorTest extends LogEnabledTestCase {
private static final String EXAMPLES_DIR = "build/junit/aslt";
@@ -49,7 +48,7 @@
Wiring wiring = (Wiring) blockControl.getMock();
// first hack to run the deploy method
- ApplicationServerLocator asl = new ApplicationServerLocator(new File(Constants.VALID_ASL_1), wiring);
+ ApplicationServerLocator asl = new ApplicationServerLocator(new File(Constants.VALID_ASL_1), wiring, this.logger);
RemoteBlock b[] = new RemoteBlock[1];
b[0] = createBlockMock(null);
asl.deploy(b);
Modified: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/DefaultRepositoryTest.java
==============================================================================
--- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/DefaultRepositoryTest.java (original)
+++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/DefaultRepositoryTest.java Wed Oct 13 23:36:54 2004
@@ -96,7 +96,6 @@
// test that myBlock3 is returned twice, having the locators locator2 and locator3
RemoteBlock[] resultRemoteBlock = defaultRepository.lookupBlock("myBlock3");
- System.out.println("test: " + resultRemoteBlock.toString());
assertEquals(resultRemoteBlock[0].getLocator().getIdentifier(), locator2Name);
assertEquals(resultRemoteBlock[1].getLocator().getIdentifier(), locator3Name);
assertEquals(resultRemoteBlock.length, 2);
Modified: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/FilesystemLocatorTest.java
==============================================================================
--- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/FilesystemLocatorTest.java (original)
+++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/repository/FilesystemLocatorTest.java Wed Oct 13 23:36:54 2004
@@ -22,22 +22,22 @@
import java.io.InputStream;
import java.util.zip.ZipInputStream;
-import junit.framework.TestCase;
-
import org.apache.cocoon.blockdeployer.Constants;
+import org.apache.cocoon.blockdeployer.LogEnabledTestCase;
import org.apache.cocoon.blockdeployer.block.RemoteBlock;
import org.apache.cocoon.blockdeployer.utils.LocatorUtils;
/**
* @since 0.1
*/
-public class FilesystemLocatorTest extends TestCase {
-
+public class FilesystemLocatorTest extends LogEnabledTestCase {
+
public final void testFilesystemLocator() throws Exception {
// this path is not available
try {
- Locator l = new FilesystemLocator(new File(Constants.AVAILABLE_INVALID_SAMPLE_BLOCKID));
+ this.loggerControl.replay();
+ Locator l = new FilesystemLocator(new File(Constants.AVAILABLE_INVALID_SAMPLE_BLOCKID), this.logger);
fail("The contructor of the FilesystemLocator has to check whether its base directory is available.");
} catch(IllegalArgumentException fnfe) {
}
@@ -46,7 +46,9 @@
// this path should be available
Locator filesystemLocator = null;
try {
- filesystemLocator = new FilesystemLocator(new File(Constants.VALID_LOCATION_1));
+ this.loggerControl.reset();
+ this.loggerControl.replay();
+ filesystemLocator = new FilesystemLocator(new File(Constants.VALID_LOCATION_1), this.logger);
} catch (IllegalArgumentException fnfe) {
fail("Testrepository is not found!" + fnfe.getLocalizedMessage());
}
@@ -78,7 +80,8 @@
Locator filesystemLocator = null;
try {
String rep = Constants.VALID_LOCATION_1;
- filesystemLocator = new FilesystemLocator(new File(rep));
+ this.loggerControl.replay();
+ filesystemLocator = new FilesystemLocator(new File(rep), this.logger);
} catch (IllegalArgumentException fnfe) {
fail("Test broken: Available Testrepository is not found!" + fnfe.getLocalizedMessage());
}
@@ -107,7 +110,7 @@
}
try {
- InputStream is = LocatorUtils.getDescriptorInputStream(zipStream);
+ InputStream is = LocatorUtils.getDescriptorInputStream(zipStream, this.logger);
} catch (Exception e) {
fail("The COB " + cobFile.getAbsolutePath() + " should contain " + Locator.COB_INF_BLOCK_XML +
" but it wasn't found. " + e.getMessage());
@@ -139,7 +142,7 @@
}
try {
- InputStream is = LocatorUtils.getDescriptorInputStream(zipStream);
+ InputStream is = LocatorUtils.getDescriptorInputStream(zipStream, this.logger);
fail("The COB " + cobFile.getAbsolutePath() + " doesn't contain the file " + cobFile.getAbsolutePath() + " and " +
"this method should raise an exeption");
} catch (Exception e) {
Modified: cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/utils/FilesystemUtilsTest.java
==============================================================================
--- cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/utils/FilesystemUtilsTest.java (original)
+++ cocoon/whiteboard/block-deployer/test/junit/org/apache/cocoon/blockdeployer/utils/FilesystemUtilsTest.java Wed Oct 13 23:36:54 2004
@@ -22,14 +22,14 @@
import java.util.zip.ZipInputStream;
import org.apache.cocoon.blockdeployer.Constants;
+import org.apache.cocoon.blockdeployer.LogEnabledTestCase;
import org.apache.cocoon.blockdeployer.repository.Locator;
-import junit.framework.TestCase;
-
/**
* @since 17.08.2004
*/
-public class FilesystemUtilsTest extends TestCase {
+public class FilesystemUtilsTest extends LogEnabledTestCase {
+
public final void testReadingDescriptor() {
File cobFile = new File(Constants.VALID_LOCATION_1 +
Constants.AVAILABLE_VALID_WEBMAIL1343_BLOCKPATH + "/" + Constants.AVAILABLE_VALID_WEBMAIL1343_BLOCKFILE);
@@ -42,7 +42,7 @@
}
try {
- InputStream is = LocatorUtils.getDescriptorInputStream(zipStream);
+ InputStream is = LocatorUtils.getDescriptorInputStream(zipStream, this.logger);
} catch (Exception e) {
fail("The COB " + cobFile.getAbsolutePath() + " should contain " + Locator.COB_INF_BLOCK_XML +
" but it wasn't found. " + e.getMessage());
@@ -74,7 +74,7 @@
}
try {
- InputStream is = LocatorUtils.getDescriptorInputStream(zipStream);
+ InputStream is = LocatorUtils.getDescriptorInputStream(zipStream, this.logger);
fail("The COB " + cobFile.getAbsolutePath() + " doesn't contain the file " + cobFile.getAbsolutePath() + " and " +
"this method should raise an exeption");
} catch (Exception e) {