Package org.rhq.enterprise.server.content

Examples of org.rhq.enterprise.server.content.ContentManagerBean


        when(mockResultSet.getBlob(anyInt())).thenReturn(mockBlob);
        OutputStream mockOutputStream = mock(OutputStream.class);
        when(mockBlob.setBinaryStream(anyLong())).thenReturn(mockOutputStream);

        //create object to test and inject required dependencies
        ContentManagerBean objectUnderTest = new ContentManagerBean();
        Field[] fields = ContentManagerBean.class.getDeclaredFields();

        for (Field field : fields) {
            if (field.getName().equals("entityManager")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockEntityManager);
                field.setAccessible(false);
            }
            else if (field.getName().equals("contentManager")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockContentManager);
                field.setAccessible(false);
            }
            else if (field.getName().equals("dataSource")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockDataSource);
                field.setAccessible(false);
            }
        }

        //run the code to be tested
        PackageVersion result = objectUnderTest.createPackageVersionWithDisplayVersion(mockSubject, packageName,
            packageTypeID, version, displayVersion, architectureId, packageBitStream);

        //verify the results (Assert and Mock Verification)
        verify(mockList, times(2)).size();
        verify(mockList, never()).get(anyInt());
View Full Code Here


        when(mockList.size()).thenReturn(1);
        PackageVersion mockPackageVersion = mock(PackageVersion.class);
        when(mockList.get(eq(0))).thenReturn(mockPackageVersion);

        //create object to test and inject required dependencies
        ContentManagerBean objectUnderTest = new ContentManagerBean();
        Field[] fields = ContentManagerBean.class.getDeclaredFields();

        for (Field field : fields) {
            if (field.getName().equals("entityManager")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockEntityManager);
                field.setAccessible(false);
            }
        }

        //run the code to be tested
        PackageVersion result = objectUnderTest.createPackageVersionWithDisplayVersion(mockSubject, packageName,
            packageTypeID, version, displayVersion, architectureId, packageBitStream);

        //verify the results (Assert and Mock Verification)
        verify(mockList, times(1)).size();
        verify(mockList, times(1)).get(eq(0));
View Full Code Here

        when(mockList.size()).thenReturn(1);
        PackageVersion mockPackageVersion = mock(PackageVersion.class);
        when(mockList.get(eq(0))).thenReturn(mockPackageVersion);

        //create object to test and inject required dependencies
        ContentManagerBean objectUnderTest = new ContentManagerBean();
        Field[] fields = ContentManagerBean.class.getDeclaredFields();

        for (Field field : fields) {
            if (field.getName().equals("entityManager")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockEntityManager);
                field.setAccessible(false);
            }
        }

        //run the code to be tested
        PackageVersion result = objectUnderTest.createPackageVersionWithDisplayVersion(mockSubject, packageName,
            packageTypeID, version, displayVersion, architectureId, packageBitStream);

        //verify the results (Assert and Mock Verification)
        verify(mockList, times(1)).size();
        verify(mockList, times(1)).get(eq(0));
View Full Code Here

        when(mockList.size()).thenReturn(2);
        PackageVersion mockPackageVersion = mock(PackageVersion.class);
        when(mockList.get(eq(0))).thenReturn(mockPackageVersion);

        //create object to test and inject required dependencies
        ContentManagerBean objectUnderTest = new ContentManagerBean();
        Field[] fields = ContentManagerBean.class.getDeclaredFields();

        for (Field field : fields) {
            if (field.getName().equals("entityManager")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockEntityManager);
                field.setAccessible(false);
            }
        }

        //run the code to be tested
        PackageVersion result = objectUnderTest.createPackageVersionWithDisplayVersion(mockSubject, packageName,
            packageTypeID, version, displayVersion, architectureId, packageBitStream);

        //verify the results (Assert and Mock Verification)
        verify(mockList, times(1)).size();
        verify(mockList, times(1)).get(eq(0));
View Full Code Here

        Architecture mockArchitecture = mock(Architecture.class);
        when(mockPackageVersion.getArchitecture()).thenReturn(mockArchitecture);
        when(mockPackageVersion.getExtraProperties()).thenReturn(null);

        //create object to test and inject required dependencies
        ContentManagerBean objectUnderTest = new ContentManagerBean();
        Field[] fields = ContentManagerBean.class.getDeclaredFields();

        for (Field field : fields) {
            if (field.getName().equals("entityManager")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockEntityManager);
                field.setAccessible(false);
            }
            else if (field.getName().equals("contentManager")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockContentManager);
                field.setAccessible(false);
            }
        }

        //run the code to be tested
        PackageVersion result = objectUnderTest.createPackageVersionWithDisplayVersion(mockSubject, packageName,
            packageTypeID, version, displayVersion, architectureId, packageBitStream);

        //verify the results (Assert and Mock Verification)
        verify(mockList, times(1)).size();
        verify(mockList, times(1)).get(eq(0));
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.content.ContentManagerBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.