Commit 6f8adc31 authored by Matija Obreza's avatar Matija Obreza
Browse files

Update javadoc

- JAutodoc headers and members
parent cabd3831
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -20,10 +20,15 @@ import org.junit.Before;
import org.springframework.transaction.annotation.Transactional;
/**
* The Class ServiceTest.
*
* @author Matija Obreza
*/
public abstract class ServiceTest extends BaseTest {
/**
* Before test.
*/
@Before
@Transactional
public void beforeTest() {
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -32,6 +32,9 @@ import java.util.Set;
import org.genesys.blocks.model.Copyable;
import org.junit.Test;
/**
* The Class CopyableTest.
*/
public class CopyableTest {
private static class Parent {
......@@ -93,6 +96,9 @@ public class CopyableTest {
}
}
/**
* Test copy.
*/
@Test
public void testCopy() {
final Child source = new Child();
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -27,11 +27,17 @@ import org.genesys.blocks.tests.ServiceTest;
import org.junit.Test;
import org.springframework.transaction.annotation.Transactional;
/**
* The Class UuidModelTest.
*/
@Transactional
public class UuidModelTest extends ServiceTest {
private static final String ENTITY_NAME = "Entity";
/**
* Test constructor.
*/
@Test
public void testConstructor() {
UuidEntity entity = new UuidEntity();
......@@ -40,6 +46,9 @@ public class UuidModelTest extends ServiceTest {
assertThat(entity.getVersion(), nullValue());
}
/**
* Version is 1 on persist.
*/
@Test
public void versionIs1OnPersist() {
UuidEntity entity = createEntity();
......@@ -48,6 +57,9 @@ public class UuidModelTest extends ServiceTest {
assertThat(entity.getVersion(), is(1));
}
/**
* Uuid is assigned on persist.
*/
@Test
public void uuidIsAssignedOnPersist() {
UuidEntity entity = createEntity();
......@@ -56,6 +68,9 @@ public class UuidModelTest extends ServiceTest {
assertThat(entity.getUuid(), not(nullValue()));
}
/**
* Uuid assigned is persisted.
*/
@Test
public void uuidAssignedIsPersisted() {
UuidEntity entity = createEntity();
......@@ -65,6 +80,11 @@ public class UuidModelTest extends ServiceTest {
assertThat(entity.getUuid(), is(uuid));
}
/**
* Creates the entity.
*
* @return the uuid entity
*/
public UuidEntity createEntity() {
UuidEntity entity = new UuidEntity();
entity.setName(ENTITY_NAME);
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -25,11 +25,17 @@ import org.genesys.blocks.tests.ServiceTest;
import org.junit.Test;
import org.springframework.transaction.annotation.Transactional;
/**
* The Class VersionedModelTest.
*/
@Transactional
public class VersionedModelTest extends ServiceTest {
private static final String ENTITY_NAME = "Entity";
/**
* Test constructor.
*/
@Test
public void testConstructor() {
VersionedEntity entity = new VersionedEntity();
......@@ -38,6 +44,9 @@ public class VersionedModelTest extends ServiceTest {
assertThat(entity.isActive(), is(true));
}
/**
* Version is 1 on persist.
*/
@Test
public void versionIs1OnPersist() {
VersionedEntity entity = createEntity();
......@@ -46,12 +55,18 @@ public class VersionedModelTest extends ServiceTest {
assertThat(entity.getVersion(), is(1));
}
/**
* Active is on.
*/
@Test
public void activeIsOn() {
VersionedEntity entity = versionedEntityRepository.save(createEntity());
assertThat(entity.getVersion(), is(1));
}
/**
* Active is off.
*/
@Test
public void activeIsOff() {
VersionedEntity entity = versionedEntityRepository.save(createEntity());
......@@ -60,6 +75,11 @@ public class VersionedModelTest extends ServiceTest {
assertThat(entity.isActive(), is(false));
}
/**
* Creates the entity.
*
* @return the versioned entity
*/
public VersionedEntity createEntity() {
VersionedEntity entity = new VersionedEntity();
entity.setName(ENTITY_NAME);
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2017 Global Crop Diversity Trust
Copyright 2018 Global Crop Diversity Trust
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -152,6 +152,9 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
@Type(type = "org.hibernate.type.TextType")
private String description;
/**
* Instantiates a new o auth client.
*/
public OAuthClient() {
setPrincipal(true);
}
......@@ -361,6 +364,11 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
return autoApproveScopes;
}
/**
* Sets the auto approve scopes.
*
* @param autoApproveScopes the new auto approve scopes
*/
public void setAutoApproveScopes(Set<String> autoApproveScopes) {
this.autoApproveScopes = autoApproveScopes;
}
......@@ -375,6 +383,11 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
return resourceIds;
}
/**
* Sets the resource ids.
*
* @param resourceIds the new resource ids
*/
public void setResourceIds(Set<String> resourceIds) {
this.resourceIds = resourceIds;
}
......@@ -407,6 +420,11 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
return scopes;
}
/**
* Sets the scopes.
*
* @param scopes the new scopes
*/
public void setScopes(Set<String> scopes) {
this.scopes = scopes;
}
......@@ -421,6 +439,11 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
return grantTypes;
}
/**
* Sets the grant types.
*
* @param grantTypes the new grant types
*/
public void setGrantTypes(Set<String> grantTypes) {
this.grantTypes = grantTypes;
}
......@@ -435,6 +458,11 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
return redirectUris;
}
/**
* Sets the redirect uris.
*
* @param redirectUris the new redirect uris
*/
public void setRedirectUris(Set<String> redirectUris) {
this.redirectUris = redirectUris;
}
......@@ -527,6 +555,11 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
return additionalInformation;
}
/**
* Sets the additional information.
*
* @param additionalInformation the additional information
*/
public void setAdditionalInformation(Map<String, Object> additionalInformation) {
this.additionalInformation = additionalInformation;
}
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -28,7 +28,8 @@ public enum OAuthRole implements GrantedAuthority {
CLIENT,
/** The trusted client. */
TRUSTED_CLIENT,
/** Everyone */
/** Everyone. */
EVERYONE;
/**
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -85,6 +85,7 @@ public class OAuthServiceImpl implements OAuthClientDetailsService, OAuthTokenSt
@Autowired
private AccessTokenRepository accessTokenRepository;
/** The password encoder. */
@Autowired
public PasswordEncoder passwordEncoder;
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
......@@ -31,7 +31,7 @@ import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;
/**
* App Blocks utility with handy updates :-)
* App Blocks utility with handy updates :-).
*
* @author Matija Obreza
*/
......@@ -45,6 +45,7 @@ public class AppBlocksInitializer implements InitializingBean {
@Autowired
private PasswordEncoder passwordEncoder;
/** The tx manager. */
@Autowired
@Qualifier("transactionManager")
protected PlatformTransactionManager txManager;
......@@ -60,7 +61,7 @@ public class AppBlocksInitializer implements InitializingBean {
}
/**
* Ensure that all clientSecrets are encrypted
* Ensure that all clientSecrets are encrypted.
*/
void encodePasswords() {
long count = 0;
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -28,6 +28,8 @@ import org.springframework.security.core.userdetails.UserDetails;
* The Class SecurityContextUtil.
*/
public class SecurityContextUtil {
/** The Constant LOG. */
public static final Logger LOG = LoggerFactory.getLogger(SecurityContextUtil.class);
/**
......@@ -68,7 +70,7 @@ public class SecurityContextUtil {
}
/**
* Gets the current principal (User or OAuthClient)
* Gets the current principal (User or OAuthClient).
*
* @param <T> the generic type
* @return the current security principal
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment