Clara's Notes on Technology

Just a place to put down ideas and concepts on technology, mainly .NET, BizTalk, SQL Server, and other MSFT stuff.

Thursday, November 16, 2006

Creating the Team Portal before creating the Team Project

Is this possible? Yes.

Here is how I did it (I got the idea from here).

  1. Create a new process template that does not create a team portal (you just have to remove the portal plugin from the ProcessTemplate.xml). Like this (I removed reporting too):

    <?xml version="1.0" encoding="utf-8"?>
    <ProcessTemplate>
    <metadata>
    <name>Test3</name>
    <description>The only particularity of this template is that it does
    not create a team portal.</description>
    <plugins>
    <plugin name="Microsoft.ProjectCreationWizard.Classification"
    wizardPage="false" />
    <plugin name="Microsoft.ProjectCreationWizard.Groups"
    wizardPage="false" />
    <plugin name="Microsoft.ProjectCreationWizard.WorkItemTracking"
    wizardPage="false" />
    <plugin name="Microsoft.ProjectCreationWizard.VersionControl"
    wizardPage="true" />
    </plugins>
    </metadata>
    <groups>
    <group id="Classification" description="Structure definition for the
    project." completionMessage="Project Structure uploaded.">
    <dependencies />
    <taskList filename="Classification\classification.xml" />
    </group>
    <group id="Groups" description="Create Groups and assign Permissions."
    completionMessage="Groups created and Permissions assigned.">
    <dependencies>
    <dependency groupId="Classification" />
    </dependencies>
    <taskList filename="Groups and Permissions\GroupsandPermissions.xml" />
    </group>
    <group id="WorkItemTracking" description="Workitem definitions uploading."
    completionMessage="Workitem definitions uploaded.">
    <dependencies>
    <dependency groupId="Classification" />
    <dependency groupId="Groups" />
    </dependencies>
    <taskList filename="WorkItem Tracking\WorkItems.xml" />
    </group>
    <group id="VersionControl" description="Creating Version control."
    completionMessage="Version control task completed.">
    <dependencies>
    <dependency groupId="Classification" />
    <dependency groupId="Groups" />
    <dependency groupId="WorkItemTracking" />
    </dependencies>
    <taskList filename="Version Control\VersionControl.xml" />
    </group>
    </groups>
    </ProcessTemplate>


  2. Go to Sharepoint Administration
  3. Select Create a Top-Level Website
  4. Select Default Website
  5. Select Web Site Address and name it the same name as your project. The Url should be under sites like this: http://<spserver>/sites/<teamprojectname>
  6. From the Team Explorer create a project with the process template in (1).
  7. Once it is created, right click on it and choose "Show Project Portal". You should arrive at the site created in (5)!

The only hick to this is that you cannot change the Team Portal url. It has to follow the format given above.

Wednesday, November 08, 2006

Becoming an Architect?

I am hoping to becoming a software architect one day. My current job is quite mixed: I do presales, development, consultancy and architecture. The idea is that I become more of an architect with time.

At TechEd EMEA 2006 I have learned about Ron Jacobs. He is an architecture evangelist for Microsoft and a very good speaker. I've been browsing his websites (mainly www.ronjacobs.com and www.arcast.com) and I have found a lot of useful information about what is an architect.

It is great to learn all these things but, at the same time, I feel far from my goal! There is so much to learn :)

Some more info. This article is really interesting about what an architect is expected to do: http://blogs.msdn.com/ramkoth/archive/2006/03/13/550218.aspx (If I don't get it right I'm headed for the "Developer with a difference" profile)

Barcelona's Girl Geek Dinner

Yesterday was the Barcelona-TechEd Girl Geek Dinner. I didn't know what to expect and I enjoyed it, although I would have liked to network more. There were two reasons why I think I did not get to meet many girl geeks: 1) the dinner was seated so people did not really mix outside their table, 2) I brought one of my colleagues - he is a really nice guy but I did not feel completely at ease talking about how it is being the only girl in the office.

The speakers were great. Very inspirational (in fact, this has become my word for the TechEd: inspirational!). It is really encouraging to see women deeply involved in technology out there.

Sarah Blow asked them how they would define a geek. The definition I most identify with is that of "someone who is very curious, who wants to get to the bottom of things, who wants to understand" (I think it was from Catherine Heller from MSFT).

