Pages

Subscribe:

Ads 468x60px

Monday, December 21, 2015

WSO2 Carbon Kernel 5.0.0 - Released !!!

We are pleased to announce the release of WSO2 Carbon Kernel 5.0.0. It is now available to download from here. The source and tag location for this release are available here.

WSO2 Carbon Kernel 5.0.0 is the core of the next-generation WSO2 Carbon platform. We have completely rearchitected Carbon Kernel from the ground up with the latest technologies and patterns. Additionally, the Carbon Kernel is now a lightweight, general-purpose OSGi runtime specializing in hosting servers, providing key functionality for server developers. The result is a streamlined and even more powerful middleware platform than ever before.
This release of the WSO2 Carbon Kernel includes the following key features. For further details please see the documentation.

Key Features
  •     Transport Management Framework
  •     Logging Framework with Log4j 2.0 as the Backend
  •     Carbon Startup Order Resolver
  •     Dropins Support for OSGi Ready Bundles
  •     Jar to Bundle Conversion Tool
  •     Artifact Deployment Engine
  •     Pluggable Runtime Support

Fixed Issues :  WSO2 Carbon Kernel 5.0.0 - Fixed Issues
Known Issues : WSO2 Carbon Kernel 5.0.0 - Known Issues

How To Contribute

You can find more instructions on how to contribute on our documentation site.

If you have any suggestions or are interested in Carbon Kernel 5.0.0 discussions, you can join the dev@wso2.org or architecture@wso2.org mailing lists.
Reporting Issues

We encourage you to report issues, documentation errors regarding WSO2 Carbon Kernel 5.0.0 through the public issue tracking system.

Thanks,

WSO2 Carbon Team

Saturday, October 17, 2015

WSO2 Carbon Kernel 5.0.0 - Milestone 05 Released!


We are pleased to inform you the 5th milestone release of Carbon Kernel 5.0.0 is now available to download from here. Source and Tag Location for this release is available here.

Carbon 5 [C5] is the next generation of WSO2 Carbon platform. The existing Carbon platform has served as a modular middleware platform for more than 5 years now. We've built many different products, solutions based on this platform. All the previous major releases of Carbon were sharing the same high level architecture, even though we've changed certain things time to time.

Base architecture of the Carbon is modeled using the Apache Axis2's kernel architecture. Apache Axis2 is Web service engine. But it also has introduced a rich extensible server framework with a configuration and runtime model, deployment engine and a implementation, etc. We extended this architecture and built a OSGI based modular server development framework called Carbon Kernel. It is tightly coupled with Apache Axis2. But now Apache Axis2 is becoming a dead project. We don't see enough active development on the trunk. Therefore we thought of getting rid of this tight coupling to Apache Axis2.

Carbon kernel has gained weight over the time. There are many unwanted modules there. When there are more modules, the rate of patching or the rate of doing patch releases increases. This is why we had to release many patch releases of Carbon kernel in the past. This can become a maintenance nightmare for developers as well as for the users. We need to minimize Carbon kernel releases.

The other reason for C5 is to make Carbon kernel a general purpose OSGi runtime, specialized in hosting servers. We will implement the bare minimal features required for server developers in the Carbon kernel.

Our primary goal of C5 is to re-architect the Carbon platform from the ground up with the latest technologies and patterns to overcome the existing architectural limitations as well as to get rid of the dependencies to the legacy technologies like Apache Axis2. We need to build a next generation middleware platform that will last for the next 10 years.

This milestone release is a step towards building an OSGi based server development framework. It includes following new features.

New Features
  • Pax Exam OSGi Test Framework Support
  • Logging framework backend upgraded to log4j 2.0 support
Key Features
  • Pluggable runtimes framework
  • Artifact deployment engine
  • Centralized logging back-end
  • Carbon launcher framework
  • Transport Management Framework
  • Java 8 Support

Documentation

Fixed Issues

How To Contribute

You can find more instructions on how to contribute on our documentation site.
If you have any suggestions or interested in C5 discussions, please do so via dev@wso2.org or architecture@wso2.org mailing lists .

Reporting Issues

Carbon Kernel development is at it's early stages, We encourage you to report issues, documentation faults that you come across and feature requests 
regarding this milestone release of WSO2 C5 through the public issue tracking system.


Thanks,
WSO2 Carbon Team

Thursday, October 15, 2015

OSGi Unit Test Framework for Carbon 5


