phonebookengines/contactsmodel/tsrc/Integration/TestImpExvCard/src/TestImpExvCardSuiteServer.cpp
changeset 0 e686773b3f54
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookengines/contactsmodel/tsrc/Integration/TestImpExvCard/src/TestImpExvCardSuiteServer.cpp	Tue Feb 02 10:12:17 2010 +0200
@@ -0,0 +1,192 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "TestImpExvCardSuiteServer.h"
+#include "TestImpRevLocalTZ.h"
+#include "TestImpRevLocal.h"
+#include "TestImpNoRev.h"
+#include "TestImpRevUTC.h"
+#include "TestImpBDay.h"
+#include "TestImpNoBDay.h"
+#include "TestImpOOM.h"
+#include "TestExRevUTC.h"
+#include "TestExBDayLocal.h"
+#include "TestExNoBDay.h"
+#include "TestImpExvCardSuiteDefs.h"
+#include "TestExportContactStep.h"
+#include "TestImportContactInsertModeStep.h"
+#include "TestImportContactMergeModeStep.h"
+#include "TestContactsPBAPExport.h"
+#include "TestCompareCntFiles.h"
+#include "TestContactOperations.h"
+#include "TestContactsPBAPExportPerformance.h"
+#include "TestContactsPBAPExportContents.h"
+#include "TestGenericImportStep.h"
+
+_LIT(KServerName,"TestImpExvCardSuite");
+CTestImpExvCardSuite* CTestImpExvCardSuite::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+	{
+	CTestImpExvCardSuite * server = new (ELeave) CTestImpExvCardSuite();
+	CleanupStack::PushL(server);
+	// CServer base class call which can be either StartL or ConstructL,
+	// the later will permit Server Logging.
+
+	server->StartL(KServerName);
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+// Secure variants much simpler
+// For EKA2, just an E32Main and a MainL()
+LOCAL_C void MainL()
+/**
+ * Secure variant
+ * Much simpler, uses the new Rendezvous() call to sync with the client
+ */
+	{
+	// Leave the hooks in for platform security
+#if (defined __DATA_CAGING__)
+	RProcess().DataCaging(RProcess::EDataCagingOn);
+	RProcess().DataCaging(RProcess::ESecureApiOn);
+#endif
+	CActiveScheduler* sched = NULL;
+	sched = new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CTestImpExvCardSuite* server = NULL;
+	// Create the CTestServer derived server
+	TRAPD(err,server = CTestImpExvCardSuite::NewL());
+	if(!err)
+		{
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+
+	delete server;
+	delete sched;
+	}
+
+GLDEF_C TInt E32Main()
+/**
+ * @return - Standard Epoc error code on process exit
+ * Secure variant only
+ * Process entry point. Called by client using RProcess API
+ */
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
+
+CTestStep* CTestImpExvCardSuite::CreateTestStep(const TDesC& aStepName)
+/**
+ * @return - A CTestStep derived instance
+ * Secure and non-secure variants
+ * Implementation of CTestServer pure virtual
+ */
+	{
+	CTestStep* testStep = NULL;
+	// They are created "just in time" when the worker thread is created
+	// More test steps can be added below
+              if(aStepName == KTestImpRevLocalTZ)
+              	{
+              	testStep = new CTestImpRevLocalTZ();
+              	}
+              else if (aStepName == KTestImpRevLocal)
+	              	   {
+              		   testStep = new CTestImpRevLocal();
+              		   }
+              else if (aStepName == KTestImpNoRev)
+	              	   {
+              		   testStep = new CTestImpNoRev();
+              		   }
+              else if (aStepName == KTestImpRevUTC)
+	              	   {
+              		   testStep = new CTestImpRevUTC();
+              		   }
+              else if (aStepName == KTestImpBDay)
+	              	   {
+              		   testStep = new CTestImpBDay();
+              		   }
+              else if (aStepName == KTestImpNoBDay)
+	              	   {
+              		   testStep = new CTestImpNoBDay();
+              		   }
+              else if (aStepName == KTestExRevUTC)
+	              	   {
+              		   testStep = new CTestExRevUTC();
+              		   }
+              else if (aStepName == KTestExBDayLocal)
+	              	   {
+              		   testStep = new CTestExBDayLocal();
+              		   }
+              else if (aStepName == KTestExNoBDay)
+	              	   {
+              		   testStep = new CTestExNoBDay();
+              		   }
+              else if (aStepName == KTestExportContactStep)
+	              	   {
+              		   testStep = new CTestExportContactStep();
+              		   }
+              else if (aStepName == KTestImportContactInsertModeStep)
+	              	   {
+              		   testStep = new CTestImportContactInsertModeStep();
+              		   }
+              else if (aStepName == KTestImportContactMergeModeStep)
+	              	   {
+              		   testStep = new CTestImportContactMergeModeStep();
+              		   }
+              else if (aStepName == KTestImpOOM)
+	              	   {
+              		   testStep = new CTestImpOOM();
+              		   }
+              else if (aStepName == KTestGenericImportStep)
+	              	   {
+              		   testStep = new CTestGenericImportStep();
+              		   }
+              else if (aStepName == KTestContactsPBAPExport)
+	              	   {
+              		   testStep = new CTestContactsPBAPExport();
+              		   }
+              else if (aStepName == KTestCompareCntFiles)
+	              	   {
+              		   testStep = new CTestCompareCntFiles();
+              		   }
+              else if (aStepName == KTestContactOperations)
+	              	   {
+              		   testStep = new CTestContactOperations();
+              		   }
+              else if (aStepName == KTestContactsPBAPExportContents)
+	              	   {
+              		   testStep = new CTestContactsPBAPExportContents();
+              		   }
+              else if (aStepName == KTestContactsPBAPExportPerformance)
+	              	   {
+              		   testStep = new CTestContactsPBAPExportPerformance();
+              		   }
+	return testStep;
+	}