To sum up, two key phrases from the dinner, which I will try to rembember whenever in difficulty or doubt:


  • Just do it
  • Dare to be different

PS: Check out this website (when it is up!) http://www.evetech.com

Sunday, November 05, 2006

From NUnit to Team System

Another chapter on my experience helping a client adopt Team System.

This time, the goal was to convert their NUnit test to Team System tests. This is not a very difficult topic given the great conversion tool available on gotdotnet (here), which basically does all the work for you. However, I did stumble upon a few issues. Before going into that, this is the basic procedure I followed (fortunately, NUnit tests were already placed in a single project (*.Test)):

a. Create a new test project (named *.Test.TS)
b. Create the necessary project folders
c. Add the necessary references
d. Copy *.cs files from *.Test project to *.Test.TS
e. Set project properties if necessary (build location, postbuild events, etc.)
f. Build
g. Perform a test run with NUnit to check everything is green
h. Run the NUnit Converter
i. Remove Nunit references and build again
j. Run tests in TS and check results with corresponding run in Nunit (g)
k. Commit pending changes

When the test project is created, a .vsmdi and a .testrunconfig file are also created and added to the soluiton folder. If new tests are added to the solution, the vsmdi file will need to be checked out. To see all the tests available for the solution, open .vsmdi file (it offers a list view of the test which can be sorted and grouped -- n.b. the possibility of grouping tests into lists is only available if you have VS Team Edition for Testers).

When converting a large project (about 2000 tests), I had to get around the following issues:

1. Category Attribute

Categories do not exist in Team System. The alternative is to use Description attribute or lists (lists are only available in the Tester edition). The converter tool reacts as follows when finding a Category attribute:


  • If just one category on a test method, conversion was as follows: [Test, Category("sample")] --> [TestMethod(), TestProperty("Category", "sample")]


  • If just one category on a class, conversion was as follows: [TestFixture, Category("sample")] --> //Category: "sample"


  • If more than one category attribute, conversion did not occur and NUnit conversion tool stops. My solution here was pretty basic: manual replacement (I used TextPad as editor)

  • Replace Category("\(.+\)"),Category("\(.+\)")\] by Category("\1")]\n[TestProperty("Category","\2")\]


    For instance: [Test, Category("Business"), Category("More Business")] becomes [Test, Category("Business")] [TestProperty("Category","More Business")]


    Notice that this is just a temporary solution to get the converter tool to run until the end. The final conversion gives this [TestMethod(), TestProperty("Category","Business")] [TestProperty("Category","More Business")] which is not correct because the same property is used twice with different values. The second property should be changed to TestProperty("Category2","More
    Business")
    , for example (or use Description attribute instead).


2. Partial Classes

Partial classes are not converted because they do not have the TestFixture attribute. You need to add it in order for the conversion to run, but afterwards remvoe the
corresponding TestClass attribute (because it is a duplicate given that the class was partial).


3. Static Methods.

Due to the TestFixtureSetUp conversion to ClassInitialize(), some methods had to be converted to static. Also, since the initialize method is now static, it cannot be overriden
anymore, but it doesn't really matter because of point 4.

Let me explain. The initial scenario was as follows: you have a set of test classes that inherit from a parent class. This parent class contains a test set up method used by almost all children. Those that need some extra/different initialization override the method. Like this:


[TestFixture]
public class BaseTest
{
[TestFixtureSetUp]
public virtual void InitializeTests()
{
// do some initialization
}
}

[TestFixture]
public class MyTest1 : BaseTest
{
[Test]
public voic SomeTest
{
base.InitializeTests();
// do other things
}
}

[TestFixture]
public class MyTest2 : BaseTest
{
[Test]
public voic SomeOtherTest
{
base.InitializeTests();
// do other things
}

public override void InitializeTests()
{
// do some other initialization
}
}


This scenario does not work anymore in Team System because of points
3 and 4 (initialize methods are static and inheritance is not supported.

4. Inheritance is not supported in Team System unit tests.

Yes, that is disappointing. This explains why the [TestFixtureSetUp] methods in a parent classes is not called. In Team System testing framework there are 3 attributes to initialize/clean up tests:


  • TestInitialize/CleanUp

  • ClassInitialize/Cleanup. It replaces your TestFixtureSetUp/TearDown but remember that inheritance is not supported.

  • AssemblyInitialize/Cleanup It runs once at the start of each method in the assembly.

You should use these attributes. My recommended solution is to replace the TestFixtureSetUp attributes (converted to ClassInitialize()) in a parent class by AssemblyInitialize and reorganize tests so that all tests needing this particular initialization are in this assembly.

Given the example above, this means removing inheritance, adding an AssemblyInitialize on the InitializeTests method, and moving the MyTest2 class to another assembly (if you do not want it to use the InitializeTests at all) or adding a TestInitialize method to MyTest2.InitializeTests (if you want to add some extra initialization specific to SomeOtherTest).

5. Missing TestFixture attribute

If a class does not have the [TestFixture] attribute, it is not converted (even if it contains test methods).

Friday, October 27, 2006

Girl Geek

While browsing the Tech-Ed 2006, I have found about Girly Geekdom, a blog hold by Sarah Blow to provide information and organize events on girl in IT. They are organizing a dinner at Tech-Ed and I will probably be joining them.

It is really exciting to find out there are people out there like me! I really like my job and I think I am not too bad at it, but sometimes feel lonely or freaky. Also, I've been thinking for a while about organizing some sort of community of Girls in Technology but then realize I don't know any other women in IT :(

The list of attendees at the Geek Girl Dinner at Barcelona contains some Spanish names, so it will be an opportunity to meet real "peers": female, geek and Spanish!

BTW, I found this post from Sarah Blow really funny too: 10 reasons for Girl Geeks to go to Conferences and 10 reasons why thy don't

Thursday, October 05, 2006

VSTS builds

For the last few months I have been helping a client adopt Team System - Team Foundation Server. Since these tools are quite new, I will try to keep a log of what I have done.

Builds: from MSBuild to TFSBuild

The starting situation is an MSBuild script customized for a given team's needs. The default target can execute the following procedure:
  1. Delete network share
  2. Backup latest build
  3. Clean
  4. Get latest from source control
  5. Increase version and add label in source control if building in Release mode
  6. Build
  7. Run NUnit tests
  8. Run FxCop analysis
  9. Run WiX (create msi)
  10. Run NDoc (generate documentation)
  11. Create network share
  12. Drop build output in network share

This script was used both as enterprise build and as developer build by setting different property values. For example, when being run by a developer it would not run the test or the static analysis and it would not increase the version number or set a label in source control.

My proposal consists in the following creating a build type that peforms all the tasks above. Points 1-6 and 11-12 are alreayd done by default by tfsbuild. The network share is in the build drop location, sources are obtained from TFS and copied locally to the build server, a label with the build name is applied automatically, etc. Admittedly, you might want to customize the build number but I will talk about this later.

As for the other points, this is what I suggested:

7- Ideally, move to TS tests and forget about NUnit. In the meanterm, I created a "NUnit" target that runs the test (in fact, I could basically copy/paste the target from the original script).

8- FxCop target is no longer needed since static analysis is integrated in team system and thus in build types (you can indicate it in the build type wizard). For the enterprise build I would set static analysis to "always".

9- I integrated it as a new target in TFSBuild.proj (could be reused almost "as is").

10- Same as 9. Create a specific target for it.


So now I have created 3 new targets in TFSBuild.proj: NUnit, WiX, NDoc. Since I want to run them after compilining I defined them as dependencies of the "AfterCompile" target, like this:

<target name="AfterCompile" dependsontargets="NUnit;WiX;NDoc">

<message text="AfterCompile target executed.">
</message></target>

I have also set a condition on each of the new targets, so that they can be turned on/off at will:


<RunUnitTests>false</RunUnitTests>
...
<Target Name="NUnit" Condition="'$(RunUnitTests)'=='true'">
...
</Target>

My current problem is that I would like to turn on/off these options without having to change the TFSBuild.proj. This way we would have a script (TFSBuild.proj) with all the default values for the options that could be run from the team explorer. If we want to run the tf build with other options, I would like to be able to do it with the command line (tfsbuild.exe tool). But that does not seem to be possible.


It is possible to override the options values if you execute the TFSBuild.proj script from MSBuild.exe, but then you lose the advantages of TF builds (build server, drop locations, automatic get and label, etc.). In fact I am using MSBuild.exe to run TFSBuild.proj for developer builds as described here.


Tuesday, September 05, 2006

SSL & WS-Security

SSL (Secure Sockets Layer) = cryptographic protocol which provides secure communications on the Internet (application layer) [TSL (Transport Layer Security) = SSL successor. SSL 3.0 and TSL 1.0 remain substantially the same]

HTTPS = HTTP over SSL
HTTPS = URI Scheme indicating that HTTP is to be used but with a different default port (443) and an additional encryption/authentication layer between HTTP and TCP (SSL). Uses SSL as a sub-layer under the regular HTTP application layer and uses port 443 in its interactions with lower layer.

It only protects the data between the client and the server (not on the server itself).

HTTPS supports the use of X.509 digital certificates from the server so that a user can authenticate the server.
  • 1-way SSL (server certificate): Only the server uses a certificate, i.e. server authentication but no client authentication.

  • 2-way SSL (client & server certificate): Authentication of both.
How does SSL work (taken from here)?
  1. The browser requests secure page (https:// ...)
  2. The web server sends its public key with its certificate
  3. The browser checks that the certificate was issued by a trusted third party (CA), that the certificate is valid and that the certificate is related to the site contacted.
  4. The browser then uses the public key to encrypt a random symmetric encryption key and sends it to the server with the encrypted URL required as well as other encrypted http data.
  5. The web server decrypts the symmetric encryption key using its private key and uses the symmetric key to decrypt the URL and the http data.
  6. The browser decrypts the http data and html document using the symmetric key and displays the information.

WS-Security= WSS = Defines how XML security specificatons are used to encrypt and sign tokens contained in SOAP messages. It provides a level of abstraction to communicate securely using SOAP by

  • defining element names for packaging security tokens in SOAP messages [token = an XML representation of security inforation - signed or unsigned]
  • providing a conceptual model [concept of "claims" and "tokens", claim = statement about a subject]

WS-Security is situated above SOAP because it provides a means of encrypting and signing portions of SOAP messages, using XML Signature & XML Encryption, and for enclosing security tokens in a SOAP message to represent claims.

Differences between SSL and WS-Security: here. I'll do a recap:

  • SSL is easier to implement.
  • SSL encrypts at transport level; WS-Security encrypts at message level.
  • SSL provides in-transit security only. This means that the request is only encrypted while it is travelling from client to server (or back). If there is a proxy server in front of the web server, the request is decrypted as it reaches it, thus travelling inside the server in undecrypted mode. WS-Security maintains the encryption until the moment when the request is processed.
  • Targeted security. SSL secures entire message, with WS-Security we can choose to encrypt only part of a message.

VSTS testing framework

I have recently received an inquiry from a client that wants to migrate his NUnit test to VSTS. They had heard that VSTS unit tests performed worse than NUnit.

My answer (some info comes from MSFT)


  • It is true that running a set of empty tests unsing NUnit is faster than running them using VSTS (about 20% faster), but if these tests are not empty and have something in them, then this difference reduces.

  • Performance using VSTS will be best if you run the test from the command line and using the /noisolation option (MSTest.exe) [When VSTS tests are executed on the IDE, each one runs on its own process, so that if a test crashes, the whole environment does not crash too. Obviously, there is a performance tradeoff. You can avoid this tradeoff by running them on the command line and specifying "no isolation".]

  • They are working on performance for the next version and doing good progress.

I have also found a couple of old (beta) bugs regarding unit testing and performance but these should be ok in the RTM vesion that you have:

There is also an open bug on web testing eating too many resources (but I don't think you have this kind of tests)

Tuesday, April 11, 2006

Access is denied to AIC

Event Type: Error
Event Source: BizTalk Server
Event Category: Document Processing
Event ID: 324
Date: 4/11/2006
Time: 9:48:17 AM
User: N/A
Computer: BE-TCN-TEST
Description:An error occurred in BizTalk Server.
Details: ------------------------------ [0x0154] This server could not create a component with the class ID "{1C7F70A8-15F6-4699-9AD0-115C6A974D7D}" for transport. Verify that this component is properly registered. The following error was returned:
[0x80070005] Access is denied.
[0x0156] The server could not finish processing messaging port "MS2TCN2AIC".
[0x1730] Suspended Queue ID: "{1785B9E0-212A-448D-BD76-5EDF3C2F5A43}"
[0x80070005] Access is denied.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.


--> The AICs are not properly registerd in COM.