Introduction
In the current carbon kernel there is no way to write test cases in order to test the OSGi services and functions. This is purely because of the bundles needs to be installed and run on a OSGi  container. Pax- Exam [1] framework provides the underneath infrastructure to compose unit test cases which needs to be run.

How Pax-Exam Works
Pax exam starts up the OSGi framework, (which is equinox for the carbon kernel), with minimum level of bundles which is necessary for the pax-exam operations. Then the Pax Exam user can provision their bundles to the OSGi container. Refer [2] for the provisioned bundles list [2]. This way when the Pax-Exam boots up these provisioned bundles will be installed to the container

How to write Unit test case

Now the Pax-Exam have booted up the OSGi framework with the necessary bundles for your test environment. You have to use the  @RunWith(PaxExam.class) annotation to hook Pax Exam into Testng and let it do its magic of setting up a test container with an OSGi framework and your bundles to run the tests.

[3] is a sample test case added. In the sample you can see that it is very similar to a normal testng test case and containing some annotations which relates to pax-exam.

Using Dependency Injection your test method can access the BundleContext of the probe bundle or any service obtained from the OSGi service registry.

    @Inject
    private BundleContext bundleContext;


or else you can directly access the OSGi services using the following

    @Inject
    private SomeSampleOsgiService service;


If you need any special bundles other than defined in [2], you can always override the config method in your test case class. But make sure that testng bundle must be installed.

@Configuration
    public Option[] config() {
        return options(
mavenBundle().artifactId("testng").groupId("org.testng").versionAsInProject(),
            mavenBundle("sample", "org.wso2.carbon", "1.0.0-SNAPSHOT")
            );
    }

[1].https://ops4j1.jira.com/wiki/display/PAXEXAM4/Getting+Started+with+OSGi+Tests
[2].https://github.com/wso2/carbon4-kernel/blob/c5-pax-exam-work/tests/osgi-tests/src/test/java/org/wso2/carbon/osgi/config/CarbonOSGiConfiguration.java


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright 2015 WSO2, Inc. http://www.wso2.org
 *
 * 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.wso2.carbon.osgi;

import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
import org.ops4j.pax.exam.testng.listener.PaxExam;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.testng.Assert;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;

import javax.inject.Inject;

/**
 * Base OSGi class to test the OSGi status of the org.wso2.carbon.core bundle
 */
@Listeners(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class BaseOSGiTest {

    @Inject
    private BundleContext bundleContext;

    @Test
    public void testBundleContextStatus() {
        Assert.assertNotNull(bundleContext, "Bundle Context is null");
    }

    @Test
    public void testCarbonCoreBundleStatus() {

        Bundle coreBundle = null;
        for (Bundle bundle : bundleContext.getBundles()) {
            if (bundle.getSymbolicName().equals("org.wso2.carbon.core")) {
                coreBundle = bundle;
                break;
            }
        }
        Assert.assertNotNull(coreBundle, "Carbon Core bundle not found");
        Assert.assertEquals(coreBundle.getState(), Bundle.ACTIVE, "Carbon Core Bundle is not activated");
    }
}



Tuesday, August 11, 2015

[WSO2] Adding tenants using Admin Services - Sample Code

Adding tenants using admin services is straight forward. You have to use two admin services.

1. AuthenticationAdminService
2. TenantMgtAdminService

The  AuthenticationAdminService is used to authenticate the user and get the session. Below is a sample code for adding a tenant

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
public class TenantMgtAdmin {
    private static final String AS_URL = "https://localhost:9443/services/";

    public static void addTenant(String cookie) throws Exception {

        TenantMgtAdminServiceStub tenantMgtStub = null;
        String tenantMgtEndpoint = AS_URL + "TenantMgtAdminService";

        tenantMgtStub = new TenantMgtAdminServiceStub(tenantMgtEndpoint);
        Options option = tenantMgtStub._getServiceClient().getOptions();
        option.setManageSession(true);
        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);

        String value = tenantMgtStub.addTenant(getTenantBean());

        System.out.println("Returned Value ::" + value);
    }

    private static TenantInfoBean getTenantBean() {

        TenantInfoBean bean = new TenantInfoBean();
        bean.setActive(true);
        bean.setAdmin("sample");
        bean.setAdminPassword("sample");
        bean.setEmail("sample@sample.com");
        bean.setFirstname("FirstName");
        bean.setLastname("LastName");
        bean.setTenantDomain("sample.com");
        return bean;
    }

The github url for the project. https://github.com/arunasujith/tenant-sample